From 6e9a44287d9dc6aa53bf1419ac87bf6df74135fa Mon Sep 17 00:00:00 2001 From: OpenClaw Agent Date: Fri, 13 Mar 2026 20:34:34 +0800 Subject: [PATCH] fix: handle reasoning_effort='none' for Claude 4.6 models and add xhigh support - Add 'none' to effort_map for Claude 4.6 models (don't set output_config) - Add 'xhigh' to _map_reasoning_effort (maps to same as high) - Fixes infinite retry loop when reasoning_effort='none' with fallbacks --- litellm/llms/anthropic/chat/transformation.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index 1b912bfc2a0..b357b6c719d 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -764,6 +764,12 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): type="enabled", budget_tokens=DEFAULT_REASONING_EFFORT_MINIMAL_THINKING_BUDGET, ) + elif reasoning_effort == "xhigh": + # xhigh maps to same as high for Anthropic (max available) + return AnthropicThinkingParam( + type="enabled", + budget_tokens=DEFAULT_REASONING_EFFORT_HIGH_THINKING_BUDGET, + ) else: raise ValueError(f"Unmapped reasoning effort: {reasoning_effort}") @@ -1034,6 +1040,7 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): # not thinking budget_tokens. Map reasoning_effort to output_config. if AnthropicConfig._is_claude_4_6_model(model): effort_map = { + "none": None, # Don't set output_config for "none" "low": "low", "minimal": "low", "medium": "medium", @@ -1041,7 +1048,8 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig): "max": "max", } mapped_effort = effort_map.get(value, value) - optional_params["output_config"] = {"effort": mapped_effort} + if mapped_effort is not None: + optional_params["output_config"] = {"effort": mapped_effort} elif param == "web_search_options" and isinstance(value, dict): hosted_web_search_tool = self.map_web_search_tool( cast(OpenAIWebSearchOptions, value)