Skip to content

feat: add Anthropic 1M context window toggle for Agents model configs#27257

Merged
ibetitsmike merged 1 commit into
mainfrom
mike/product-501-anthropic-1m-context
Jul 17, 2026
Merged

feat: add Anthropic 1M context window toggle for Agents model configs#27257
ibetitsmike merged 1 commit into
mainfrom
mike/product-501-anthropic-1m-context

Conversation

@ibetitsmike

Copy link
Copy Markdown
Collaborator

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-07 header 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 as anthropic_beta before SigV4 signing, which is covered by tests. The toggle has no effect on other providers, and existing Anthropic-Beta extra headers take precedence over the config-derived one.

Changes

  • codersdk: Context1MEnabled field on ChatModelAnthropicProviderOptions; the admin UI form renders it automatically from generated options metadata.
  • chatprovider: BetaHeadersFromCallConfig derives beta headers from a model call config, gated to Anthropic/Bedrock.
  • chatd: model config Options are plumbed through modelClientRequest.ConfigOptions into newModel, which merges derived beta headers into extra headers (main chat, advisor override, manual title, and title override paths).
  • Docs: new row in the Anthropic options table in docs/ai-coder/agents/models.md.
  • Tests: unit table for header derivation, Anthropic and Bedrock transport-level tests, an end-to-end chatd test through a stored model config, and a frontend form logic round-trip test.

Mux authored this PR on Mike's behalf.

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.
@linear-code

linear-code Bot commented Jul 15, 2026

Copy link
Copy Markdown

PRODUCT-501

@github-actions

Copy link
Copy Markdown

Docs preview

📖 View docs preview for docs/ai-coder/agents/models.md

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 885eb4ac01

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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
ibetitsmike marked this pull request as ready for review July 17, 2026 11:03
@ibetitsmike
ibetitsmike merged commit 1ac1062 into main Jul 17, 2026
59 of 60 checks passed
@ibetitsmike
ibetitsmike deleted the mike/product-501-anthropic-1m-context branch July 17, 2026 11:04
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants