Skip to content

fix(llm): recognize claude-opus-4-8 as a reasoning model on Bedrock#3695

Open
kimnamu wants to merge 1 commit into
OpenHands:mainfrom
kimnamu:fix/recognize-opus-4-8-reasoning-bedrock
Open

fix(llm): recognize claude-opus-4-8 as a reasoning model on Bedrock#3695
kimnamu wants to merge 1 commit into
OpenHands:mainfrom
kimnamu:fix/recognize-opus-4-8-reasoning-bedrock

Conversation

@kimnamu

@kimnamu kimnamu commented Jun 13, 2026

Copy link
Copy Markdown

HUMAN:

I reviewed this change locally against the pinned litellm 1.84.1, confirmed the Bedrock cross-region reasoning gap, and verified the regression tests fail before / pass after the one-line fix.

  • A human has tested these changes.

AGENT:


Why

LiteLLM 1.84.1 recognizes anthropic/claude-opus-4-8 but not its Bedrock cross-region ids (bedrock/{us,eu,apac,global}.anthropic.claude-opus-4-8-v1:0), so on Bedrock the model falls through to the non-reasoning branch and leaks temperature/top_p → Anthropic 400. This mirrors the fable-5 gap fixed in #3642; opus-4-7's Bedrock ids are already covered by LiteLLM metadata.

It deliberately uses REASONING_EFFORT_MODELS (strips temp/top_p only), not EXTENDED_THINKING_MODELS — adding it there is what #3427 did and #3441 reverted, because that branch injects the legacy thinking.type=enabled block + interleaved-thinking header that Anthropic now rejects for opus-4-8.

Summary

Issue Number

Fixes #3694

How to Test

Run the added offline unit tests (no network):

uv run pytest tests/sdk/llm/test_model_features.py -k opus_4_8
uv run pytest tests/sdk/llm/options/test_chat_options.py -k bedrock_opus_4_8

Before/after evidence: with the source line reverted (git stash push -- openhands-sdk/openhands/sdk/llm/utils/model_features.py), the new tests FAIL — temperature leaks and _supports_reasoning_effort("bedrock/us.anthropic.claude-opus-4-8-v1:0") returns False (5 failed, 36 passed). Restoring the line → 174 passed. Local pre-commit (ruff + pyright) passes.

item Before After
_supports_reasoning_effort("bedrock/us.anthropic.claude-opus-4-8-v1:0") ❌ False ✅ True
temp/top_p in request for that id ❌ sent (→ Anthropic 400) ✅ stripped
anthropic/claude-opus-4-8 (already worked) ✅ True ✅ unchanged
legacy thinking.type=enabled block / beta header n/a ✅ NOT injected (asserted in test)
public API / signatures ✅ unchanged (data line only)

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

This contribution was prepared with the help of an AI agent (Claude Code); a human reviewed the change, rationale, and test results before submission.

LiteLLM (>=1.84.1) recognizes the first-party "anthropic/claude-opus-4-8"
id as a reasoning model, but not the Bedrock cross-region inference ids
(e.g. "bedrock/us.anthropic.claude-opus-4-8-v1:0"). Those forms fall
through to the non-reasoning branch in chat_options.py and leave
temperature/top_p in the request, which Anthropic rejects for this model.

Add "claude-opus-4-8" to the REASONING_EFFORT_MODELS override list,
mirroring the existing claude-fable-5 entry (OpenHands#3642). This routes the
model through the reasoning_effort path that strips temperature/top_p,
without taking the extended-thinking path that injects the legacy
thinking.type=enabled block (which Anthropic now rejects for opus-4-8 —
see reverted OpenHands#3427 / revert OpenHands#3441).

Co-authored-by: openhands <openhands@all-hands.dev>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude-opus-4-8 on Bedrock cross-region ids not recognized as a reasoning model (temperature/top_p leak → 400)

1 participant