Use Claude Opus 4.6 with 1M context window as default Anthropic model

Switch default model from claude-sonnet-4-5 to claude-opus-4-6 across
run and serve commands. Enable the 1M token context window via the
context-1m-2025-08-07 beta header for opus-4-6 requests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-02-23 14:23:45 -05:00
parent 4f31a84ee6
commit 242e82fffd
4 changed files with 27 additions and 5 deletions

View file

@ -138,17 +138,29 @@ in the project. Keep changes minimal and focused on the task.";
}
fn capabilities(&self) -> ProfileCapabilities {
let context_window_size = if self.model().contains("opus-4-6") {
1_000_000
} else {
200_000
};
ProfileCapabilities {
supports_reasoning: true,
supports_streaming: true,
supports_parallel_tool_calls: true,
context_window_size: 200_000,
context_window_size,
}
}
fn provider_options(&self) -> Option<serde_json::Value> {
let model = self.model();
if model.contains("opus-4-6") || model.contains("sonnet-4-6") {
if model.contains("opus-4-6") {
Some(serde_json::json!({
"anthropic": {
"thinking": {"type": "adaptive"},
"beta_headers": ["context-1m-2025-08-07"]
}
}))
} else if model.contains("sonnet-4-6") {
Some(serde_json::json!({
"anthropic": {
"thinking": {"type": "adaptive"}
@ -185,6 +197,12 @@ mod tests {
assert_eq!(profile.context_window_size(), 200_000);
}
#[test]
fn anthropic_opus_4_6_has_1m_context_window() {
let profile = AnthropicProfile::new("claude-opus-4-6");
assert_eq!(profile.context_window_size(), 1_000_000);
}
#[test]
fn anthropic_system_prompt_contains_env_context() {
let profile = AnthropicProfile::new("claude-sonnet-4-20250514");
@ -284,6 +302,10 @@ mod tests {
Some("adaptive"),
"thinking type should be adaptive"
);
let beta_headers = options["anthropic"]["beta_headers"]
.as_array()
.expect("beta_headers should be an array");
assert_eq!(beta_headers[0].as_str(), Some("context-1m-2025-08-07"));
}
#[test]

View file

@ -120,7 +120,7 @@ pub async fn run_command(args: RunArgs, styles: &'static Styles) -> anyhow::Resu
.unwrap_or_else(|| match provider.as_deref() {
Some("openai") => "gpt-5.2".to_string(),
Some("gemini") => "gemini-3.1-pro-preview".to_string(),
_ => "claude-sonnet-4-5".to_string(),
_ => "claude-opus-4-6".to_string(),
});
// 6. Build engine

View file

@ -44,7 +44,7 @@ pub async fn serve_command(args: ServeArgs, styles: &'static Styles) -> anyhow::
let model = args.model.unwrap_or_else(|| match provider.as_deref() {
Some("openai") => "gpt-5.2".to_string(),
Some("gemini") => "gemini-3.1-pro-preview".to_string(),
_ => "claude-sonnet-4-5".to_string(),
_ => "claude-opus-4-6".to_string(),
});
// Build registry factory

View file

@ -3,7 +3,7 @@
"id": "claude-opus-4-6",
"provider": "anthropic",
"display_name": "Claude Opus 4.6",
"context_window": 200000,
"context_window": 1000000,
"max_output": 128000,
"supports_tools": true,
"supports_vision": true,