Repository navigation
feat(anthropic): add Claude Sonnet 5 - #31740
Conversation
Register claude-sonnet-5 across the Anthropic, Bedrock (base + global/us/eu/au/jp cross-region inference profiles), Vertex AI, and Azure AI cost-map entries in both the root and bundled-backup model maps, plus BEDROCK_CONVERSE_MODELS and the setup-wizard provider list. Sonnet 5 ships with the gen-5 adaptive-thinking profile (adaptive thinking always on, no extended thinking, effort defaults to high), so the entries mirror the Fable 5 / Opus 4.8 sampling-param and prefill restrictions rather than the older Sonnet 4.6 behavior: supports_sampling_params and supports_assistant_prefill are false while supports_adaptive_thinking, supports_xhigh_reasoning_effort, and supports_max_reasoning_effort are true. Pricing follows standard Sonnet rates ($3 / $15 per MTok) with the 10% regional premium on the us/eu/au/jp profiles. Add a reasoning-effort grid entry for the Anthropic direct route and a regression test pinning pricing, capabilities, regional premiums, backup parity, and bare-name provider resolution. Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
|
|
Merging this PR will not alter performance
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_completion_multi_turn |
3.1 ms | 4.2 ms | -25.36% |
| ⚡ | test_completion_with_tools |
4.2 ms | 3.2 ms | +30.76% |
| ⚡ | test_completion_simple_message |
4.2 ms | 3.2 ms | +28.82% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing litellm_add-claude-sonnet-5-c71c (6d43c21) with litellm_internal_staging (6d828e5)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…net-5 The Sonnet 5 grid entry raised the Anthropic direct route to 30 model combos, so test_grid_cell_count now expects 330 cells instead of 319.
Greptile SummaryThis PR registers
Confidence Score: 5/5Safe to merge — all changes are additive cost-map and constant registrations with no modifications to existing entries or runtime logic. Every new entry follows the established gen-5 model pattern (claude-fable-5 / claude-opus-4-8) exactly: capability flags, pricing math, regional premium calculations, and the presence/absence of provider-specific fields on each surface all check out. The backup JSON mirrors the root map, tests are purely local with no network calls, and the new test suite provides solid regression coverage for pricing, capability flags, and provider resolution. No files require special attention.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds ten claude-sonnet-5 entries (Anthropic, Bedrock x6, Vertex AI x2, Azure AI) with correct gen-5 capability flags and pricing; follows the claude-fable-5 pattern precisely. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the same ten entries from the root cost map; parity verified by the new test_sonnet_5_present_in_bundled_backup test. |
| litellm/constants.py | Adds anthropic.claude-sonnet-5 to BEDROCK_CONVERSE_MODELS, correctly positioned adjacent to other gen-5 models. |
| tests/test_litellm/test_claude_sonnet_5_config.py | New test file covering pricing, regional premiums, backup parity, BEDROCK_CONVERSE_MODELS registration, provider resolution, and adaptive-thinking flags — all tests are purely local (JSON reads + monkeypatching, no network calls). |
| tests/llm_translation/reasoning_effort_grid/grid_spec.py | Adds claude-sonnet-5 to ANTHROPIC_DIRECT_MODELS with mode="adaptive" and _CAPS_XHIGH_MAX, consistent with other gen-5 entries. |
| tests/llm_translation/reasoning_effort_grid/test_reasoning_effort_grid.py | Updates grid cell count assertion from 29×11 to 30×11 to account for the new model entry. |
| litellm/setup_wizard.py | Adds claude-sonnet-5 to the Anthropic provider model list in the setup wizard. |
Reviews (3): Last reviewed commit: "fix(anthropic): drop redundant supports_..." | Re-trigger Greptile
…re Sonnet 5 The Vertex AI and Azure AI Sonnet 5 entries carried supports_output_config: true, which the gen-5 siblings (vertex_ai/claude-opus-4-8, azure_ai/claude-fable-5, etc.) do not. The flag only feeds AnthropicConfig._model_supports_effort_param, which already returns true for these entries via supports_xhigh/max_reasoning_effort, so output_config.effort still forwards on both routes. Removing it is behavior neutral and matches the existing per-platform convention for gen-5 Claude.
|
On the Worth being precise about the 400 framing though, since this flag was not what gates |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6d43c21. Configure here.
8beb68a
into
litellm_internal_staging
Relevant issues
Adds support for Claude Sonnet 5 (
claude-sonnet-5), released by Anthropic on June 30, 2026Linear ticket
N/A
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewChanges
Registers
claude-sonnet-5across the cost map so it resolves on every surface it ships on. The new entries cover Anthropic direct (claude-sonnet-5), Bedrock (anthropic.claude-sonnet-5plus theglobal/us/eu/au/jpcross-region inference profiles), Vertex AI (vertex_ai/claude-sonnet-5andvertex_ai/claude-sonnet-5@default), and Azure AI / Microsoft Foundry (azure_ai/claude-sonnet-5). The entries land in bothmodel_prices_and_context_window.jsonand the bundledlitellm/model_prices_and_context_window_backup.jsonso the model resolves whether litellm uses the network-fetched map or the local fallback.anthropic.claude-sonnet-5is added toBEDROCK_CONVERSE_MODELSandclaude-sonnet-5to the setup-wizard provider listSonnet 5 uses the gen-5 adaptive-thinking profile (adaptive thinking always on, no extended thinking,
effortdefaults to high), so the entries follow Fable 5 / Opus 4.8 rather than the older Sonnet 4.6 shape:supports_sampling_paramsandsupports_assistant_prefillare false (the API rejectstemperatureother than 1,top_p,top_k, and prefill on this generation, verified live below), whilesupports_adaptive_thinking,supports_xhigh_reasoning_effort, andsupports_max_reasoning_effortare true. Pricing uses standard Sonnet rates of $3 / $15 per MTok with the usual 1.25x cache-write and 0.1x cache-read multipliers; theus/eu/au/jpBedrock profiles carry the standard 10% regional premium ($3.30 / $16.50 per MTok). Context window is 1M input / 128k output. Anthropic's introductory $2 / $10 pricing through August 31, 2026 is intentionally not encoded since it is a temporary discountA reasoning-effort grid entry is added for the Anthropic direct route, and a new regression test (
tests/test_litellm/test_claude_sonnet_5_config.py) pins pricing, the gen-5 capability flags, the regional premiums, root/backup parity, Bedrock-converse registration, and bare-name provider resolutionScreenshots / Proof of Fix
Real end-to-end call against the live Anthropic API (no mocks, real tokens billed):
The gen-5 capability flags are verified directly against the Anthropic Messages API, confirming the entries match real provider behavior:
That matches
supports_sampling_params: falseandsupports_assistant_prefill: falseon every Sonnet 5 entryMulti-provider e2e QA (real calls, no mocks)
Bedrock is fully verified end to end against
us-east-1through the US cross-region inference profile, on both the Converse and the InvokeModel routes, with a real billed 200 and the cost computed from the new map entry:The bare on-demand id is registered too, and Bedrock itself rejects on-demand throughput for this generation and asks for an inference profile, which is the expected provider behavior rather than a routing bug:
Vertex AI and Azure AI Foundry were exercised against the live APIs as well, and litellm builds and sends the correct request on both: Vertex
rawPredict/streamRawPredicttopublishers/anthropic/models/claude-sonnet-5(the@defaultalias is preserved), and AzurePOST /anthropic/v1/messageswith theanthropic-versionheader and the transformed body. Both providers accept and route the request, so litellm's transformation and pricing are confirmed end to end. We could not obtain a full 200 on either because neither test account has been granted Sonnet 5 token throughput yet, which is external to litellm and expected for a same-day release: on Vertex the model is enabled in Model Garden but its per-base-model online-prediction token quota in us-east5 defaults to 0, so calls return429 RESOURCE_EXHAUSTED(a quota-increase request has been filed and is pending), and on Azure the model is offered and deployable in eastus2 but itsAIServices.GlobalStandard.claude-sonnet-5capacity quota is 0/0, so a deployment cannot be created until that quota is raised. In both cases the model is recognized by the provider and the sole gate is a zero default quota on a brand-new model, not anything in this PRProxy reproduction for reviewers on a funded key
Type
🆕 New Feature
Slack Thread