feat(anthropic): add Claude Opus 5 - #34518
Conversation
Registers claude-opus-5 across the cost maps and provider lists so the model prices, reports its real 1M/128K limits, and advertises its capabilities instead of falling through the generalization patterns at zero cost. Adds the first-party entry plus the Bedrock (base, global, us, eu, au, jp), Vertex AI, and Azure AI variants. Pricing matches Opus 4.8 at $5/$25 per MTok with the usual 1.1x regional premium on the cross-region inference profiles, and fast mode is priced at 2x through provider_specific_entry on the first-party entry only. Two fields deliberately differ from Opus 4.8: prompt_cache_min_tokens drops to 512, and bedrock_output_config_effort_ceiling is omitted because Bedrock accepts output_config.effort="max" for Opus 5.
Greptile SummaryAdds Claude Opus 5 support across LiteLLM's provider and model metadata surfaces
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified The new model identifiers resolve through their intended providers, Bedrock variants route through Converse, root and fallback metadata agree, and the added tests exercise the behavior-bearing pricing and capability fields without network access
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds consistent Claude Opus 5 pricing and capability metadata for ten direct and hosted-provider variants |
| litellm/model_prices_and_context_window_backup.json | Mirrors the new Opus 5 entries in the bundled fallback cost map |
| litellm/constants.py | Registers the base Bedrock Opus 5 identifier for Converse routing |
| litellm/setup_wizard.py | Adds Claude Opus 5 to the Anthropic models generated by the setup wizard |
| tests/llm_translation/reasoning_effort_grid/grid_spec.py | Adds the direct Anthropic Opus 5 model to live reasoning-effort coverage |
| tests/test_litellm/test_claude_opus_5_config.py | Adds local-only tests for pricing, capabilities, provider resolution, fallback metadata, caching, strict tools, and fast mode |
Reviews (1): Last reviewed commit: "feat(anthropic): add Claude Opus 5" | Re-trigger Greptile
| "supports_vision": true, | ||
| "supports_xhigh_reasoning_effort": true, | ||
| "supports_max_reasoning_effort": true, | ||
| "provider_specific_entry": { |
There was a problem hiding this comment.
High: Prompt-cache usage bypasses pricing modifiers
The new us and fast modifiers are applied in litellm/llms/anthropic/cost_calculation.py only after cache read/write costs are subtracted. An authenticated user can issue cache-heavy Opus 5 requests with inference_geo="us" or speed="fast" and have those cached tokens charged at the base rate instead of the selected provider rate, allowing their proxy budget to understate upstream spend. Apply provider-specific modifiers to the applicable cache charges as well, and cover cached usage in the pricing test and bundled backup entry.
There was a problem hiding this comment.
This is a billing thing and it's not related to Opus 5. We will cut a new PR for this
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
TLDR
Problem this solves:
claude-opus-5is unknown to LiteLLMHow it solves it:
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Live proxy, real Anthropic and Bedrock calls, same config both runs:
Before (commit
33b9524daf, port 41733)The generalization patterns already route the model, so calls succeed; they just cost nothing and carry no limits
$ curl -sS -D - -o /dev/null -X POST http://localhost:41733/v1/chat/completions \ -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \ -d '{"model":"claude-opus-5","messages":[{"role":"user","content":"What is the capital of France? One word."}],"max_tokens":1024}' \ | grep -iE '^HTTP/|^x-litellm-response-cost:' HTTP/1.1 200 OK $ curl -sS -D - -o /dev/null -X POST http://localhost:41733/v1/chat/completions \ -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \ -d '{"model":"bedrock-opus-5","messages":[{"role":"user","content":"Reply with exactly: hello"}],"max_tokens":64}' \ | grep -iE '^HTTP/|^x-litellm-response-cost:' HTTP/1.1 200 OKNo
x-litellm-response-costheader on either route, and/model_group/infohas nothing to report:[ { "model_group": "claude-opus-5", "max_input_tokens": null, "max_output_tokens": null, "input_cost_per_token": 0.0, "output_cost_per_token": 0.0 }, { "model_group": "bedrock-opus-5", "max_input_tokens": null, "max_output_tokens": null, "input_cost_per_token": 0.0, "output_cost_per_token": 0.0 } ]After (commit
ae81625ee6, port 39147)$ curl -sS -D - -X POST http://localhost:39147/v1/chat/completions \ -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \ -d '{"model":"claude-opus-5","messages":[{"role":"user","content":"What is the capital of France? One word."}],"max_tokens":1024}' HTTP/1.1 200 OK x-litellm-response-cost: 0.00021 content: Paris usage: 17 in / 5 out17 x $5/MTok + 5 x $25/MTok = $0.00021, exactly what the header reports
$ curl -sS -D - -X POST http://localhost:39147/v1/chat/completions \ -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \ -d '{"model":"bedrock-opus-5","messages":[{"role":"user","content":"Reply with exactly: opus 5 online"}],"max_tokens":64}' HTTP/1.1 200 OK x-litellm-response-cost: 0.000341 {"choices":[{"finish_reason":"stop","index":0,"message":{"content":"opus 5 online","role":"assistant"}}], "usage":{"completion_tokens":8,"prompt_tokens":22,"total_tokens":30}}22 x $5.50/MTok + 8 x $27.50/MTok = $0.000341, i.e. the 1.1x cross-region premium is applied
$ curl -sS -D - -X POST http://localhost:39147/v1/chat/completions \ -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \ -d '{"model":"claude-opus-5","reasoning_effort":"xhigh","messages":[{"role":"user","content":"What is 17*23? Answer with the number only."}],"max_tokens":2048}' HTTP/1.1 200 OK x-litellm-response-cost: 0.000755 {"choices":[{"finish_reason":"stop","index":0,"message":{"content":"391","role":"assistant", "thinking_blocks":[{"type":"thinking","signature":"CAISpQIKhwEIEBgCKkC+6Vc1kva..."}]}}], "usage":{"completion_tokens":26,"prompt_tokens":21,"total_tokens":47}}$ curl -sS http://localhost:39147/model_group/info -H "Authorization: Bearer $LITELLM_MASTER_KEY"[ { "model_group": "claude-opus-5", "max_input_tokens": 1000000.0, "max_output_tokens": 128000.0, "input_cost_per_token": 5e-06, "output_cost_per_token": 2.5e-05, "supports_reasoning": true, "supports_vision": true, "supports_function_calling": true }, { "model_group": "bedrock-opus-5", "max_input_tokens": 1000000.0, "max_output_tokens": 128000.0, "input_cost_per_token": 5.5e-06, "output_cost_per_token": 2.75e-05, "supports_reasoning": true, "supports_vision": true, "supports_function_calling": true } ]The Vertex AI and Azure AI entries could not be exercised live from this machine (expired ADC credentials and a 401 from the local Foundry endpoint respectively), so they are copied from the corresponding Opus 4.8 entries with the same three deltas as every other variant
Type
🆕 New Feature
Changes
Ten cost-map entries land in both
model_prices_and_context_window.jsonand the bundledlitellm/model_prices_and_context_window_backup.json: the first-partyclaude-opus-5, the Bedrock profiles (anthropic.,global.anthropic.,us.,eu.,au.,jp.),vertex_ai/claude-opus-5plus its@defaultalias, andazure_ai/claude-opus-5. Each is derived from its Opus 4.8 sibling, so pricing stays at $5/$25 per MTok with the usual 1.25x cache write, 2x 1-hour cache write, and 0.1x cache read multipliers, the regional Bedrock profiles keep the 1.1x premium, and the gen-5 capability profile (adaptive thinking, no sampling params, no assistant prefill,xhighandmaxeffort) carries overThree fields differ from Opus 4.8.
prompt_cache_min_tokensdrops from 1024 to 512, which is what the router's prompt-caching check reads.bedrock_output_config_effort_ceilingis dropped entirely because Bedrock acceptsoutput_config.effort="max"for Opus 5; verified with a live 200 againstus.anthropic.claude-opus-5. Andazure_ai/claude-opus-5gets the fullmax_input_tokens: 1000000rather than the 200000 the Azure Opus 4.8 entry carriesOutside the cost maps,
anthropic.claude-opus-5joinsBEDROCK_CONVERSE_MODELS, the setup wizard lists the model under Anthropic, and the live reasoning-effort grid gains aclaude-opus-5entry so the effort ladder is exercised against the real APItests/test_litellm/test_claude_opus_5_config.pycovers pricing and capabilities, regional Bedrock pricing, the absent effort ceiling, strict-tool rejection on Converse, the 512-token cache minimum, fast-mode pricing at 2x, backup-map parity, and provider resolution. Every assertion was mutation-checked: reverting any of the three deltas, the pricing, or the limits fails at least one testOne note for a follow-up, out of scope here:
_BEDROCK_OUTPUT_CONFIG_EFFORT_ORDERinlitellm/llms/bedrock/common_utils.pyranksmax(3) belowxhigh(4), so thexhighceiling on Opus 4.7 and 4.8 never actually clamps amaxrequest. That inversion is why the ceiling test here asserts the cost-map entry rather than calling the normalizerFinal Attestation