File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
litellm/proxy/pass_through_endpoints Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -459,14 +459,22 @@ async def anthropic_proxy_route(
459
459
region_name = None ,
460
460
)
461
461
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
+
462
470
## check for streaming
463
471
is_streaming_request = await is_streaming_request_fn (request )
464
472
465
473
## CREATE PASS-THROUGH
466
474
endpoint_func = create_pass_through_route (
467
475
endpoint = endpoint ,
468
476
target = str (updated_url ),
469
- custom_headers = { "x-api-key" : "{}" . format ( anthropic_api_key )} ,
477
+ custom_headers = custom_headers ,
470
478
_forward_headers = True ,
471
479
) # dynamically construct pass-through endpoint based on incoming path
472
480
received_value = await endpoint_func (
You can’t perform that action at this time.
0 commit comments