From 3cf6ee73553c9c24ddfc5e771817c89b3ea1cc9a Mon Sep 17 00:00:00 2001 From: Patrick Muller Date: Mon, 11 May 2026 17:32:16 -0700 Subject: [PATCH] fix(bedrock): correct Sonnet 4.5 and Haiku 4.5 context to 200K per Anthropic docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous commit in this branch bumped claude-sonnet-4-5 and claude-haiku-4-5 to 1_000_000 on the assumption the context-1m-2025-08-07 beta enabled 1M on all Claude 4.x models. Verification against Anthropic's own documentation shows that is incorrect: - Claude Haiku 4.5 is a standard 200K model per https://platform.claude.com/docs/en/about-claude/models/overview (the 'Latest models comparison' table shows '200k tokens' for Haiku 4.5). - Claude Sonnet 4.5 had its 1M beta retired on April 30, 2026 per https://platform.claude.com/docs/en/release-notes/overview: 'We've retired the 1M token context window beta (context-1m-2025-08-07) for Claude Sonnet 4.5 and Claude Sonnet 4. The beta header now has no effect on these models, and requests exceeding the standard 200k-token context window return an error.' Revert both entries to 200_000. Opus 4.7, Opus 4.6, and Sonnet 4.6 remain at 1_000_000 — those three have 1M generally available with no beta header required per the same source. Also updates the header comment to cite the Anthropic models overview and the April 30 2026 release note so future readers have an upstream source of truth. --- agent/bedrock_adapter.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/agent/bedrock_adapter.py b/agent/bedrock_adapter.py index a9afacfdc0a..845809643c5 100644 --- a/agent/bedrock_adapter.py +++ b/agent/bedrock_adapter.py @@ -1322,15 +1322,18 @@ def classify_bedrock_error(error_message: str) -> str: BEDROCK_CONTEXT_LENGTHS: Dict[str, int] = { # Anthropic Claude models on Bedrock. - # Claude 4.x (opus/sonnet/haiku) support a 1M-token context window via the - # ``context-1m-2025-08-07`` beta header, which Hermes injects automatically - # in ``build_anthropic_bedrock_client`` (see agent/anthropic_adapter.py). + # Context windows per Anthropic's official models comparison + # (https://platform.claude.com/docs/en/about-claude/models/overview). + # Sonnet 5 / Opus 4.7 / Opus 4.6 / Sonnet 4.6 have 1M generally + # available (no beta header required as of April 2026). Sonnet 4.5 and + # Sonnet 4 had their `context-1m-2025-08-07` beta retired on + # April 30, 2026, so they are standard 200K; Haiku 4.5 is 200K. "anthropic.claude-sonnet-5": 1_000_000, "anthropic.claude-opus-4-7": 1_000_000, "anthropic.claude-opus-4-6": 1_000_000, "anthropic.claude-sonnet-4-6": 1_000_000, - "anthropic.claude-sonnet-4-5": 1_000_000, - "anthropic.claude-haiku-4-5": 1_000_000, + "anthropic.claude-sonnet-4-5": 200_000, + "anthropic.claude-haiku-4-5": 200_000, "anthropic.claude-opus-4": 200_000, "anthropic.claude-sonnet-4": 200_000, "anthropic.claude-3-5-sonnet": 200_000,