The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(anthropic): drive output_config.effort support from model map flags
mateo-berri36f1f1392535
diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.pyindex da435f8816c..21edf01f829 100644--- a/litellm/llms/anthropic/chat/transformation.py+++ b/litellm/llms/anthropic/chat/transformation.py@@ -4,7 +4,6 @@ import timefrom typing import (TYPE_CHECKING,Any,- ClassVar,Dict,List,Optional,@@ -274,47 +273,17 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):passreturn False- # Per https://platform.claude.com/docs/en/build-with-claude/effort the- # ``output_config.effort`` parameter is supported on Opus 4.5+, Sonnet 4.6+- # and Mythos Preview. Older Claude models (haiku-3, sonnet-3.5, opus-3,- # sonnet-4, ...) reject it with a 400. The patterns below let us recognize- # the supporting families regardless of route prefix (``anthropic.``,- # ``us.anthropic.``, ``vertex_ai/``, ``azure_ai/``, ...).- _EFFORT_SUPPORTING_MODEL_PATTERNS: ClassVar[Tuple[str, ...]] = (- "opus-4-5",- "opus_4_5",- "opus-4.5",- "opus_4.5",- "opus-4-6",- "opus_4_6",- "opus-4.6",- "opus_4.6",- "opus-4-7",- "opus_4_7",- "opus-4.7",- "opus_4.7",- "sonnet-4-6",- "sonnet_4_6",- "sonnet-4.6",- "sonnet_4.6",- "mythos",- )-@staticmethoddef _model_supports_effort_param(model: str) -> bool:"""Whether the model accepts ``output_config.effort`` at all.- Used to decide whether to strip ``output_config`` for known-incompatible- models when ``drop_params`` is set. New models that land in- ``model_prices_and_context_window.json`` with a ``supports_*_reasoning_effort``- flag are auto-recognized; otherwise we fall back to the documented- family patterns above.+ Per https://platform.claude.com/docs/en/build-with-claude/effort the+ ``output_config.effort`` parameter is supported on Opus 4.5+, Sonnet 4.6++ and Mythos Preview; older Claude models reject it with a 400. Support is+ encoded in ``model_prices_and_context_window.json`` via the+ ``supports_*_reasoning_effort`` flags, so adding a new effort-capable+ model is a pure model-map change."""- model_lower = model.lower()- if any(- p in model_lower for p in AnthropicConfig._EFFORT_SUPPORTING_MODEL_PATTERNS- ):- return Truefor level in ("low", "minimal", "medium", "high", "xhigh", "max"):if AnthropicConfig._supports_effort_level(model, level):return Truediff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex b49d97dc4e3..392fafcfc2c 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -977,12 +977,28 @@"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_response_schema": true,"supports_tool_choice": true,"supports_vision": true,"tool_use_system_prompt_tokens": 159,"supports_native_structured_output": true},+ "anthropic.claude-mythos-preview": {+ "input_cost_per_token": 0,+ "output_cost_per_token": 0,+ "litellm_provider": "bedrock",+ "max_input_tokens": 1000000,+ "max_output_tokens": 128000,+ "max_tokens": 128000,+ "mode": "chat",+ "supports_function_calling": true,+ "supports_vision": true,+ "supports_prompt_caching": false,+ "supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,+ "supports_tool_choice": true+ },"anthropic.claude-opus-4-6-v1": {"cache_creation_input_token_cost": 6.25e-06,"cache_creation_input_token_cost_above_1hr": 1e-05,@@ -1915,6 +1931,7 @@"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_response_schema": true,"supports_tool_choice": true,"supports_vision": true@@ -9347,6 +9364,7 @@"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_response_schema": true,"supports_tool_choice": true,"supports_vision": true,@@ -9374,6 +9392,7 @@"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_response_schema": true,"supports_tool_choice": true,"supports_vision": true,@@ -10790,6 +10809,7 @@"supports_assistant_prefill": true,"supports_function_calling": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_tool_choice": true},"databricks/databricks-claude-sonnet-4": {@@ -17150,7 +17170,8 @@],"supports_function_calling": true,"supports_parallel_function_calling": true,- "supports_vision": true+ "supports_vision": true,+ "supports_minimal_reasoning_effort": true},"github_copilot/claude-opus-4.6-fast": {"litellm_provider": "github_copilot",@@ -17663,7 +17684,8 @@"mode": "chat","output_cost_per_token": 2.5e-05,"supports_function_calling": true,- "supports_vision": true+ "supports_vision": true,+ "supports_minimal_reasoning_effort": true},"gmi/anthropic/claude-sonnet-4.5": {"input_cost_per_token": 3e-06,@@ -26105,6 +26127,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_prompt_caching": true,"supports_reasoning": true,"supports_tool_choice": true,@@ -28026,7 +28049,8 @@"mode": "responses","supports_web_search": true,"supports_reasoning": false,- "supports_function_calling": true+ "supports_function_calling": true,+ "supports_minimal_reasoning_effort": true},"perplexity/anthropic/claude-sonnet-4-5": {"litellm_provider": "perplexity",@@ -30503,6 +30527,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -30531,6 +30556,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -30558,6 +30584,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -31138,6 +31165,7 @@"output_cost_per_token": 2.5e-05,"supports_assistant_prefill": true,"supports_computer_use": true,+ "supports_minimal_reasoning_effort": true,"supports_function_calling": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -32330,6 +32358,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -32356,6 +32385,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex cc34446be04..03b13d743f6 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -977,6 +977,7 @@"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_response_schema": true,"supports_tool_choice": true,"supports_vision": true,@@ -1174,6 +1175,7 @@"supports_vision": true,"supports_prompt_caching": false,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_tool_choice": true},"global.anthropic.claude-opus-4-7": {@@ -1929,6 +1931,7 @@"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_response_schema": true,"supports_tool_choice": true,"supports_vision": true@@ -9361,6 +9364,7 @@"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_response_schema": true,"supports_tool_choice": true,"supports_vision": true,@@ -9388,6 +9392,7 @@"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_response_schema": true,"supports_tool_choice": true,"supports_vision": true,@@ -10802,6 +10807,7 @@"supports_assistant_prefill": true,"supports_function_calling": true,"supports_reasoning": true,+ "supports_minimal_reasoning_effort": true,"supports_tool_choice": true},"databricks/databricks-claude-sonnet-4": {@@ -17162,7 +17168,8 @@],"supports_function_calling": true,"supports_parallel_function_calling": true,- "supports_vision": true+ "supports_vision": true,+ "supports_minimal_reasoning_effort": true},"github_copilot/claude-opus-4.6-fast": {"litellm_provider": "github_copilot",@@ -17675,7 +17682,8 @@"mode": "chat","output_cost_per_token": 2.5e-05,"supports_function_calling": true,- "supports_vision": true+ "supports_vision": true,+ "supports_minimal_reasoning_effort": true},"gmi/anthropic/claude-sonnet-4.5": {"input_cost_per_token": 3e-06,@@ -26111,6 +26119,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_prompt_caching": true,"supports_reasoning": true,"supports_tool_choice": true,@@ -28076,7 +28085,8 @@"mode": "responses","supports_web_search": true,"supports_reasoning": false,- "supports_function_calling": true+ "supports_function_calling": true,+ "supports_minimal_reasoning_effort": true},"perplexity/anthropic/claude-sonnet-4-5": {"litellm_provider": "perplexity",@@ -30555,6 +30565,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -30583,6 +30594,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -30610,6 +30622,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -31190,6 +31203,7 @@"output_cost_per_token": 2.5e-05,"supports_assistant_prefill": true,"supports_computer_use": true,+ "supports_minimal_reasoning_effort": true,"supports_function_calling": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -32382,6 +32396,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,@@ -32408,6 +32423,7 @@"supports_assistant_prefill": true,"supports_computer_use": true,"supports_function_calling": true,+ "supports_minimal_reasoning_effort": true,"supports_pdf_input": true,"supports_prompt_caching": true,"supports_reasoning": true,diff --git a/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py b/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.pyindex eb40e76cc12..c496df429e8 100644--- a/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py+++ b/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py@@ -1826,7 +1826,8 @@ def test_anthropic_drop_params_false_forwards_to_unsupported_model():"claude-opus-4-6","claude-opus-4-7","claude-sonnet-4-6",- "claude-mythos-preview",+ "anthropic.claude-mythos-preview",+ "bedrock/anthropic.claude-mythos-preview",],)def test_anthropic_model_supports_effort_param_recognizes_supporting_models(model):