[Feat]Add day 0 claude sonnet 4.6 feat support#21448
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds day-0 support for Claude Sonnet 4.6 across Anthropic direct API and Bedrock providers. It extends existing Opus 4.6 feature gates (adaptive thinking,
Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| litellm/llms/anthropic/chat/transformation.py | Adds Sonnet 4.6 to _is_claude_opus_4_6 and response_format checks, but method name is misleading, error messages are inaccurate, and dot-separated variants are missing from the helper. |
| litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py | Adds Sonnet 4.6 patterns to Bedrock tool search support list and refactors beta header logic to use _supports_tool_search_on_bedrock helper. Good refactor but docstring is stale. |
| model_prices_and_context_window.json | Adds us/claude-sonnet-4-6 pricing entry with 10% US geo markup over base pricing. First entry in the file to use the new inference_geo field. |
| litellm/model_prices_and_context_window_backup.json | Mirror of model_prices_and_context_window.json — adds the same us/claude-sonnet-4-6 pricing entry with inference_geo field. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User Request with Sonnet 4.6 model] --> B{Provider?}
B -->|Anthropic Direct| C[AnthropicConfig]
B -->|Bedrock| D[AmazonAnthropicClaudeMessagesConfig]
C --> E{_is_claude_opus_4_6?}
E -->|Yes| F[Adaptive thinking enabled]
E -->|Yes| G[effort='max' allowed]
C --> H{response_format check}
H -->|sonnet-4.6 match| I[Use output_format API]
D --> J{_supports_tool_search_on_bedrock?}
J -->|Yes| K[Add tool-search-tool-2025-10-19 beta]
K --> L[Add tool-examples-2025-10-29 beta]
Last reviewed commit: bdba316
| def _is_claude_opus_4_6(model: str) -> bool: | ||
| """Check if the model is Claude Opus 4.5.""" | ||
| return "opus-4-6" in model.lower() or "opus_4_6" in model.lower() | ||
| """Check if the model is Claude Opus 4.5 or Sonnet 4.6.""" | ||
| return "opus-4-6" in model.lower() or "opus_4_6" in model.lower() or "sonnet-4-6" in model.lower() or "sonnet_4_6" in model.lower() |
There was a problem hiding this comment.
Misleading method name and docstring
The method _is_claude_opus_4_6 now also checks for Sonnet 4.6 models, but the name still says "opus". The docstring was updated to mention "Sonnet 4.6" but still says "Opus 4.5" instead of "Opus 4.6". This causes confusion at all 3 call sites (lines 713, 1293). Consider renaming to something like _is_adaptive_thinking_model or _is_claude_4_6_family to accurately reflect what it checks.
Additionally, the _is_claude_opus_4_6 method is missing the dot-separated variants ("sonnet-4.6", "opus-4.6"). The Bedrock _supports_tool_search_on_bedrock method and the response_format check both include these dot variants, but this method does not. Models like vercel_ai_gateway/anthropic/claude-opus-4.6 in the pricing JSON use dot separators and would not be matched.
| "opus_4.6", | ||
| "opus-4-6", | ||
| "opus_4_6", | ||
| #sonnet 4.6 |
There was a problem hiding this comment.
Missing space in comment
Minor formatting issue — existing comments in this list use # Opus 4.5 format (space after #), but this one uses #sonnet 4.6 without a space and without capitalization.
| #sonnet 4.6 | |
| # Sonnet 4.6 |
Additional Comments (2)
Since
The docstring still says tool search is supported on "Claude Opus 4.5 and Claude Sonnet 4.5" but the code now also supports Opus 4.6 and Sonnet 4.6. The docstring should be updated to match. |
|
Hi @Sameerlite, |
[Feat]Add day 0 claude sonnet 4.6 feat support
Relevant issues
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-unit@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
🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test
Changes