From 4273837addb50fa16621529ccdca65f2f9c93503 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 22 Nov 2024 13:19:01 -0800 Subject: [PATCH] fix vertex_proxy_route --- .../proxy/vertex_ai_endpoints/vertex_endpoints.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/vertex_ai_endpoints/vertex_endpoints.py b/litellm/proxy/vertex_ai_endpoints/vertex_endpoints.py index 2bd5b790c..73a38bdf7 100644 --- a/litellm/proxy/vertex_ai_endpoints/vertex_endpoints.py +++ b/litellm/proxy/vertex_ai_endpoints/vertex_endpoints.py @@ -119,7 +119,6 @@ async def vertex_proxy_route( endpoint: str, request: Request, fastapi_response: Response, - user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth), ): encoded_endpoint = httpx.URL(endpoint).path @@ -128,6 +127,20 @@ async def vertex_proxy_route( verbose_proxy_logger.debug("requested endpoint %s", endpoint) headers: dict = {} + # TODO - clean this up before merging + litellm_api_key = request.headers.get("X-Litellm-Api-Key") + api_key_to_use = "" + if litellm_api_key: + api_key_to_use = f"Bearer {litellm_api_key}" + else: + api_key_to_use = request.headers.get("Authorization") + + api_key_to_use = api_key_to_use or "" + user_api_key_dict = await user_api_key_auth( + request=request, + api_key=api_key_to_use, + ) + vertex_project = None vertex_location = None # Use headers from the incoming request if default_vertex_config is not set