Skip to content

Commit 311a0b3

Browse files
committed
fix claude code max auth
1 parent 7216983 commit 311a0b3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,22 @@ async def anthropic_proxy_route(
459459
region_name=None,
460460
)
461461

462+
custom_headers = {}
463+
if (
464+
"authorization" not in request.headers
465+
and "x-api-key" not in request.headers
466+
and anthropic_api_key is not None
467+
):
468+
custom_headers["x-api-key"] = "{}".format(anthropic_api_key)
469+
462470
## check for streaming
463471
is_streaming_request = await is_streaming_request_fn(request)
464472

465473
## CREATE PASS-THROUGH
466474
endpoint_func = create_pass_through_route(
467475
endpoint=endpoint,
468476
target=str(updated_url),
469-
custom_headers={"x-api-key": "{}".format(anthropic_api_key)},
477+
custom_headers=custom_headers,
470478
_forward_headers=True,
471479
) # dynamically construct pass-through endpoint based on incoming path
472480
received_value = await endpoint_func(

0 commit comments

Comments
 (0)