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 code max auth

hazyone311a0b335a61
diff --git a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
index 5e171af5252..a834a7a13c3 100644
--- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
@@ -459,6 +459,14 @@ async def anthropic_proxy_route(
region_name=None,
)
+ custom_headers = {}
+ if (
+ "authorization" not in request.headers
+ and "x-api-key" not in request.headers
+ and anthropic_api_key is not None
+ ):
+ custom_headers["x-api-key"] = "{}".format(anthropic_api_key)
+
## check for streaming
is_streaming_request = await is_streaming_request_fn(request)
@@ -466,7 +474,7 @@ async def anthropic_proxy_route(
endpoint_func = create_pass_through_route(
endpoint=endpoint,
target=str(updated_url),
- custom_headers={"x-api-key": "{}".format(anthropic_api_key)},
+ custom_headers=custom_headers,
_forward_headers=True,
) # dynamically construct pass-through endpoint based on incoming path
received_value = await endpoint_func(