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 add leagcy support for claude code
Sameer Kankutea9ff4c699197
diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.pyindex 46af1f7fbd1..7617ad52ab1 100644--- a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py+++ b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py@@ -166,6 +166,36 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig):return headers, api_base+ @staticmethod+ def _translate_legacy_thinking_for_adaptive_model(+ model: str, optional_params: Dict+ ) -> None:+ """Translate legacy ``thinking.type=enabled`` to adaptive for 4.6/4.7.+ Caller-provided ``output_config.effort`` is never overridden.+ """+ if not AnthropicModelInfo._is_adaptive_thinking_model(model):+ return+ thinking = optional_params.get("thinking")+ if not isinstance(thinking, dict) or thinking.get("type") != "enabled":+ return++ budget = int(thinking.get("budget_tokens") or 0)+ if budget >= 24000:+ effort = "xhigh"+ elif budget >= 10000:+ effort = "high"+ elif budget >= 5000:+ effort = "medium"+ else:+ effort = "low"++ optional_params["thinking"] = {"type": "adaptive"}+ existing_output_config = optional_params.get("output_config")+ if not isinstance(existing_output_config, dict):+ existing_output_config = {}+ existing_output_config.setdefault("effort", effort)+ optional_params["output_config"] = existing_output_config+def transform_anthropic_messages_request(self,model: str,@@ -187,6 +217,11 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig):status_code=400,)+ self._translate_legacy_thinking_for_adaptive_model(+ model=model,+ optional_params=anthropic_messages_optional_request_params,+ )+# Filter out x-anthropic-billing-header from system messagessystem_param = anthropic_messages_optional_request_params.get("system")if system_param is not None: