From b58ccb092ea6d2cc4ca988dec795debd919db22c Mon Sep 17 00:00:00 2001 From: Abhimanyu Kapur <38531241+akapur99@users.noreply.github.com> Date: Sat, 11 Jul 2026 14:48:14 -0700 Subject: [PATCH] fix(anthropic): pass resolved provider to adaptive-thinking check The rebase onto staging changed _is_adaptive_thinking_model to require custom_llm_provider (no default), so the one-arg call in the raw adaptive thinking branch raised TypeError at runtime for any /chat/completions caller sending thinking={type: adaptive}. Use self._resolved_provider, matching the reasoning_effort branch just below. Caught by Greptile. --- litellm/llms/anthropic/chat/transformation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)