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(litellm_pre_call_utils.py): only pass api_version if set

Krrish Dholakia5f565806bd9d
diff --git a/litellm/proxy/litellm_pre_call_utils.py b/litellm/proxy/litellm_pre_call_utils.py
index 54f2171945a..c6070c2062e 100644
--- a/litellm/proxy/litellm_pre_call_utils.py
+++ b/litellm/proxy/litellm_pre_call_utils.py
@@ -181,7 +181,8 @@ async def add_litellm_data_to_request(
## check for api version in query params
dynamic_api_version: Optional[str] = query_dict.get("api-version")
- data["api_version"] = dynamic_api_version
+ if dynamic_api_version is not None: # only pass, if set
+ data["api_version"] = dynamic_api_version
## Forward any LLM API Provider specific headers in extra_headers
add_provider_specific_headers_to_request(data=data, headers=_headers)