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(llm_passthrough_endpoints.py): merge query params correctly for gemini

Krrish Dholakiadb1b38381ad7
diff --git a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
index b7a82bb8d60..7afb6868c73 100644
--- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py
@@ -233,6 +233,7 @@ async def gemini_proxy_route(
target=str(updated_url),
custom_llm_provider="gemini",
is_streaming_request=is_streaming_request,
+ query_params=merged_params,
) # dynamically construct pass-through endpoint based on incoming path
received_value = await endpoint_func(
request,
@@ -1035,7 +1036,6 @@ async def bedrock_proxy_route(
fastapi_response,
user_api_key_dict,
custom_body=data, # type: ignore
- query_params={}, # type: ignore
)
return received_value
diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
index b66bc6eac28..89a93247ea8 100644
--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
@@ -996,6 +996,7 @@ def create_pass_through_route(
cost_per_request: Optional[float] = None,
custom_llm_provider: Optional[str] = None,
is_streaming_request: Optional[bool] = False,
+ query_params: Optional[dict] = None,
):
# check if target is an adapter.py or a url
from litellm._uuid import uuid
@@ -1098,10 +1099,10 @@ def create_pass_through_route(
# Ensure query_params and custom_body are dicts or None
final_query_params = (
- query_params_data
- if isinstance(query_params_data, dict) or query_params_data is None
- else None
+ query_params_data if isinstance(query_params_data, dict) else {}
)
+ if query_params:
+ final_query_params.update(query_params)
final_custom_body = (
custom_body_data
if isinstance(custom_body_data, dict) or custom_body_data is None