Complete Claude 4.6 support alignment with compatibility aliases#21413
Complete Claude 4.6 support alignment with compatibility aliases#21413PeterDaveHello wants to merge 1 commit intoBerriAI:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR extends Claude 4.6 support by adding Sonnet 4.6 model detection and wiring it into the existing Anthropic transformation logic. Key changes:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| litellm/llms/anthropic/chat/transformation.py | Adds _is_claude_sonnet_4_6 helper and wires Sonnet 4.6 into adaptive thinking and native structured output paths. Correctly restricts effort='max' to Opus 4.6 only. Adds underscore aliases for 4.6 models in response_format model set. |
| model_prices_and_context_window.json | Adds jp. and apac. regional entries for Opus 4.6 and jp. for Sonnet 4.6. Pricing and capabilities match existing regional entries for these models. |
| litellm/model_prices_and_context_window_backup.json | Backup file kept in sync with main model prices JSON. Same regional entries added. |
| tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py | Adds tests for Opus 4.6 dotted alias and Sonnet 4.6 adaptive thinking. All mock-only tests, no network calls. |
| tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py | Extends structured output and effort validation tests to cover Sonnet 4.6. Adds test for reasoning_effort adaptive mapping for Sonnet 4.6. All tests are properly mocked. |
| tests/test_litellm/test_claude_opus_4_6_config.py | Updates region validation test to expect jp. and apac. entries in addition to existing au. alias. Adds Sonnet 4.6 regional registration assertions. |
Flowchart
flowchart TD
A[incoming model string] --> B{_is_claude_opus_4_6?}
A --> C{_is_claude_sonnet_4_6?}
B -->|Yes| D[adaptive thinking]
C -->|Yes| D
B -->|No| E{other reasoning model?}
C -->|No| E
E -->|Yes| F[budget-based thinking]
E -->|No| G[no thinking param]
A --> H{response_format check}
H -->|model matches 4.5/4.6 set| I[native output_format]
H -->|other model| J[tool-based workaround]
A --> K{output_config.effort == max?}
K -->|Yes| B2{_is_claude_opus_4_6?}
B2 -->|Yes| L[allow max effort]
B2 -->|No| M[raise ValueError]
K -->|No| N[allow effort value]
Last reviewed commit: 0bfd2b0
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0bfd2b0b44
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| AnthropicConfig._is_claude_opus_4_6(model) | ||
| or AnthropicConfig._is_claude_sonnet_4_6(model) |
There was a problem hiding this comment.
Allow reasoning_effort for dotted Claude 4.6 aliases
This adds dotted alias handling to _map_reasoning_effort, but the normal completion flow validates params against get_supported_openai_params() before this mapping runs, and that list only includes reasoning_effort when supports_reasoning(model) is true. Because the Anthropic model map does not include claude-opus-4.6* / claude-sonnet-4.6* keys, those aliases still fail support detection and reasoning_effort is rejected as unsupported in utils._check_valid_arg, so the new dotted-alias reasoning mapping is unreachable in production requests.
Useful? React with 👍 / 👎.
0bfd2b0 to
f45ed3e
Compare
Align Claude Sonnet 4.6 and Opus 4.6 support with official Anthropic and Bedrock model behavior while preserving existing caller compatibility. Update Anthropic transformation logic to recognize Sonnet 4.6 and dotted Opus 4.6 aliases in reasoning and structured output handling. Keep effort=max restricted to Opus 4.6 only. Align Bedrock regional mappings to include canonical regional IDs and keep legacy aliases to avoid breaking existing integrations: - Opus 4.6: keep jp/apac canonical coverage and preserve au alias - Sonnet 4.6: keep jp canonical and preserve apac alias Keep test changes minimal by extending existing Claude 4.6 config tests with only required assertions for new aliases and regional parity.
f45ed3e to
c088c58
Compare
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unitmake test-unitrun hit a locallitellm_enterpriseeditable-install mismatch (not related to this PR's changes). Focused validation tests passed:123 passed.@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🐛 Bug Fix
✅ Test
Changes
sonnet-4-6,sonnet_4_6,sonnet-4.6)opus-4.6)reasoning_effortto adaptive thinking for Sonnet 4.6 (matching Opus 4.6 behavior)output_config.effort=maxrestricted to Opus 4.6jpandapac, and keepaualias for compatibilityjpand keepapacalias for compatibilitymodel_prices_and_context_window.jsonlitellm/model_prices_and_context_window_backup.jsontests/litellm/llms/anthropic/test_anthropic_reasoning_effort.pytests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.pytests/test_litellm/test_claude_opus_4_6_config.pyValidation run
Executed:
Result: