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): pass resolved provider to adaptive-thinking check

Abhimanyu Kapurb58ccb092ea6
diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py
index 83054f61ec9..1f5b76f3d0a 100644
--- a/litellm/llms/anthropic/chat/transformation.py
+++ b/litellm/llms/anthropic/chat/transformation.py
@@ -1487,7 +1487,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
if (
isinstance(value, dict)
and value.get("type") == "adaptive"
- and not AnthropicConfig._is_adaptive_thinking_model(model)
+ and not AnthropicConfig._is_adaptive_thinking_model(model, self._resolved_provider)
):
# Callers (e.g. Claude Code) send adaptive thinking
# unconditionally; translate it down to the legacy
@@ -1498,8 +1498,8 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
legacy_thinking = AnthropicConfig._map_reasoning_effort(
reasoning_effort="medium",
model=model,
- custom_llm_provider=self.custom_llm_provider or "anthropic",
- llm_provider=self.custom_llm_provider or "anthropic",
+ custom_llm_provider=self._resolved_provider,
+ llm_provider=self._resolved_provider,
)
capped_thinking = (
AnthropicConfig._cap_thinking_budget_to_max_tokens(legacy_thinking, max_tokens)