Skip to content

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]

fix(anthropic/chat/transformation.py): pass output_config + thinking to claude opus 4.5

Krrish Dholakiac276a87ab007
diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py
index b477dbd457e..7b3e8065447 100644
--- a/litellm/llms/anthropic/chat/transformation.py
+++ b/litellm/llms/anthropic/chat/transformation.py
@@ -762,11 +762,11 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
# For Claude Opus 4.5, map reasoning_effort to output_config
if self._is_claude_opus_4_5(model):
optional_params["output_config"] = {"effort": value}
- else:
- # For other models, map to thinking parameter
- optional_params["thinking"] = AnthropicConfig._map_reasoning_effort(
- value
- )
+
+ # For other models, map to thinking parameter
+ optional_params["thinking"] = AnthropicConfig._map_reasoning_effort(
+ value
+ )
elif param == "web_search_options" and isinstance(value, dict):
hosted_web_search_tool = self.map_web_search_tool(
cast(OpenAIWebSearchOptions, value)
diff --git a/tests/llm_translation/test_anthropic_completion.py b/tests/llm_translation/test_anthropic_completion.py
index 7c849650bf6..e1fd2bf5434 100644
--- a/tests/llm_translation/test_anthropic_completion.py
+++ b/tests/llm_translation/test_anthropic_completion.py
@@ -1801,3 +1801,14 @@ def test_anthropic_structured_output_chat_completion_api():
)
assert response is not None
print(f"response: {response}")
+
+
+def test_anthropic_reasoning_effort():
+ response = litellm.completion(
+ model="claude-opus-4-5-20251101",
+ messages=[{"role": "user", "content": "What is the capital of France?"}],
+ reasoning_effort="high",
+ litellm_request_debug=True,
+ )
+ assert response is not None
+ print(f"response: {response}")