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: replace deprecated claude-3-7-sonnet-20250219 with claude-4-sonnet-20250514
Sameer Kankute36fd14357cee
diff --git a/tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py b/tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.pyindex 89da8d87e63..98ae7148c77 100644--- a/tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py+++ b/tests/litellm/llms/anthropic/test_anthropic_reasoning_effort.py@@ -19,7 +19,7 @@ class TestMapReasoningEffort:def test_none_returns_none_for_other_models(self):"""reasoning_effort=None should return None for non-Opus models."""result = AnthropicConfig._map_reasoning_effort(- reasoning_effort=None, model="claude-3-7-sonnet-20250219"+ reasoning_effort=None, model="claude-4-sonnet-20250514")assert result is None@@ -37,14 +37,14 @@ class TestMapReasoningEffort:def test_other_model_low_returns_enabled_with_budget(self):result = AnthropicConfig._map_reasoning_effort(- reasoning_effort="low", model="claude-3-7-sonnet-20250219"+ reasoning_effort="low", model="claude-4-sonnet-20250514")assert result["type"] == "enabled"assert "budget_tokens" in resultdef test_other_model_high_returns_enabled_with_budget(self):result = AnthropicConfig._map_reasoning_effort(- reasoning_effort="high", model="claude-3-7-sonnet-20250219"+ reasoning_effort="high", model="claude-4-sonnet-20250514")assert result["type"] == "enabled"assert "budget_tokens" in result@@ -59,6 +59,6 @@ class TestMapReasoningEffort:def test_none_string_returns_none_for_other_models(self):"""reasoning_effort='none' should return None for non-Opus models."""result = AnthropicConfig._map_reasoning_effort(- reasoning_effort="none", model="claude-3-7-sonnet-20250219"+ reasoning_effort="none", model="claude-4-sonnet-20250514")assert result is Nonediff --git a/tests/llm_translation/test_llm_response_utils/test_convert_dict_to_chat_completion.py b/tests/llm_translation/test_llm_response_utils/test_convert_dict_to_chat_completion.pyindex 3b2087d25e9..5a37a5ec932 100644--- a/tests/llm_translation/test_llm_response_utils/test_convert_dict_to_chat_completion.py+++ b/tests/llm_translation/test_llm_response_utils/test_convert_dict_to_chat_completion.py@@ -864,7 +864,7 @@ def test_convert_to_model_response_object_with_thinking_content():"response_object": {"id": "chatcmpl-8cc87354-70f3-4a14-b71b-332e965d98d2","created": 1741057687,- "model": "claude-3-7-sonnet-20250219",+ "model": "claude-4-sonnet-20250514","object": "chat.completion","system_fingerprint": None,"choices": [diff --git a/tests/local_testing/test_amazing_vertex_completion.py b/tests/local_testing/test_amazing_vertex_completion.pyindex 0078483c734..5daabf083e4 100644--- a/tests/local_testing/test_amazing_vertex_completion.py+++ b/tests/local_testing/test_amazing_vertex_completion.py@@ -3242,7 +3242,7 @@ def vertex_ai_anthropic_thinking_mock_response(*args, **kwargs):"id": "msg_vrtx_011pL6Np3MKxXL3R8theMRJW","type": "message","role": "assistant",- "model": "claude-3-7-sonnet-20250219",+ "model": "claude-4-sonnet-20250514","content": [{"type": "thinking",diff --git a/tests/local_testing/test_function_calling.py b/tests/local_testing/test_function_calling.pyindex e2f9c6d834e..e47b32a01f3 100644--- a/tests/local_testing/test_function_calling.py+++ b/tests/local_testing/test_function_calling.py@@ -158,7 +158,7 @@ def test_aaparallel_function_call(model):@pytest.mark.parametrize("model",[- "anthropic/claude-3-7-sonnet-20250219",+ "anthropic/claude-4-sonnet-20250514","bedrock/us.anthropic.claude-3-7-sonnet-20250219-v1:0",],)diff --git a/tests/local_testing/test_streaming.py b/tests/local_testing/test_streaming.pyindex ee208b5e0e2..b3f13e8a4b1 100644--- a/tests/local_testing/test_streaming.py+++ b/tests/local_testing/test_streaming.py@@ -1387,7 +1387,7 @@ def test_bedrock_claude_3_streaming():@pytest.mark.parametrize("model",[- "claude-3-7-sonnet-20250219",+ "claude-4-sonnet-20250514","cohere.command-r-plus-v1:0", # bedrock"gpt-3.5-turbo",],@@ -2883,7 +2883,7 @@ def test_completion_claude_3_function_call_with_streaming():try:# test without max tokensresponse = completion(- model="claude-3-7-sonnet-20250219",+ model="claude-4-sonnet-20250514",messages=messages,tools=tools,tool_choice="required",diff --git a/tests/pass_through_tests/base_anthropic_messages_test.py b/tests/pass_through_tests/base_anthropic_messages_test.pyindex 90d00ccb1ad..e86e58de33b 100644--- a/tests/pass_through_tests/base_anthropic_messages_test.py+++ b/tests/pass_through_tests/base_anthropic_messages_test.py@@ -54,7 +54,7 @@ class BaseAnthropicMessagesTest(ABC):print("making request to anthropic passthrough with thinking")client = self.get_client()response = client.messages.create(- model="claude-3-7-sonnet-20250219",+ model="claude-4-sonnet-20250514",max_tokens=20000,thinking={"type": "enabled", "budget_tokens": 16000},messages=[@@ -75,7 +75,7 @@ class BaseAnthropicMessagesTest(ABC):collected_response = []client = self.get_client()with client.messages.stream(- model="claude-3-7-sonnet-20250219",+ model="claude-4-sonnet-20250514",max_tokens=20000,thinking={"type": "enabled", "budget_tokens": 16000},messages=[diff --git a/tests/pass_through_tests/test_anthropic_passthrough.py b/tests/pass_through_tests/test_anthropic_passthrough.pyindex 1a2d1b28ab5..81bbb889526 100644--- a/tests/pass_through_tests/test_anthropic_passthrough.py+++ b/tests/pass_through_tests/test_anthropic_passthrough.py@@ -313,7 +313,7 @@ async def test_anthropic_messages_streaming_cost_injection():}payload = {- "model": "claude-3-7-sonnet-20250219",+ "model": "claude-4-sonnet-20250514","max_tokens": 10,"stream": True,"messages": [{"role": "user", "content": "Say 'Hi'"}],diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py b/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.pyindex f275681bdef..fcfc696f003 100644--- a/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py+++ b/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py@@ -1275,7 +1275,7 @@ class TestSpendLogsPayload:mock_response.json.return_value = {"content": [{"text": "Hi! My name is Claude.", "type": "text"}],"id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",- "model": "claude-3-7-sonnet-20250219",+ "model": "claude-4-sonnet-20250514","role": "assistant","stop_reason": "end_turn","stop_sequence": None,@@ -1302,7 +1302,7 @@ class TestSpendLogsPayload:client, "post", side_effect=self.mock_anthropic_response):response = await litellm.acompletion(- model="claude-3-7-sonnet-20250219",+ model="claude-4-sonnet-20250514",messages=[{"role": "user", "content": "Hello, world!"}],metadata={"user_api_key_end_user_id": "test_user_1"},client=client,@@ -1331,10 +1331,10 @@ class TestSpendLogsPayload:"completionStartTime": datetime.datetime(2025, 3, 24, 22, 2, 42, 989132, tzinfo=datetime.timezone.utc),- "model": "claude-3-7-sonnet-20250219",+ "model": "claude-4-sonnet-20250514","user": "","team_id": "",- "metadata": '{"applied_guardrails": [], "batch_models": null, "mcp_tool_call_metadata": null, "vector_store_request_metadata": null, "guardrail_information": null, "usage_object": {"completion_tokens": 503, "prompt_tokens": 2095, "total_tokens": 2598, "completion_tokens_details": null, "prompt_tokens_details": {"audio_tokens": null, "cached_tokens": 0}, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0}, "model_map_information": {"model_map_key": "claude-3-7-sonnet-20250219", "model_map_value": {"key": "claude-3-7-sonnet-20250219", "max_tokens": 128000, "max_input_tokens": 200000, "max_output_tokens": 128000, "input_cost_per_token": 3e-06, "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, "input_cost_per_character": null, "input_cost_per_token_above_128k_tokens": null, "input_cost_per_token_above_200k_tokens": null, "input_cost_per_query": null, "input_cost_per_second": null, "input_cost_per_audio_token": null, "input_cost_per_token_batches": null, "output_cost_per_token_batches": null, "output_cost_per_token": 1.5e-05, "output_cost_per_audio_token": null, "output_cost_per_character": null, "output_cost_per_token_above_128k_tokens": null, "output_cost_per_character_above_128k_tokens": null, "output_cost_per_token_above_200k_tokens": null, "output_cost_per_second": null, "output_cost_per_image": null, "output_vector_size": null, "litellm_provider": "anthropic", "mode": "chat", "supports_system_messages": null, "supports_response_schema": true, "supports_vision": true, "supports_function_calling": true, "supports_tool_choice": true, "supports_assistant_prefill": true, "supports_prompt_caching": true, "supports_audio_input": false, "supports_audio_output": false, "supports_pdf_input": true, "supports_embedding_image_input": false, "supports_native_streaming": null, "supports_web_search": false, "supports_reasoning": true, "search_context_cost_per_query": null, "tpm": null, "rpm": null, "supported_openai_params": ["stream", "stop", "temperature", "top_p", "max_tokens", "max_completion_tokens", "tools", "tool_choice", "extra_headers", "parallel_tool_calls", "response_format", "user", "reasoning_effort", "thinking"]}}, "additional_usage_values": {"completion_tokens_details": {"accepted_prediction_tokens": null, "audio_tokens": null, "reasoning_tokens": null, "rejected_prediction_tokens": null, "text_tokens": 503, "image_tokens": null}, "prompt_tokens_details": {"audio_tokens": null, "cached_tokens": 0, "text_tokens": null, "image_tokens": null}, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0}}',+ "metadata": '{"applied_guardrails": [], "batch_models": null, "mcp_tool_call_metadata": null, "vector_store_request_metadata": null, "guardrail_information": null, "usage_object": {"completion_tokens": 503, "prompt_tokens": 2095, "total_tokens": 2598, "completion_tokens_details": null, "prompt_tokens_details": {"audio_tokens": null, "cached_tokens": 0}, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0}, "model_map_information": {"model_map_key": "claude-4-sonnet-20250514", "model_map_value": {"key": "claude-4-sonnet-20250514", "max_tokens": 128000, "max_input_tokens": 200000, "max_output_tokens": 128000, "input_cost_per_token": 3e-06, "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, "input_cost_per_character": null, "input_cost_per_token_above_128k_tokens": null, "input_cost_per_token_above_200k_tokens": null, "input_cost_per_query": null, "input_cost_per_second": null, "input_cost_per_audio_token": null, "input_cost_per_token_batches": null, "output_cost_per_token_batches": null, "output_cost_per_token": 1.5e-05, "output_cost_per_audio_token": null, "output_cost_per_character": null, "output_cost_per_token_above_128k_tokens": null, "output_cost_per_character_above_128k_tokens": null, "output_cost_per_token_above_200k_tokens": null, "output_cost_per_second": null, "output_cost_per_image": null, "output_vector_size": null, "litellm_provider": "anthropic", "mode": "chat", "supports_system_messages": null, "supports_response_schema": true, "supports_vision": true, "supports_function_calling": true, "supports_tool_choice": true, "supports_assistant_prefill": true, "supports_prompt_caching": true, "supports_audio_input": false, "supports_audio_output": false, "supports_pdf_input": true, "supports_embedding_image_input": false, "supports_native_streaming": null, "supports_web_search": false, "supports_reasoning": true, "search_context_cost_per_query": null, "tpm": null, "rpm": null, "supported_openai_params": ["stream", "stop", "temperature", "top_p", "max_tokens", "max_completion_tokens", "tools", "tool_choice", "extra_headers", "parallel_tool_calls", "response_format", "user", "reasoning_effort", "thinking"]}}, "additional_usage_values": {"completion_tokens_details": {"accepted_prediction_tokens": null, "audio_tokens": null, "reasoning_tokens": null, "rejected_prediction_tokens": null, "text_tokens": 503, "image_tokens": null}, "prompt_tokens_details": {"audio_tokens": null, "cached_tokens": 0, "text_tokens": null, "image_tokens": null}, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0}}',"cache_key": "Cache OFF","spend": 0.01383,"total_tokens": 2598,@@ -1376,7 +1376,7 @@ class TestSpendLogsPayload:{"model_name": "my-anthropic-model-group","litellm_params": {- "model": "claude-3-7-sonnet-20250219",+ "model": "claude-4-sonnet-20250514",},"model_info": {"id": "my-unique-model-id",@@ -1423,10 +1423,10 @@ class TestSpendLogsPayload:"completionStartTime": datetime.datetime(2025, 3, 24, 22, 2, 42, 989132, tzinfo=datetime.timezone.utc),- "model": "claude-3-7-sonnet-20250219",+ "model": "claude-4-sonnet-20250514","user": "","team_id": "",- "metadata": '{"applied_guardrails": [], "batch_models": null, "mcp_tool_call_metadata": null, "vector_store_request_metadata": null, "guardrail_information": null, "usage_object": {"completion_tokens": 503, "prompt_tokens": 2095, "total_tokens": 2598, "completion_tokens_details": null, "prompt_tokens_details": {"audio_tokens": null, "cached_tokens": 0}, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0}, "model_map_information": {"model_map_key": "claude-3-7-sonnet-20250219", "model_map_value": {"key": "claude-3-7-sonnet-20250219", "max_tokens": 128000, "max_input_tokens": 200000, "max_output_tokens": 128000, "input_cost_per_token": 3e-06, "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, "input_cost_per_character": null, "input_cost_per_token_above_128k_tokens": null, "input_cost_per_token_above_200k_tokens": null, "input_cost_per_query": null, "input_cost_per_second": null, "input_cost_per_audio_token": null, "input_cost_per_token_batches": null, "output_cost_per_token_batches": null, "output_cost_per_token": 1.5e-05, "output_cost_per_audio_token": null, "output_cost_per_character": null, "output_cost_per_token_above_128k_tokens": null, "output_cost_per_character_above_128k_tokens": null, "output_cost_per_token_above_200k_tokens": null, "output_cost_per_second": null, "output_cost_per_image": null, "output_vector_size": null, "litellm_provider": "anthropic", "mode": "chat", "supports_system_messages": null, "supports_response_schema": true, "supports_vision": true, "supports_function_calling": true, "supports_tool_choice": true, "supports_assistant_prefill": true, "supports_prompt_caching": true, "supports_audio_input": false, "supports_audio_output": false, "supports_pdf_input": true, "supports_embedding_image_input": false, "supports_native_streaming": null, "supports_web_search": false, "supports_reasoning": true, "search_context_cost_per_query": null, "tpm": null, "rpm": null, "supported_openai_params": ["stream", "stop", "temperature", "top_p", "max_tokens", "max_completion_tokens", "tools", "tool_choice", "extra_headers", "parallel_tool_calls", "response_format", "user", "reasoning_effort", "thinking"]}}, "additional_usage_values": {"completion_tokens_details": {"accepted_prediction_tokens": null, "audio_tokens": null, "reasoning_tokens": null, "rejected_prediction_tokens": null, "text_tokens": 503, "image_tokens": null}, "prompt_tokens_details": {"audio_tokens": null, "cached_tokens": 0, "text_tokens": null, "image_tokens": null}, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0}}',+ "metadata": '{"applied_guardrails": [], "batch_models": null, "mcp_tool_call_metadata": null, "vector_store_request_metadata": null, "guardrail_information": null, "usage_object": {"completion_tokens": 503, "prompt_tokens": 2095, "total_tokens": 2598, "completion_tokens_details": null, "prompt_tokens_details": {"audio_tokens": null, "cached_tokens": 0}, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0}, "model_map_information": {"model_map_key": "claude-4-sonnet-20250514", "model_map_value": {"key": "claude-4-sonnet-20250514", "max_tokens": 128000, "max_input_tokens": 200000, "max_output_tokens": 128000, "input_cost_per_token": 3e-06, "cache_creation_input_token_cost": 3.75e-06, "cache_read_input_token_cost": 3e-07, "input_cost_per_character": null, "input_cost_per_token_above_128k_tokens": null, "input_cost_per_token_above_200k_tokens": null, "input_cost_per_query": null, "input_cost_per_second": null, "input_cost_per_audio_token": null, "input_cost_per_token_batches": null, "output_cost_per_token_batches": null, "output_cost_per_token": 1.5e-05, "output_cost_per_audio_token": null, "output_cost_per_character": null, "output_cost_per_token_above_128k_tokens": null, "output_cost_per_character_above_128k_tokens": null, "output_cost_per_token_above_200k_tokens": null, "output_cost_per_second": null, "output_cost_per_image": null, "output_vector_size": null, "litellm_provider": "anthropic", "mode": "chat", "supports_system_messages": null, "supports_response_schema": true, "supports_vision": true, "supports_function_calling": true, "supports_tool_choice": true, "supports_assistant_prefill": true, "supports_prompt_caching": true, "supports_audio_input": false, "supports_audio_output": false, "supports_pdf_input": true, "supports_embedding_image_input": false, "supports_native_streaming": null, "supports_web_search": false, "supports_reasoning": true, "search_context_cost_per_query": null, "tpm": null, "rpm": null, "supported_openai_params": ["stream", "stop", "temperature", "top_p", "max_tokens", "max_completion_tokens", "tools", "tool_choice", "extra_headers", "parallel_tool_calls", "response_format", "user", "reasoning_effort", "thinking"]}}, "additional_usage_values": {"completion_tokens_details": {"accepted_prediction_tokens": null, "audio_tokens": null, "reasoning_tokens": null, "rejected_prediction_tokens": null, "text_tokens": 503, "image_tokens": null}, "prompt_tokens_details": {"audio_tokens": null, "cached_tokens": 0, "text_tokens": null, "image_tokens": null}, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0}}',"cache_key": "Cache OFF","spend": 0.01383,"total_tokens": 2598,diff --git a/tests/test_litellm/responses/litellm_completion_transformation/test_session_handler.py b/tests/test_litellm/responses/litellm_completion_transformation/test_session_handler.pyindex b0a232a7bf4..9279ce26112 100644--- a/tests/test_litellm/responses/litellm_completion_transformation/test_session_handler.py+++ b/tests/test_litellm/responses/litellm_completion_transformation/test_session_handler.py@@ -319,7 +319,7 @@ async def test_should_check_cold_storage_for_full_payload():]}],- "model": "anthropic/claude-3-7-sonnet-20250219",+ "model": "anthropic/claude-4-sonnet-20250514","stream": True,"litellm_trace_id": "16b86861-c120-4ecb-865b-4d2238bfd8f0"}@@ -333,7 +333,7 @@ async def test_should_check_cold_storage_for_full_payload():"content": "Hello, this is a regular message"}],- "model": "anthropic/claude-3-7-sonnet-20250219",+ "model": "anthropic/claude-4-sonnet-20250514","stream": True}diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.pyindex 5bfb3bd8795..31f492a45bb 100644--- a/tests/test_litellm/test_utils.py+++ b/tests/test_litellm/test_utils.py@@ -429,7 +429,7 @@ def test_anthropic_web_search_in_model_info():litellm.model_cost = litellm.get_model_cost_map(url="")supported_models = [- "anthropic/claude-3-7-sonnet-20250219",+ "anthropic/claude-4-sonnet-20250514","anthropic/claude-sonnet-4-5-20250929","anthropic/claude-3-5-sonnet-20241022","anthropic/claude-3-5-haiku-20241022",@@ -1050,7 +1050,7 @@ def test_supports_computer_use_utility():try:# Test a model known to support computer_use from backup JSONsupports_cu_anthropic = supports_computer_use(- model="anthropic/claude-3-7-sonnet-20250219"+ model="anthropic/claude-4-sonnet-20250514")assert supports_cu_anthropic is True@@ -1073,7 +1073,7 @@ def test_supports_computer_use_utility():def test_get_model_info_shows_supports_computer_use():"""Tests if 'supports_computer_use' is correctly retrieved by get_model_info.- We'll use 'claude-3-7-sonnet-20250219' as it's configured+ We'll use 'claude-4-sonnet-20250514' as it's configuredin the backup JSON to have supports_computer_use: True."""os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"@@ -1082,7 +1082,7 @@ def test_get_model_info_shows_supports_computer_use():litellm.model_cost = litellm.get_model_cost_map(url="")# This model should have 'supports_computer_use': True in the backup JSON- model_known_to_support_computer_use = "claude-3-7-sonnet-20250219"+ model_known_to_support_computer_use = "claude-4-sonnet-20250514"info = litellm.get_model_info(model_known_to_support_computer_use)print(f"Info for {model_known_to_support_computer_use}: {info}")