Add Claude Opus 5 (`claude-opus-5`) support
This pull request was posted by Claude Code using claude-opus-4-8 on behalf of David.
David steered the scope decisions in this PR (how to model the Opus 5 divergence, and to ground-truth the pre-existing claims rather than trust the docs) but has not reviewed the diff line by line.
Adds claude-opus-5, released 2026-07-24. No issue — same as the Claude Sonnet 5 add (#6161).
The /v1/models endpoint exposes exactly one new id, claude-opus-5, with no dated snapshot; Anthropic's model docs confirm that is intentional ("starting with the Claude 4.6 generation, model IDs use a dateless format that is also a pinned snapshot").
Capabilities — probed live, not mirrored
Every profile flag was verified against the API by probing claude-opus-5 side by side with claude-opus-4-8 rather than copying 4.8's profile. It matches 4.8 on: adaptive thinking (and rejects budget thinking), rejects temperature/top_p, effort incl. xhigh, task budgets, fast mode, json-schema output, forced tool_choice, tool search, advisor (as executor and as advisor), code execution 20260120, and web search/fetch 20260209.
It is not a pure 4.8 mirror. Opus 5 returns a 400 for xhigh/max effort while thinking is explicitly disabled, where 4.8 accepts the same request:
thinking={'type':'disabled'} + effort | claude-opus-5 | claude-opus-4-8 |
|---|---|---|
xhigh | 400 output_config.effort 'xhigh' is not supported when thinking is disabled on this model | accepted |
max | 400 | accepted |
high / unset | accepted | accepted |
Modeled as anthropic_disallows_top_effort_when_thinking_disabled with a fail-fast UserError, mirroring how _validate_task_budget_vs_context_management already handles a known-bad combination instead of forwarding an opaque 400.
Two probe results worth calling out, because reading the response alone would mislead:
- Fast mode — both
claude-opus-5andclaude-opus-4-8return an identical 429 (this org has zero fast-mode quota), which on its own proves nothing. The signal is the contrast with models that genuinely lack it:claude-opus-4-5,claude-sonnet-5, andclaude-opus-4-1all return a clean400 does not support the 'speed' parameter. A 429 means the request reached quota enforcement, i.e. the parameter is supported. - Advisor — the first probe failed with
'claude-opus-4-8' cannot be used as an advisor when the request model is 'claude-opus-5', which is a pairing rejection, not an executor-capability one. Re-probed across pairs:claude-opus-5is valid as an executor (advisorclaude-opus-5), and valid as an advisor forclaude-opus-4-8,claude-sonnet-5, andclaude-haiku-4-5executors.
Also in this PR
Stale copy that this change would otherwise have contradicted:
AnthropicModelSettings.anthropic_speeddocstring didn't list Opus 5, while its profile twin anddocs/models/anthropic.mddid. The same miss was caught by review on the Opus 4.8 add (#5709).- The task-budget docstring and
_get_task_budget'sUserErrorenumeratedclaude-opus-4-7/4-8only — already stale for Sonnet 5 and Fable 5. Rather than extend a fourth copy of the list, both now point at theanthropic_supports_task_budgetsprofile flag and the Anthropic docs, so there's one source of truth. - Guarded Bedrock structured output on
claude-opus-5inbedrock_structured_output_unsupported. Without it,BedrockProvider.model_profile('us.anthropic.claude-opus-5')flipssupports_json_schema_outputtoTrue— reachable today, sinceBedrockModelNameisLiteral[...] | str. This matches #5709, which addedclaude-opus-4-8to that tuple before any Bedrock id existed, and is exactly the defect #5581 filed.
Deliberate omissions
- No Bedrock/Heroku model ids. Only the structured-output guard above.
heroku:is enforced against Heroku's live catalog bytest_known_model_names, so a speculative entry would fail CI; Bedrock ids land in their own refresh PR (#6318), not in per-model adds. - No SDK floor bump.
anthropic0.109.0 lacks the id, so it goes on the existingAnthropicModelNamebridgeLiteral, per the established bridge-then-drop pattern (#5849). - Not added to the
claude-opus-4-7/4-8parametrize lists.test_model_profile_opus_5asserts every flag those cover, so adding the id would be duplicate coverage.
Two claims flagged during review as provider-doc contradictions were ground-truthed and left alone, because the API disagrees with the docs: Sonnet 5 does accept task budgets (200, though the docs table says "Not supported"), and Opus 4.7 fast mode is still live (429 quota, not the documented removal). Changing either would have broken working behavior.
Checklist
- Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
- No breaking changes in accordance with the version policy.
- PR title is fit for the release changelog.