feat: add Anthropic 1M context window toggle for Agents model configs#27257
Merged
Conversation
Add a context_1m_enabled boolean to the Anthropic provider options on chat model configs. When enabled and the resolved provider speaks the Anthropic API (Anthropic or Bedrock), chatd sends the anthropic-beta: context-1m-2025-08-07 header on generation requests, unlocking the 1M token context window on supported Claude models. On Bedrock the SDK middleware moves the header into the anthropic_beta body field before SigV4 signing. The schema-driven admin UI renders the new toggle automatically from the regenerated chat model options schema.
Docs preview📖 View docs preview for |
Collaborator
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ibetitsmike
marked this pull request as ready for review
July 17, 2026 11:03
ThomasK33
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an optional "1M Context Window" toggle to Anthropic model config options in the Agents admin panel (PRODUCT-501).
When enabled on an Anthropic or Bedrock model config, chatd sends the
anthropic-beta: context-1m-2025-08-07header on generation calls, unlocking the 1M token context window on supported Claude models. On Bedrock, the Anthropic SDK middleware moves the header into the request body asanthropic_betabefore SigV4 signing, which is covered by tests. The toggle has no effect on other providers, and existingAnthropic-Betaextra headers take precedence over the config-derived one.Changes
codersdk:Context1MEnabledfield onChatModelAnthropicProviderOptions; the admin UI form renders it automatically from generated options metadata.chatprovider:BetaHeadersFromCallConfigderives beta headers from a model call config, gated to Anthropic/Bedrock.chatd: model configOptionsare plumbed throughmodelClientRequest.ConfigOptionsintonewModel, which merges derived beta headers into extra headers (main chat, advisor override, manual title, and title override paths).docs/ai-coder/agents/models.md.