Skip to content

feat: add CC Compatible connection-level 1M context toggle - #1357

Closed
rdself wants to merge 1 commit into
cheaper-inference:release/v3.6.8from
rdself:coder/cc-compatible-1m-toggle
Closed

rdself wants to merge 1 commit into
cheaper-inference:release/v3.6.8from
rdself:coder/cc-compatible-1m-toggle

Conversation

@rdself

@rdself rdself commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a connection-level CC Compatible 1M Context toggle to the provider connection UI
  • persist the toggle in providerSpecificData.requestDefaults.context1m with normalization and schema validation
  • append anthropic-beta: context-1m-2025-08-07 for CC Compatible requests when the connection toggle is enabled, without altering model ids
  • cover the new behavior with executor, schema, and request-defaults tests

Why

CC Compatible connections need a connection-scoped configuration similar to the Codex OAuth fast service tier controls. The 1M behavior should be explicitly enabled per connection and should not rely on model-name suffixes.

Validation

  • npx prettier --write open-sse/executors/base.ts open-sse/services/claudeCodeCompatible.ts 'src/app/(dashboard)/dashboard/providers/[id]/page.tsx' src/lib/providers/requestDefaults.ts src/shared/validation/schemas.ts tests/unit/executor-default-base.test.ts tests/unit/provider-specific-data-schema.test.ts tests/unit/request-defaults-store-session.test.ts
  • node --import tsx/esm --test tests/unit/provider-specific-data-schema.test.ts tests/unit/request-defaults-store-session.test.ts tests/unit/executor-default-base.test.ts
  • npx eslint open-sse/executors/base.ts open-sse/services/claudeCodeCompatible.ts 'src/app/(dashboard)/dashboard/providers/[id]/page.tsx' src/lib/providers/requestDefaults.ts src/shared/validation/schemas.ts tests/unit/executor-default-base.test.ts tests/unit/provider-specific-data-schema.test.ts tests/unit/request-defaults-store-session.test.ts
  • npm run typecheck:core

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@rdself
rdself marked this pull request as ready for review April 16, 2026 23:46
@rdself
rdself requested a review from diegosouzapw as a code owner April 16, 2026 23:46
Copilot AI review requested due to automatic review settings April 16, 2026 23:46
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a connection-scoped “CC Compatible 1M Context” toggle for Claude Code-compatible providers, persists it in providerSpecificData.requestDefaults.context1m, and uses it to append the anthropic-beta: context-1m-2025-08-07 header when enabled.

Changes:

  • Add UI controls to create/edit provider connections with a CC-compatible 1M context toggle.
  • Validate/normalize providerSpecificData.requestDefaults.context1m and expose helper accessors.
  • Append the 1M beta header in the executor path and add unit tests covering schema/defaults/executor behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/app/(dashboard)/dashboard/providers/[id]/page.tsx Adds create/edit UI toggle and wiring to persist requestDefaults.context1m.
src/lib/providers/requestDefaults.ts Adds normalization + getter for CC-compatible context1m request default.
src/shared/validation/schemas.ts Extends providerSpecificData validation to enforce boolean requestDefaults.context1m.
open-sse/executors/base.ts Appends anthropic-beta context-1m header based on extendedContext or CC connection defaults.
open-sse/services/claudeCodeCompatible.ts Introduces CONTEXT_1M_BETA_HEADER, model support check, and a safe header append helper.
tests/unit/executor-default-base.test.ts Verifies executor appends context-1m beta header based on CC connection defaults / extendedContext.
tests/unit/provider-specific-data-schema.test.ts Ensures schemas accept boolean requestDefaults.context1m and reject non-boolean values.
tests/unit/request-defaults-store-session.test.ts Ensures normalization preserves only valid CC-compatible context1m (and strips invalid types).

Comment on lines 1 to +28
@@ -20,6 +21,12 @@ function hasNonEmptyString(value: unknown): boolean {
return typeof value === "string" && value.trim().length > 0;
}

function isClaudeCodeCompatibleProvider(provider: string | null | undefined): boolean {
return (
typeof provider === "string" && provider.startsWith(CLAUDE_CODE_COMPATIBLE_PROVIDER_PREFIX)
);
}

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isClaudeCodeCompatibleProvider() and the anthropic-compatible-cc- prefix are redefined here, but similar helpers/constants already exist elsewhere (e.g. src/shared/constants/providers.ts and open-sse/services/claudeCodeCompatible.ts). Duplicating the prefix logic risks drift if the identifier format changes; prefer importing a single shared helper/constant rather than maintaining a third copy.

Copilot uses AI. Check for mistakes.
delete currentRequestDefaults.context1m;
}
updates.providerSpecificData.requestDefaults =
Object.keys(currentRequestDefaults).length > 0 ? currentRequestDefaults : undefined;

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In EditConnectionModal, when toggling CC Compatible 1M Context off and there are no other requestDefaults keys, updates.providerSpecificData.requestDefaults is set to undefined. Because the update payload is JSON-stringified, undefined fields are omitted, so the server merge will keep the existing requestDefaults (and context1m may never be cleared). Send an explicit value to overwrite/clear it (e.g. null or {} so normalization can remove it) when the object becomes empty.

Suggested change
Object.keys(currentRequestDefaults).length > 0 ? currentRequestDefaults : undefined;
Object.keys(currentRequestDefaults).length > 0 ? currentRequestDefaults : {};

Copilot uses AI. Check for mistakes.
modelSupportsContext1mBeta(model) &&
!isClaudeCodeCompatible(this.provider);
const shouldForwardCcCompatibleContext1m =
isClaudeCodeCompatible(this.provider) && ccRequestDefaults.context1m === true;

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldForwardCcCompatibleContext1m appends the 1M beta header for CC-compatible providers without checking whether the selected model supports the context-1m beta. Since modelSupportsContext1mBeta() and the supported model list already exist (and are used for extendedContext), consider applying the same model gating here to avoid sending anthropic-beta: context-1m-2025-08-07 on unsupported models.

Suggested change
isClaudeCodeCompatible(this.provider) && ccRequestDefaults.context1m === true;
isClaudeCodeCompatible(this.provider) &&
ccRequestDefaults.context1m === true &&
modelSupportsContext1mBeta(model);

Copilot uses AI. Check for mistakes.
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Thanks for this contribution! 🎉 The CC Compatible 1M context toggle has been integrated into the release/v3.6.8 branch and will be part of the next release. Great work!

@rdself
rdself deleted the coder/cc-compatible-1m-toggle branch April 20, 2026 05:35
@diegosouzapw diegosouzapw mentioned this pull request Apr 22, 2026
This was referenced Apr 30, 2026
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants