Skip to content

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]

fix claude-sonnet-4-5

Ishaan Jaffer1b49dba1ddb0
diff --git a/tests/llm_responses_api_testing/test_anthropic_responses_api.py b/tests/llm_responses_api_testing/test_anthropic_responses_api.py
index d633cd0f1dd..58dec058d65 100644
--- a/tests/llm_responses_api_testing/test_anthropic_responses_api.py
+++ b/tests/llm_responses_api_testing/test_anthropic_responses_api.py
@@ -30,7 +30,7 @@ class TestAnthropicResponsesAPITest(BaseResponsesAPITest):
def get_base_completion_call_args(self):
#litellm._turn_on_debug()
return {
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
}
async def test_basic_openai_responses_delete_endpoint(self, sync_mode=False):
diff --git a/tests/llm_translation/test_anthropic_completion.py b/tests/llm_translation/test_anthropic_completion.py
index 7d9ef56f164..eacf24be594 100644
--- a/tests/llm_translation/test_anthropic_completion.py
+++ b/tests/llm_translation/test_anthropic_completion.py
@@ -484,7 +484,7 @@ from litellm import completion
class TestAnthropicCompletion(BaseLLMChatTest, BaseAnthropicChatTest):
def get_base_completion_call_args(self) -> dict:
- return {"model": "anthropic/claude-3-5-sonnet-latest"}
+ return {"model": "anthropic/claude-sonnet-4-5-latest"}
def get_base_completion_call_args_with_thinking(self) -> dict:
return {
@@ -1256,7 +1256,7 @@ async def test_anthropic_api_max_completion_tokens(model: str):
def test_anthropic_websearch(optional_params: dict):
litellm._turn_on_debug()
params = {
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
"messages": [{"role": "user", "content": "Who won the World Cup in 2022?"}],
**optional_params,
}
@@ -1275,7 +1275,7 @@ def test_anthropic_websearch(optional_params: dict):
def test_anthropic_text_editor():
litellm._turn_on_debug()
params = {
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
"messages": [
{
"role": "user",
@@ -1363,7 +1363,7 @@ def test_anthropic_mcp_server_responses_api(model: str):
def test_anthropic_prefix_prompt():
params = {
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
"messages": [
{"role": "user", "content": "Who won the World Cup in 2022?"},
{"role": "assistant", "content": "Argentina", "prefix": True},
@@ -1479,7 +1479,7 @@ def test_anthropic_streaming():
"content": "Do what you are told to do in the system prompt",
},
],
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
"max_tokens": 7000,
"parallel_tool_calls": False,
"stream": True,
diff --git a/tests/local_testing/test_router.py b/tests/local_testing/test_router.py
index 55d5c418c3d..d18bc89699f 100644
--- a/tests/local_testing/test_router.py
+++ b/tests/local_testing/test_router.py
@@ -105,7 +105,7 @@ async def test_router_provider_wildcard_routing():
print("router model list = ", router.get_model_list())
response1 = await router.acompletion(
- model="anthropic/claude-3-5-sonnet-latest",
+ model="anthropic/claude-sonnet-4-5-latest",
messages=[{"role": "user", "content": "hello"}],
)
@@ -126,7 +126,7 @@ async def test_router_provider_wildcard_routing():
print("response 3 = ", response3)
response4 = await router.acompletion(
- model="claude-3-5-sonnet-latest",
+ model="claude-sonnet-4-5-latest",
messages=[{"role": "user", "content": "hello"}],
)
diff --git a/tests/local_testing/test_router_auto_router.py b/tests/local_testing/test_router_auto_router.py
index 0dcf531548a..9c18602b496 100644
--- a/tests/local_testing/test_router_auto_router.py
+++ b/tests/local_testing/test_router_auto_router.py
@@ -52,7 +52,7 @@ async def test_router_auto_router():
{
"model_name": "litellm-claude-35",
"litellm_params": {
- "model": "claude-3-5-sonnet-latest",
+ "model": "claude-sonnet-4-5-latest",
},
"model_info": {"id": "claude-id"},
},
@@ -89,7 +89,7 @@ async def test_router_auto_router():
assert response._hidden_params["model_id"] == "openai-id"
- # this goes to claude-3-5-sonnet-latest
+ # this goes to claude-sonnet-4-5-latest
# these are the utterances in the router.json file
response = await router.acompletion(
model="auto_router1",
diff --git a/tests/local_testing/test_router_fallbacks.py b/tests/local_testing/test_router_fallbacks.py
index ffa41bfddf0..88643404b60 100644
--- a/tests/local_testing/test_router_fallbacks.py
+++ b/tests/local_testing/test_router_fallbacks.py
@@ -1133,9 +1133,9 @@ async def test_router_content_policy_fallbacks(
router = Router(
model_list=[
{
- "model_name": "claude-3-5-sonnet-latest",
+ "model_name": "claude-sonnet-4-5-latest",
"litellm_params": {
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
"api_key": "",
"mock_response": mock_response,
},
@@ -1159,7 +1159,7 @@ async def test_router_content_policy_fallbacks(
{
"model_name": "my-general-model",
"litellm_params": {
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
"api_key": "",
"mock_response": Exception("Should not have called this."),
},
@@ -1167,14 +1167,14 @@ async def test_router_content_policy_fallbacks(
{
"model_name": "my-context-window-model",
"litellm_params": {
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
"api_key": "",
"mock_response": Exception("Should not have called this."),
},
},
],
content_policy_fallbacks=(
- [{"claude-3-5-sonnet-latest": ["my-fallback-model"]}]
+ [{"claude-sonnet-4-5-latest": ["my-fallback-model"]}]
if fallback_type == "model-specific"
else None
),
@@ -1185,12 +1185,12 @@ async def test_router_content_policy_fallbacks(
if sync_mode is True:
response = router.completion(
- model="claude-3-5-sonnet-latest",
+ model="claude-sonnet-4-5-latest",
messages=[{"role": "user", "content": "Hey, how's it going?"}],
)
else:
response = await router.acompletion(
- model="claude-3-5-sonnet-latest",
+ model="claude-sonnet-4-5-latest",
messages=[{"role": "user", "content": "Hey, how's it going?"}],
)
diff --git a/tests/local_testing/test_streaming.py b/tests/local_testing/test_streaming.py
index a84d60ad137..ff28f79d056 100644
--- a/tests/local_testing/test_streaming.py
+++ b/tests/local_testing/test_streaming.py
@@ -3982,7 +3982,7 @@ def test_streaming_finish_reason():
## Anthropic
response = litellm.completion(
- model="anthropic/claude-3-5-sonnet-latest",
+ model="anthropic/claude-sonnet-4-5-latest",
messages=[{"role": "user", "content": "What is the capital of France?"}],
stream=True,
stream_options={"include_usage": True},
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.py
index 1d90177cdec..3eef43836ef 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
@@ -34,11 +34,11 @@ async def test_get_chat_completion_message_history_for_previous_response_id():
"completion_tokens": 318,
"startTime": "2025-05-30T03:17:06.703+00:00",
"endTime": "2025-05-30T03:17:11.894+00:00",
- "model": "claude-3-5-sonnet-latest",
+ "model": "claude-sonnet-4-5-latest",
"session_id": "a96757c4-c6dc-4c76-b37e-e7dfa526b701",
"proxy_server_request": {
"input": "who is Michael Jordan",
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
},
"response": {
"id": "chatcmpl-935b8dad-fdc2-466e-a8ca-e26e5a8a21bb",
@@ -75,11 +75,11 @@ async def test_get_chat_completion_message_history_for_previous_response_id():
"completion_tokens": 628,
"startTime": "2025-05-30T03:17:28.600+00:00",
"endTime": "2025-05-30T03:17:39.921+00:00",
- "model": "claude-3-5-sonnet-latest",
+ "model": "claude-sonnet-4-5-latest",
"session_id": "a96757c4-c6dc-4c76-b37e-e7dfa526b701",
"proxy_server_request": {
"input": "can you tell me more about him",
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
"previous_response_id": "resp_bGl0ZWxsbTpjdXN0b21fbGxtX3Byb3ZpZGVyOmFudGhyb3BpYzttb2RlbF9pZDplMGYzMDJhMTQxMmU3ODQ3MGViYjI4Y2JlZDAxZmZmNWY4OGMwZDMzMWM2NjdlOWYyYmE0YjQxM2M2ZmJkMjgyO3Jlc3BvbnNlX2lkOmNoYXRjbXBsLTkzNWI4ZGFkLWZkYzItNDY2ZS1hOGNhLWUyNmU1YThhMjFiYg==",
},
"response": {
@@ -373,7 +373,7 @@ async def test_get_chat_completion_message_history_empty_response_dict():
This tests the fix for response validation to check for empty dict responses.
"""
from unittest.mock import AsyncMock, patch
-
+
# Mock spend logs with empty response dict
mock_spend_logs = [
{
diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.py
index a1b18596b34..7d327dc5f67 100644
--- a/tests/test_litellm/test_router.py
+++ b/tests/test_litellm/test_router.py
@@ -102,7 +102,7 @@ async def test_arouter_with_tags_and_fallbacks():
{
"model_name": "anthropic-claude-3-5-sonnet",
"litellm_params": {
- "model": "claude-3-5-sonnet-latest",
+ "model": "claude-sonnet-4-5-latest",
"mock_response": "Hello, world 2!",
},
},
@@ -670,9 +670,9 @@ async def test_router_v1_messages_fallbacks():
router = litellm.Router(
model_list=[
{
- "model_name": "claude-3-5-sonnet-latest",
+ "model_name": "claude-sonnet-4-5-latest",
"litellm_params": {
- "model": "anthropic/claude-3-5-sonnet-latest",
+ "model": "anthropic/claude-sonnet-4-5-latest",
"mock_response": "litellm.InternalServerError",
},
},
@@ -685,12 +685,12 @@ async def test_router_v1_messages_fallbacks():
},
],
fallbacks=[
- {"claude-3-5-sonnet-latest": ["bedrock-claude"]},
+ {"claude-sonnet-4-5-latest": ["bedrock-claude"]},
],
)
result = await router.aanthropic_messages(
- model="claude-3-5-sonnet-latest",
+ model="claude-sonnet-4-5-latest",
messages=[{"role": "user", "content": "Hello, world!"}],
max_tokens=256,
)
diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py
index 90407bdc678..b88615107f1 100644
--- a/tests/test_litellm/test_utils.py
+++ b/tests/test_litellm/test_utils.py
@@ -353,7 +353,7 @@ def test_anthropic_web_search_in_model_info():
supported_models = [
"anthropic/claude-3-7-sonnet-20250219",
- "anthropic/claude-3-5-sonnet-latest",
+ "anthropic/claude-sonnet-4-5-latest",
"anthropic/claude-3-5-sonnet-20241022",
"anthropic/claude-3-5-haiku-20241022",
"anthropic/claude-3-5-haiku-latest",
@@ -1184,7 +1184,7 @@ class TestProxyFunctionCalling:
), "Custom model names return False without proxy config context"
# Case 2: Model name that can be resolved (matches pattern)
- resolvable_model = "litellm_proxy/claude-3-5-sonnet-latest"
+ resolvable_model = "litellm_proxy/claude-sonnet-4-5-latest"
result = supports_function_calling(resolvable_model)
assert result is True, "Resolvable model names work with fallback logic"
@@ -1195,7 +1195,7 @@ class TestProxyFunctionCalling:
✅ WORKS (with current fallback logic):
- litellm_proxy/gpt-4
- - litellm_proxy/claude-3-5-sonnet-latest
+ - litellm_proxy/claude-sonnet-4-5-latest
- litellm_proxy/anthropic/claude-3-haiku-20240307
❌ DOESN'T WORK (requires proxy server config):
diff --git a/tests/test_openai_endpoints.py b/tests/test_openai_endpoints.py
index fd997ebb71c..1be35168a82 100644
--- a/tests/test_openai_endpoints.py
+++ b/tests/test_openai_endpoints.py
@@ -556,7 +556,7 @@ async def test_proxy_all_models():
await chat_completion(
session=session,
key=LITELLM_MASTER_KEY,
- model="anthropic/claude-3-5-sonnet-latest",
+ model="anthropic/claude-sonnet-4-5-latest",
)