Skip to content

[Feat]Add day 0 claude sonnet 4.6 feat support#21448

Merged
Sameerlite merged 6 commits intomainfrom
litellm_sonnet_4_6_feat
Feb 18, 2026
Merged

[Feat]Add day 0 claude sonnet 4.6 feat support#21448
Sameerlite merged 6 commits intomainfrom
litellm_sonnet_4_6_feat

Conversation

@Sameerlite
Copy link
Copy Markdown
Contributor

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • 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

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 18, 2026 1:13pm

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 18, 2026

Greptile Summary

This 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, output_format response schema, tool search, effort='max') to also cover Sonnet 4.6. A new us/claude-sonnet-4-6 pricing entry with US geo markup is added.

  • Sonnet 4.6 model patterns added to _is_claude_opus_4_6, response_format check, and Bedrock's _supports_tool_search_on_bedrock
  • Bedrock beta header logic refactored to use _supports_tool_search_on_bedrock instead of inline opus-4 check
  • us/claude-sonnet-4-6 pricing entry added with inference_geo: "us" field (first entry to use this field)
  • No tests were added — the PR checklist requires at least 1 test in tests/litellm/, but none are included
  • The _is_claude_opus_4_6 method name is now misleading since it also covers Sonnet 4.6; the error message at line 1295 only mentions Opus 4.6

Confidence Score: 3/5

  • Low-risk additive changes to model support, but missing tests and misleading method naming could cause maintenance issues.
  • The changes are straightforward model pattern additions and a minor refactor. However, the misleading _is_claude_opus_4_6 method name (now covering Sonnet too), an inaccurate error message, and the complete absence of required tests lower confidence. The functional changes are unlikely to break existing behavior but may confuse future contributors.
  • litellm/llms/anthropic/chat/transformation.py needs attention for the misleading method name and error message.

Important Files Changed

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]
Loading

Last reviewed commit: bdba316

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

Comment on lines +174 to +176
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()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
#sonnet 4.6
# Sonnet 4.6

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 18, 2026

Additional Comments (2)

litellm/llms/anthropic/chat/transformation.py
Error message is misleading after Sonnet 4.6 addition

Since _is_claude_opus_4_6 now returns True for Sonnet 4.6 models as well, this error message is inaccurate. When a non-Opus/Sonnet-4.6 model is used with effort='max', the error says it's "only supported by Claude Opus 4.6" — but it's now also supported by Sonnet 4.6. The message should be updated to reflect this.

                if effort == "max" and not self._is_claude_opus_4_6(model):
                    raise ValueError(
                        f"effort='max' is only supported by Claude Opus 4.6 and Claude Sonnet 4.6. Got model: {model}"
                    )

litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py
Docstring doesn't reflect current supported models

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.

    def _supports_tool_search_on_bedrock(self, model: str) -> bool:
        """
        Check if the model supports tool search on Bedrock.

        On Amazon Bedrock, server-side tool search is supported on Claude Opus 4.5+
        and Claude Sonnet 4.5+ with the tool-search-tool-2025-10-19 beta header.

        Ref: https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool

        Args:
            model: The model name

        Returns:
            True if the model supports tool search on Bedrock
        """

@Sameerlite Sameerlite merged commit c369b0f into main Feb 18, 2026
18 of 26 checks passed
@PeterDaveHello
Copy link
Copy Markdown
Contributor

Hi @Sameerlite,
Would you help take a look at: #21487? Thanks!

Sameerlite added a commit that referenced this pull request Feb 20, 2026
[Feat]Add day 0 claude sonnet 4.6 feat support
@ishaan-berri ishaan-berri deleted the litellm_sonnet_4_6_feat branch March 26, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants