diff --git a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py index d1294f996e..7afb6868c7 100644 --- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py @@ -187,10 +187,13 @@ async def gemini_proxy_route( """ [Docs](https://docs.litellm.ai/docs/pass_through/google_ai_studio) """ - # Get LiteLLM API key from Authorization header for authentication - api_key_to_use = get_litellm_virtual_key(request=request) + ## CHECK FOR LITELLM API KEY IN THE QUERY PARAMS - ?..key=LITELLM_API_KEY + google_ai_studio_api_key = request.query_params.get("key") or request.headers.get( + "x-goog-api-key" + ) + user_api_key_dict = await user_api_key_auth( - request=request, api_key=api_key_to_use + request=request, api_key=f"Bearer {google_ai_studio_api_key}" ) base_target_url = ( diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py index 8e297f645c..a447dad0b1 100644 --- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py @@ -412,31 +412,6 @@ class HttpPassThroughEndpointHelpers(BasePassthroughUtils): params=requested_query_params, json=_parsed_body, ) - # Mock httpx response emulating a Google AI video generation operation status - # Attach a dummy request with headers set, so response.request.headers is always present - dummy_request = httpx.Request( - method=request.method, - url=str(url), - headers=headers or {}, - params=requested_query_params, - json=_parsed_body, - ) - # Ensure the .headers attribute exists and is a dict (httpx will normalize it) - mock_headers = httpx.Headers({"content-type": "application/json"}) - response = httpx.Response( - status_code=200, - headers=mock_headers, - json={ - "name": "operations/1234567890123456789", - "metadata": { - "@type": "type.googleapis.com/google.ai.generativelanguage.v1beta.GenerateVideoMetadata", - "state": "RUNNING", - "createTime": "2025-01-01T12:00:00Z" - }, - "done": False - }, - request=dummy_request - ) return response @staticmethod