diff --git a/litellm/constants.py b/litellm/constants.py index 17ad742e419..b4742b8f9d2 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -1046,7 +1046,20 @@ "anthropic.claude-sonnet-4-5-20250929-v1:0", "anthropic.claude-opus-4-6-v1:0", "anthropic.claude-opus-4-6-v1", + "global.anthropic.claude-opus-4-6-v1", + "us.anthropic.claude-opus-4-6-v1", + "eu.anthropic.claude-opus-4-6-v1", + "jp.anthropic.claude-opus-4-6-v1", + "apac.anthropic.claude-opus-4-6-v1", + "au.anthropic.claude-opus-4-6-v1", + "anthropic.claude-sonnet-4-6-v1:0", + "anthropic.claude-sonnet-4-6-v1", "anthropic.claude-sonnet-4-6", + "global.anthropic.claude-sonnet-4-6", + "us.anthropic.claude-sonnet-4-6", + "eu.anthropic.claude-sonnet-4-6", + "jp.anthropic.claude-sonnet-4-6", + "apac.anthropic.claude-sonnet-4-6", "anthropic.claude-opus-4-1-20250805-v1:0", "anthropic.claude-opus-4-20250514-v1:0", "anthropic.claude-sonnet-4-20250514-v1:0", diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py index 85a4790a9b9..b86174d4555 100644 --- a/litellm/llms/anthropic/chat/transformation.py +++ b/litellm/llms/anthropic/chat/transformation.py @@ -172,8 +172,23 @@ def convert_tool_use_to_openai_format( @staticmethod def _is_claude_opus_4_6(model: str) -> bool: - """Check if the model is Claude Opus 4.5.""" - return "opus-4-6" in model.lower() or "opus_4_6" in model.lower() + """Check if the model is Claude Opus 4.6.""" + model_lower = model.lower() + return ( + "opus-4-6" in model_lower + or "opus_4_6" in model_lower + or "opus-4.6" in model_lower + ) + + @staticmethod + def _is_claude_sonnet_4_6(model: str) -> bool: + """Check if the model is Claude Sonnet 4.6.""" + model_lower = model.lower() + return ( + "sonnet-4-6" in model_lower + or "sonnet_4_6" in model_lower + or "sonnet-4.6" in model_lower + ) def get_supported_openai_params(self, model: str): params = [ @@ -193,9 +208,14 @@ def get_supported_openai_params(self, model: str): "speed", ] - if "claude-3-7-sonnet" in model or supports_reasoning( - model=model, - custom_llm_provider=self.custom_llm_provider, + if ( + "claude-3-7-sonnet" in model + or self._is_claude_opus_4_6(model) + or self._is_claude_sonnet_4_6(model) + or supports_reasoning( + model=model, + custom_llm_provider=self.custom_llm_provider, + ) ): params.append("thinking") params.append("reasoning_effort") @@ -710,7 +730,10 @@ def _map_reasoning_effort( ) -> Optional[AnthropicThinkingParam]: if reasoning_effort is None or reasoning_effort == "none": return None - if AnthropicConfig._is_claude_opus_4_6(model): + if ( + AnthropicConfig._is_claude_opus_4_6(model) + or AnthropicConfig._is_claude_sonnet_4_6(model) + ): return AnthropicThinkingParam( type="adaptive", ) @@ -875,12 +898,16 @@ def map_openai_params( # noqa: PLR0915 for substring in { "sonnet-4.5", "sonnet-4-5", + "sonnet-4.6", + "sonnet-4-6", + "sonnet_4_6", "opus-4.1", "opus-4-1", "opus-4.5", "opus-4-5", "opus-4.6", "opus-4-6", + "opus_4_6", } ): _output_format = ( diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 9a9acb91986..1ae6fa058f8 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -963,6 +963,36 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 159 }, + "anthropic.claude-opus-4-6-v1:0": { + "cache_creation_input_token_cost": 6.25e-06, + "cache_creation_input_token_cost_above_200k_tokens": 1.25e-05, + "cache_read_input_token_cost": 5e-07, + "cache_read_input_token_cost_above_200k_tokens": 1e-06, + "input_cost_per_token": 5e-06, + "input_cost_per_token_above_200k_tokens": 1e-05, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.5e-05, + "output_cost_per_token_above_200k_tokens": 3.75e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "anthropic.claude-opus-4-6-v1": { "cache_creation_input_token_cost": 6.25e-06, "cache_creation_input_token_cost_above_200k_tokens": 1.25e-05, @@ -1083,6 +1113,66 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "jp.anthropic.claude-opus-4-6-v1": { + "cache_creation_input_token_cost": 6.875e-06, + "cache_creation_input_token_cost_above_200k_tokens": 1.375e-05, + "cache_read_input_token_cost": 5.5e-07, + "cache_read_input_token_cost_above_200k_tokens": 1.1e-06, + "input_cost_per_token": 5.5e-06, + "input_cost_per_token_above_200k_tokens": 1.1e-05, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.75e-05, + "output_cost_per_token_above_200k_tokens": 4.125e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, + "apac.anthropic.claude-opus-4-6-v1": { + "cache_creation_input_token_cost": 6.875e-06, + "cache_creation_input_token_cost_above_200k_tokens": 1.375e-05, + "cache_read_input_token_cost": 5.5e-07, + "cache_read_input_token_cost_above_200k_tokens": 1.1e-06, + "input_cost_per_token": 5.5e-06, + "input_cost_per_token_above_200k_tokens": 1.1e-05, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.75e-05, + "output_cost_per_token_above_200k_tokens": 4.125e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "au.anthropic.claude-opus-4-6-v1": { "cache_creation_input_token_cost": 6.875e-06, "cache_creation_input_token_cost_above_200k_tokens": 1.375e-05, @@ -1113,6 +1203,66 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "anthropic.claude-sonnet-4-6-v1:0": { + "cache_creation_input_token_cost": 3.75e-06, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost": 3e-07, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, + "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, + "anthropic.claude-sonnet-4-6-v1": { + "cache_creation_input_token_cost": 3.75e-06, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost": 3e-07, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, + "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "anthropic.claude-sonnet-4-6": { "cache_creation_input_token_cost": 3.75e-06, "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, @@ -1233,6 +1383,36 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "jp.anthropic.claude-sonnet-4-6": { + "cache_creation_input_token_cost": 4.125e-06, + "cache_creation_input_token_cost_above_200k_tokens": 8.25e-06, + "cache_read_input_token_cost": 3.3e-07, + "cache_read_input_token_cost_above_200k_tokens": 6.6e-07, + "input_cost_per_token": 3.3e-06, + "input_cost_per_token_above_200k_tokens": 6.6e-06, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 1.65e-05, + "output_cost_per_token_above_200k_tokens": 2.475e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "apac.anthropic.claude-sonnet-4-6": { "cache_creation_input_token_cost": 4.125e-06, "cache_creation_input_token_cost_above_200k_tokens": 8.25e-06, @@ -8294,6 +8474,36 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "claude-sonnet-4.6": { + "cache_creation_input_token_cost": 3.75e-06, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost": 3e-07, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, + "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "litellm_provider": "anthropic", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "claude-sonnet-4-5-20250929-v1:0": { "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, @@ -8611,6 +8821,37 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "claude-opus-4.6-20260205": { + "cache_creation_input_token_cost": 6.25e-06, + "cache_creation_input_token_cost_above_200k_tokens": 1.25e-05, + "cache_creation_input_token_cost_above_1hr": 1e-05, + "cache_read_input_token_cost": 5e-07, + "cache_read_input_token_cost_above_200k_tokens": 1e-06, + "input_cost_per_token": 5e-06, + "input_cost_per_token_above_200k_tokens": 1e-05, + "litellm_provider": "anthropic", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.5e-05, + "output_cost_per_token_above_200k_tokens": 3.75e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "fast/claude-opus-4-6-20260205": { "cache_creation_input_token_cost": 6.25e-06, "cache_creation_input_token_cost_above_200k_tokens": 1.25e-05, @@ -37271,4 +37512,4 @@ "search_context_size_medium": 0.01 } } -} \ No newline at end of file +} diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 471d4b9ab7a..ef7545800e4 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -963,6 +963,36 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 159 }, + "anthropic.claude-opus-4-6-v1:0": { + "cache_creation_input_token_cost": 6.25e-06, + "cache_creation_input_token_cost_above_200k_tokens": 1.25e-05, + "cache_read_input_token_cost": 5e-07, + "cache_read_input_token_cost_above_200k_tokens": 1e-06, + "input_cost_per_token": 5e-06, + "input_cost_per_token_above_200k_tokens": 1e-05, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.5e-05, + "output_cost_per_token_above_200k_tokens": 3.75e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "anthropic.claude-opus-4-6-v1": { "cache_creation_input_token_cost": 6.25e-06, "cache_creation_input_token_cost_above_200k_tokens": 1.25e-05, @@ -1083,6 +1113,66 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "jp.anthropic.claude-opus-4-6-v1": { + "cache_creation_input_token_cost": 6.875e-06, + "cache_creation_input_token_cost_above_200k_tokens": 1.375e-05, + "cache_read_input_token_cost": 5.5e-07, + "cache_read_input_token_cost_above_200k_tokens": 1.1e-06, + "input_cost_per_token": 5.5e-06, + "input_cost_per_token_above_200k_tokens": 1.1e-05, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.75e-05, + "output_cost_per_token_above_200k_tokens": 4.125e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, + "apac.anthropic.claude-opus-4-6-v1": { + "cache_creation_input_token_cost": 6.875e-06, + "cache_creation_input_token_cost_above_200k_tokens": 1.375e-05, + "cache_read_input_token_cost": 5.5e-07, + "cache_read_input_token_cost_above_200k_tokens": 1.1e-06, + "input_cost_per_token": 5.5e-06, + "input_cost_per_token_above_200k_tokens": 1.1e-05, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.75e-05, + "output_cost_per_token_above_200k_tokens": 4.125e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "au.anthropic.claude-opus-4-6-v1": { "cache_creation_input_token_cost": 6.875e-06, "cache_creation_input_token_cost_above_200k_tokens": 1.375e-05, @@ -1113,6 +1203,66 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "anthropic.claude-sonnet-4-6-v1:0": { + "cache_creation_input_token_cost": 3.75e-06, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost": 3e-07, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, + "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, + "anthropic.claude-sonnet-4-6-v1": { + "cache_creation_input_token_cost": 3.75e-06, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost": 3e-07, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, + "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "anthropic.claude-sonnet-4-6": { "cache_creation_input_token_cost": 3.75e-06, "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, @@ -1233,6 +1383,36 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "jp.anthropic.claude-sonnet-4-6": { + "cache_creation_input_token_cost": 4.125e-06, + "cache_creation_input_token_cost_above_200k_tokens": 8.25e-06, + "cache_read_input_token_cost": 3.3e-07, + "cache_read_input_token_cost_above_200k_tokens": 6.6e-07, + "input_cost_per_token": 3.3e-06, + "input_cost_per_token_above_200k_tokens": 6.6e-06, + "litellm_provider": "bedrock_converse", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 1.65e-05, + "output_cost_per_token_above_200k_tokens": 2.475e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "apac.anthropic.claude-sonnet-4-6": { "cache_creation_input_token_cost": 4.125e-06, "cache_creation_input_token_cost_above_200k_tokens": 8.25e-06, @@ -8294,6 +8474,36 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "claude-sonnet-4.6": { + "cache_creation_input_token_cost": 3.75e-06, + "cache_creation_input_token_cost_above_200k_tokens": 7.5e-06, + "cache_read_input_token_cost": 3e-07, + "cache_read_input_token_cost_above_200k_tokens": 6e-07, + "input_cost_per_token": 3e-06, + "input_cost_per_token_above_200k_tokens": 6e-06, + "litellm_provider": "anthropic", + "max_input_tokens": 200000, + "max_output_tokens": 64000, + "max_tokens": 64000, + "mode": "chat", + "output_cost_per_token": 1.5e-05, + "output_cost_per_token_above_200k_tokens": 2.25e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": true, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "claude-sonnet-4-5-20250929-v1:0": { "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, @@ -8611,6 +8821,37 @@ "supports_vision": true, "tool_use_system_prompt_tokens": 346 }, + "claude-opus-4.6-20260205": { + "cache_creation_input_token_cost": 6.25e-06, + "cache_creation_input_token_cost_above_200k_tokens": 1.25e-05, + "cache_creation_input_token_cost_above_1hr": 1e-05, + "cache_read_input_token_cost": 5e-07, + "cache_read_input_token_cost_above_200k_tokens": 1e-06, + "input_cost_per_token": 5e-06, + "input_cost_per_token_above_200k_tokens": 1e-05, + "litellm_provider": "anthropic", + "max_input_tokens": 1000000, + "max_output_tokens": 128000, + "max_tokens": 128000, + "mode": "chat", + "output_cost_per_token": 2.5e-05, + "output_cost_per_token_above_200k_tokens": 3.75e-05, + "search_context_cost_per_query": { + "search_context_size_high": 0.01, + "search_context_size_low": 0.01, + "search_context_size_medium": 0.01 + }, + "supports_assistant_prefill": false, + "supports_computer_use": true, + "supports_function_calling": true, + "supports_pdf_input": true, + "supports_prompt_caching": true, + "supports_reasoning": true, + "supports_response_schema": true, + "supports_tool_choice": true, + "supports_vision": true, + "tool_use_system_prompt_tokens": 346 + }, "fast/claude-opus-4-6-20260205": { "cache_creation_input_token_cost": 6.25e-06, "cache_creation_input_token_cost_above_200k_tokens": 1.25e-05, @@ -37313,4 +37554,4 @@ "search_context_size_medium": 0.01 } } -} \ No newline at end of file +} diff --git a/tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py b/tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py index 89da8d87e63..06ee707b9e8 100644 --- a/tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py +++ b/tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py @@ -35,6 +35,36 @@ def test_opus_4_6_returns_adaptive_for_high(self): ) assert result["type"] == "adaptive" + def test_opus_4_6_dotted_alias_returns_adaptive(self): + result = AnthropicConfig._map_reasoning_effort( + reasoning_effort="medium", model="claude-opus-4.6-20260205" + ) + assert result["type"] == "adaptive" + + def test_sonnet_4_6_returns_adaptive_for_low(self): + result = AnthropicConfig._map_reasoning_effort( + reasoning_effort="low", model="claude-sonnet-4-6" + ) + assert result["type"] == "adaptive" + + def test_sonnet_4_6_dotted_alias_returns_adaptive(self): + result = AnthropicConfig._map_reasoning_effort( + reasoning_effort="high", model="claude-sonnet-4.6" + ) + assert result["type"] == "adaptive" + + def test_opus_4_6_dotted_alias_supports_reasoning_effort_param(self): + params = AnthropicConfig().get_supported_openai_params( + model="claude-opus-4.6-20260205" + ) + assert "reasoning_effort" in params + + def test_sonnet_4_6_dotted_alias_supports_reasoning_effort_param(self): + params = AnthropicConfig().get_supported_openai_params( + model="claude-sonnet-4.6" + ) + assert "reasoning_effort" in params + def test_other_model_low_returns_enabled_with_budget(self): result = AnthropicConfig._map_reasoning_effort( reasoning_effort="low", model="claude-3-7-sonnet-20250219" diff --git a/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py b/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py index 50e948c1a27..3a276f8e16f 100644 --- a/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py +++ b/tests/test_litellm/llms/anthropic/chat/test_anthropic_chat_transformation.py @@ -859,14 +859,17 @@ def test_anthropic_structured_output_beta_header(): [ "claude-opus-4-6-20250918", "claude-opus-4.6-20250918", + "claude-sonnet-4-6", + "claude-sonnet-4.6", "claude-opus-4-5-20251101", "claude-opus-4.5-20251101", ], ) def test_opus_uses_native_structured_output(model_name): """ - Test that Opus 4.5 and 4.6 models use native Anthropic structured outputs - (output_format) rather than the tool-based workaround. + Test that Claude 4.5/4.6 Opus and Sonnet models use native + Anthropic structured outputs (output_format) rather than the + tool-based workaround. """ config = AnthropicConfig() @@ -1644,16 +1647,49 @@ def test_effort_validation_with_opus_46(): messages = [{"role": "user", "content": "Test"}] - for effort in ["high", "medium", "low", "max"]: - optional_params = {"output_config": {"effort": effort}} - result = config.transform_request( - model="claude-opus-4-6-20260205", - messages=messages, - optional_params=optional_params, - litellm_params={}, - headers={} - ) - assert result["output_config"]["effort"] == effort + for model_name in ["claude-opus-4-6-20260205", "claude-opus-4.6-20260205"]: + for effort in ["high", "medium", "low", "max"]: + optional_params = {"output_config": {"effort": effort}} + result = config.transform_request( + model=model_name, + messages=messages, + optional_params=optional_params, + litellm_params={}, + headers={} + ) + assert result["output_config"]["effort"] == effort + + +def test_effort_validation_with_sonnet_46(): + """Test effort levels for Claude Sonnet 4.6.""" + config = AnthropicConfig() + + messages = [{"role": "user", "content": "Test"}] + + for model_name in ["claude-sonnet-4-6", "claude-sonnet-4.6"]: + for effort in ["high", "medium", "low"]: + optional_params = {"output_config": {"effort": effort}} + result = config.transform_request( + model=model_name, + messages=messages, + optional_params=optional_params, + litellm_params={}, + headers={} + ) + assert result["output_config"]["effort"] == effort + + with pytest.raises( + ValueError, + match="effort='max' is only supported by Claude Opus 4.6", + ): + optional_params = {"output_config": {"effort": "max"}} + config.transform_request( + model=model_name, + messages=messages, + optional_params=optional_params, + litellm_params={}, + headers={} + ) def test_max_effort_rejected_for_opus_45(): @@ -2034,6 +2070,29 @@ def test_reasoning_effort_maps_to_adaptive_thinking_for_opus_4_6(): assert "reasoning_effort" not in result +def test_reasoning_effort_maps_to_adaptive_thinking_for_sonnet_4_6(): + """ + Test that reasoning_effort maps to adaptive thinking type for Claude Sonnet 4.6. + """ + config = AnthropicConfig() + + for effort in ["low", "medium", "high", "minimal"]: + non_default_params = {"reasoning_effort": effort} + optional_params = {} + + result = config.map_openai_params( + non_default_params=non_default_params, + optional_params=optional_params, + model="claude-sonnet-4-6", + drop_params=False + ) + + assert "thinking" in result + assert result["thinking"]["type"] == "adaptive" + assert "budget_tokens" not in result["thinking"] + assert "reasoning_effort" not in result + + def test_reasoning_effort_maps_to_budget_thinking_for_non_opus_4_6(): """ Test that reasoning_effort maps to budget-based thinking config for non-Opus 4.6 models. diff --git a/tests/test_litellm/test_claude_opus_4_6_config.py b/tests/test_litellm/test_claude_opus_4_6_config.py index 6ccba580bc2..1966a1c8303 100644 --- a/tests/test_litellm/test_claude_opus_4_6_config.py +++ b/tests/test_litellm/test_claude_opus_4_6_config.py @@ -18,31 +18,27 @@ def test_opus_4_6_australia_region_uses_au_prefix_not_apac(): - 'au.' for Australia (ap-southeast-2) - 'apac.' for Asia-Pacific (Singapore, ap-southeast-1) - This test ensures the Claude Opus 4.6 model correctly uses 'au.' for Australia, - and that 'apac.' is NOT incorrectly used for Australia region. - - Related: The 'apac.' prefix is valid for Asia-Pacific (Singapore) region models, - but should not be used for Australia which has its own 'au.' prefix. + This test ensures the Claude Opus 4.6 model keeps 'au.' as a + compatibility alias and also supports canonical 'jp.' and 'apac.' + region IDs. """ json_path = os.path.join(os.path.dirname(__file__), "../../model_prices_and_context_window.json") with open(json_path) as f: model_data = json.load(f) - # Verify au.anthropic.claude-opus-4-6-v1 exists (correct) + # Verify au.anthropic.claude-opus-4-6-v1 exists (compatibility alias) assert "au.anthropic.claude-opus-4-6-v1" in model_data, \ - "Missing Australia region model: au.anthropic.claude-opus-4-6-v1" + "Missing compatibility alias model: au.anthropic.claude-opus-4-6-v1" - # Verify apac.anthropic.claude-opus-4-6-v1 does NOT exist (incorrect) - assert "apac.anthropic.claude-opus-4-6-v1" not in model_data, \ - "Incorrect model entry exists: apac.anthropic.claude-opus-4-6-v1 should be au.anthropic.claude-opus-4-6-v1" + # Verify canonical regional models exist + assert "jp.anthropic.claude-opus-4-6-v1" in model_data + assert "apac.anthropic.claude-opus-4-6-v1" in model_data - # Verify the au. model is registered in bedrock_converse_models + # Verify aliases are registered in bedrock_converse_models assert "au.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models, \ "au.anthropic.claude-opus-4-6-v1 not registered in bedrock_converse_models" - - # Verify apac. is NOT registered for this model - assert "apac.anthropic.claude-opus-4-6-v1" not in litellm.bedrock_converse_models, \ - "apac.anthropic.claude-opus-4-6-v1 should not be in bedrock_converse_models" + assert "jp.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models + assert "apac.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models def test_opus_4_6_model_pricing_and_capabilities(): @@ -203,8 +199,57 @@ def test_opus_4_6_alias_and_dated_metadata_match(): def test_opus_4_6_bedrock_converse_registration(): + assert "anthropic.claude-opus-4-6-v1:0" in litellm.BEDROCK_CONVERSE_MODELS assert "anthropic.claude-opus-4-6-v1" in litellm.BEDROCK_CONVERSE_MODELS assert "global.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models assert "us.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models assert "eu.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models + assert "jp.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models + assert "apac.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models assert "au.anthropic.claude-opus-4-6-v1" in litellm.bedrock_converse_models + assert "anthropic.claude-sonnet-4-6-v1:0" in litellm.bedrock_converse_models + assert "anthropic.claude-sonnet-4-6-v1" in litellm.bedrock_converse_models + assert "jp.anthropic.claude-sonnet-4-6" in litellm.bedrock_converse_models + assert "apac.anthropic.claude-sonnet-4-6" in litellm.bedrock_converse_models + + +def test_bedrock_claude_4_6_aliases_have_model_cost_mappings(): + project_root = os.path.join(os.path.dirname(__file__), "../../") + main_map_path = os.path.join(project_root, "model_prices_and_context_window.json") + backup_map_path = os.path.join( + project_root, "litellm/model_prices_and_context_window_backup.json" + ) + + with open(main_map_path) as f: + main_map = json.load(f) + with open(backup_map_path) as f: + backup_map = json.load(f) + + expected_aliases = ( + "anthropic.claude-opus-4-6-v1:0", + "anthropic.claude-sonnet-4-6-v1:0", + "anthropic.claude-sonnet-4-6-v1", + ) + + for model_name in expected_aliases: + assert model_name in main_map, f"Missing model entry in main map: {model_name}" + assert model_name in backup_map, f"Missing model entry in backup map: {model_name}" + + assert main_map["anthropic.claude-opus-4-6-v1:0"] == main_map[ + "anthropic.claude-opus-4-6-v1" + ] + assert backup_map["anthropic.claude-opus-4-6-v1:0"] == backup_map[ + "anthropic.claude-opus-4-6-v1" + ] + assert main_map["anthropic.claude-sonnet-4-6-v1:0"] == main_map[ + "anthropic.claude-sonnet-4-6" + ] + assert main_map["anthropic.claude-sonnet-4-6-v1"] == main_map[ + "anthropic.claude-sonnet-4-6" + ] + assert backup_map["anthropic.claude-sonnet-4-6-v1:0"] == backup_map[ + "anthropic.claude-sonnet-4-6" + ] + assert backup_map["anthropic.claude-sonnet-4-6-v1"] == backup_map[ + "anthropic.claude-sonnet-4-6" + ]