Skip to content

Align Claude 4.6 alias and mapping behavior#21487

Open
PeterDaveHello wants to merge 1 commit intoBerriAI:mainfrom
PeterDaveHelloKitchen:fix/claude-4-6-bedrock-aliases
Open

Align Claude 4.6 alias and mapping behavior#21487
PeterDaveHello wants to merge 1 commit intoBerriAI:mainfrom
PeterDaveHelloKitchen:fix/claude-4-6-bedrock-aliases

Conversation

@PeterDaveHello
Copy link
Copy Markdown
Contributor

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](https://docs.litellm.ai/docs/extras/
    contributing_code)
  • My PR passes all unit tests on make test-unit
    • ran focused validation tests for this PR scope (see Validation run below).
  • 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

🐛 Bug Fix
✅ Test

Changes

  • Align Claude 4.6 alias handling and metadata coverage across Anthropic + Bedrock:
    • litellm/constants.py
    • litellm/model_prices_and_context_window_backup.json
    • model_prices_and_context_window.json
    • litellm/llms/anthropic/chat/transformation.py
  • Add/align Bedrock Converse alias mappings for Claude 4.6 model IDs:
    • Opus 4.6 aliases including :0, and regional aliases (global/us/eu/jp/apac/au)
    • Sonnet 4.6 aliases including :0, and regional aliases (global/us/eu/jp/apac/au)
  • Ensure get_model_info(..., custom_llm_provider="bedrock_converse") resolves correctly for registered Claude 4.6 aliases.
  • Keep Anthropic Claude 4.6 transformation behavior consistent for:
    • alias recognition (including dotted aliases where applicable)
    • reasoning effort mapping behavior
    • structured output model matching behavior
  • Update focused tests:
    • tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py
    • tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py
    • tests/test_litellm/test_claude_opus_4_6_config.py

Validation run

Executed:

poetry run pytest tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py tests/test_litellm/test_claude_opus_4_6_config.py -q

Result:

127 passed, 1 warning

@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 19, 2026 7:50pm

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 18, 2026

Greptile Summary

This PR aligns Claude 4.6 alias handling across the Anthropic and Bedrock providers. Key changes:

  • Splits _is_claude_opus_4_6 into separate Opus and Sonnet 4.6 helpers in transformation.py, fixing the previous method's inaccurate docstring (it claimed to check for "Opus 4.5 or Sonnet 4.6") and enabling independent model identification.
  • Adds Bedrock Converse regional aliases (global/us/eu/jp/apac/au) and versioned :0 entries for both Opus 4.6 and Sonnet 4.6 in constants.py and both pricing JSON files.
  • Ensures Sonnet 4.6 gets adaptive reasoning and native structured output support, matching Opus 4.6 behavior, while correctly restricting effort='max' to Opus 4.6 only.
  • Adds "opus_4_6" to the structured output substring set for response format routing, though "opus_4.6" (underscore-dot) is still missing while "sonnet_4.6" is present — a minor inconsistency.
  • Tests are comprehensive mock-only unit tests covering dotted aliases, reasoning effort mapping, effort validation, and Bedrock registration/pricing consistency.

Confidence Score: 4/5

  • This PR is safe to merge — it adds model aliases and aligns existing behavior with minor inconsistency in one substring set.
  • The changes are additive (new aliases, new model entries, new tests) with no removal of existing functionality. The logic changes correctly separate Opus and Sonnet 4.6 detection. One minor inconsistency exists (missing opus_4.6 in the structured output set), but it's low-risk since the Anthropic code path doesn't typically receive underscore-dot model names. Tests are thorough and mock-only.
  • Pay attention to litellm/llms/anthropic/chat/transformation.py — the structured output substring set at line 896-912 has a minor inconsistency where "opus_4.6" is missing while "sonnet_4.6" is present.

Important Files Changed

Filename Overview
litellm/llms/anthropic/chat/transformation.py Splits _is_claude_opus_4_6 into separate Opus/Sonnet 4.6 helpers and updates reasoning/structured-output paths. Minor inconsistency: "opus_4.6" variant missing from the structured output substring set while "sonnet_4.6" is present.
litellm/constants.py Adds regional aliases (global/us/eu/jp/apac/au) for Claude Opus 4.6 and Sonnet 4.6 to BEDROCK_CONVERSE_MODELS, plus versioned :0 entries. Consistent with existing patterns for other models.
litellm/model_prices_and_context_window_backup.json Adds pricing/capability metadata for new Claude 4.6 Bedrock aliases (opus :0, jp, apac; sonnet v1:0, v1, jp, au). Entries are consistent with existing regional pricing patterns (10% markup for non-US regions).
model_prices_and_context_window.json Identical changes to the backup JSON. Adds pricing/capability metadata for new Claude 4.6 Bedrock regional and versioned aliases. Both JSON files remain synchronized.
tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py Adds tests for Opus 4.6 dotted alias, Sonnet 4.6 reasoning effort mapping (adaptive type), and param support verification. All mock-only, no network calls.
tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py Extends structured output, effort validation, and reasoning effort tests to cover Sonnet 4.6 and dotted alias variants. Validates max effort is rejected for Sonnet 4.6 but accepted for Opus 4.6.
tests/test_litellm/test_claude_opus_4_6_config.py Extends Bedrock registration tests to verify jp/apac/au aliases for Opus and Sonnet 4.6. Adds Sonnet 4.6 Australia region mapping test and alias cost mapping consistency checks.

Flowchart

flowchart TD
    A[Model string received] --> B{_is_claude_opus_4_6?}
    B -->|Yes| C[Adaptive reasoning]
    B -->|No| D{_is_claude_sonnet_4_6?}
    D -->|Yes| C
    D -->|No| E{supports_reasoning?}
    E -->|Yes| F[Budget-based reasoning]
    E -->|No| G[No reasoning params]

    C --> H{effort == max?}
    H -->|Yes, Opus 4.6| I[Allow max effort]
    H -->|Yes, Sonnet 4.6| J[Raise ValueError]
    H -->|No| K[Pass effort through]

    A --> L{response_format?}
    L --> M{Model in structured output set?}
    M -->|Yes: opus-4.6, sonnet-4.6, opus_4_6, etc.| N[Native output_format]
    M -->|No| O[Tool-based workaround]
Loading

Last reviewed commit: ae1d36e

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.

7 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Add missing Bedrock Converse aliases for Claude Sonnet 4.6 and
regional variants, and keep corresponding model-price entries in
sync across both price maps.

Refine Anthropic Claude 4.6 handling to keep structured-output alias
coverage while avoiding redundant reasoning capability checks.

Preserve output_config.effort=max as Opus 4.6 only, keep adaptive
reasoning mapping for Sonnet 4.6 aliases, and remove the non-canonical
Opus v1:0 model-cost alias per review feedback.

Update focused Anthropic and Claude 4.6 config tests to match the
final behavior.
@PeterDaveHello PeterDaveHello force-pushed the fix/claude-4-6-bedrock-aliases branch from ec161cc to b4fedc2 Compare February 19, 2026 19:48
@PeterDaveHello
Copy link
Copy Markdown
Contributor Author

@Sameerlite PR updated, thanks!

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