feat(llm): support Claude 1M token context window beta header#1684
Merged
feat(llm): support Claude 1M token context window beta header#1684
Conversation
Add opt-in `enable_extended_context` flag to `CloudLlmConfig`. When enabled, injects `anthropic-beta: context-1m-2025-08-07` into all Claude API requests, unlocking the 1M token context window for Opus 4.6 and Sonnet 4.6. - `context_window()` returns 1_000_000 for opus/sonnet when enabled - Haiku is excluded (200K cap retained) with a tracing::warn! - All 4 Claude construction sites in bootstrap/provider.rs wired - Summary provider intentionally skipped (capped at 4096 max_tokens) - beta_header() supports comma-separated multiple betas (compatible with interleaved-thinking) - --init wizard prompts for extended context under Claude provider arm - config/default.toml documents the option with pricing note - 7 new unit tests covering enabled/disabled/haiku/combined scenarios Closes #1649
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
enable_extended_context: booltoCloudLlmConfig(defaultfalse)anthropic-beta: context-1m-2025-08-07header into all Claude API requestscontext_window()returns1_000_000for Opus 4.6 / Sonnet 4.6 when enabled (Haiku excluded with warning)interleaved-thinkingbeta via comma-separated header valuesConfiguration
Changes
crates/zeph-core/src/config/types.rs:enable_extended_contextfield onCloudLlmConfigcrates/zeph-llm/src/claude.rs: beta header injection,context_window()fix, 7 new unit testscrates/zeph-core/src/bootstrap/provider.rs: all 4 Claude construction sites wiredconfig/default.toml: documented option with pricing notesrc/init.rs: wizard prompt under Claude provider armCHANGELOG.md: entry in[Unreleased]Test plan
cargo nextest run --workspace --features full --lib --bins— 5278 tests passenable_extended_context = truein config, run with Claude Sonnet 4.6, verify beta header in debug dumpCloses #1649