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
Add beta headers for claude skills
Sameer Kankutebcfc77f68307
diff --git a/litellm/llms/anthropic/common_utils.py b/litellm/llms/anthropic/common_utils.pyindex 7ca3c555542..098694f15ae 100644--- a/litellm/llms/anthropic/common_utils.py+++ b/litellm/llms/anthropic/common_utils.py@@ -186,6 +186,37 @@ class AnthropicModelInfo(BaseLLMModelInfo):return False+ def is_code_execution_tool_used(self, tools: Optional[List]) -> bool:+ """+ Check if code execution tool is being used.++ Returns True if any tool has type "code_execution_20250825".+ """+ if not tools:+ return False++ for tool in tools:+ tool_type = tool.get("type", "")+ if tool_type == "code_execution_20250825":+ return True+ return False++ def is_container_with_skills_used(self, optional_params: Optional[dict]) -> bool:+ """+ Check if container with skills is being used.++ Returns True if optional_params contains container with skills.+ """+ if not optional_params:+ return False++ container = optional_params.get("container")+ if container and isinstance(container, dict):+ skills = container.get("skills")+ if skills and isinstance(skills, list) and len(skills) > 0:+ return True+ return False+def _get_user_anthropic_beta_headers(self, anthropic_beta_header: Optional[str]) -> Optional[List[str]]:@@ -270,6 +301,8 @@ class AnthropicModelInfo(BaseLLMModelInfo):effort_used: bool = False,is_vertex_request: bool = False,user_anthropic_beta_headers: Optional[List[str]] = None,+ code_execution_tool_used: bool = False,+ container_with_skills_used: bool = False,) -> dict:betas = set()if prompt_caching_set:@@ -293,6 +326,14 @@ class AnthropicModelInfo(BaseLLMModelInfo):if effort_used:from litellm.types.llms.anthropic import ANTHROPIC_EFFORT_BETA_HEADERbetas.add(ANTHROPIC_EFFORT_BETA_HEADER)++ # Code execution tool uses a separate beta header+ if code_execution_tool_used:+ betas.add("code-execution-2025-08-25")++ # Container with skills uses a separate beta header+ if container_with_skills_used:+ betas.add("skills-2025-10-02")headers = {"anthropic-version": anthropic_version or "2023-06-01",@@ -345,6 +386,8 @@ class AnthropicModelInfo(BaseLLMModelInfo):programmatic_tool_calling_used = self.is_programmatic_tool_calling_used(tools=tools)input_examples_used = self.is_input_examples_used(tools=tools)effort_used = self.is_effort_used(optional_params=optional_params, model=model)+ code_execution_tool_used = self.is_code_execution_tool_used(tools=tools)+ container_with_skills_used = self.is_container_with_skills_used(optional_params=optional_params)user_anthropic_beta_headers = self._get_user_anthropic_beta_headers(anthropic_beta_header=headers.get("anthropic-beta"))@@ -362,6 +405,8 @@ class AnthropicModelInfo(BaseLLMModelInfo):programmatic_tool_calling_used=programmatic_tool_calling_used,input_examples_used=input_examples_used,effort_used=effort_used,+ code_execution_tool_used=code_execution_tool_used,+ container_with_skills_used=container_with_skills_used,)headers = {**headers, **anthropic_headers}