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]

test(anthropic): pass explicit api_key where passthrough env validation now raises

Devin AI0fc042e37613
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 4f340ee0f3f..0933638635b 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
@@ -1050,6 +1050,7 @@ def test_anthropic_messages_validate_adds_beta_header():
messages=[{"role": "user", "content": [{"type": "text", "text": "Hi"}]}],
optional_params={"context_management": _sample_context_management_payload()},
litellm_params={},
+ api_key="fake-anthropic-key",
)
assert headers["anthropic-beta"] == "context-management-2025-06-27"
diff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_speed.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_speed.py
index 6900f1062bf..efd49962ac8 100644
--- a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_speed.py
+++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_messages_speed.py
@@ -28,6 +28,7 @@ def test_messages_drop_params_strips_speed_for_unsupported_models():
messages=[{"role": "user", "content": "Hello"}],
optional_params=dict(optional_params),
litellm_params={},
+ api_key="fake-anthropic-key",
)
result = config.transform_anthropic_messages_request(
model="claude-sonnet-4-6",
@@ -60,6 +61,7 @@ def test_messages_drop_params_keeps_speed_for_supporting_models():
messages=[{"role": "user", "content": "Hello"}],
optional_params=dict(optional_params),
litellm_params={},
+ api_key="fake-anthropic-key",
)
result = config.transform_anthropic_messages_request(
model="claude-opus-4-6",