fix(bedrock): correct Sonnet 4.5 and Haiku 4.5 context to 200K per Anthropic docs

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.
This commit is contained in:
Patrick Muller 2026-05-11 17:32:16 -07:00 committed by Teknium
parent c02466d5e8
commit 3cf6ee7355

View file

@ -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,