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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(azure): let the caller's api-version win over the deployment's on passthrough relays
mateo-berric698ddeacb16
diff --git a/litellm/llms/azure/passthrough/transformation.py b/litellm/llms/azure/passthrough/transformation.pyindex 983033a8b14..062c60d7231 100644--- a/litellm/llms/azure/passthrough/transformation.py+++ b/litellm/llms/azure/passthrough/transformation.py@@ -61,11 +61,11 @@ class AzurePassthroughConfig(BasePassthroughConfig):routed_endpoint: Final = replace_path_segment(endpoint, model_group, model) if model_group else endpointnative_endpoint: Final = strip_leading_model_segment(routed_endpoint, (model,))+ caller_api_version: Final = request_query_params.get("api-version") if request_query_params else Nonecomplete_url: Final = BaseAzureLLM._get_base_azure_url(api_base=base_target_url,- litellm_params=litellm_params,+ litellm_params={**litellm_params, "api_version": caller_api_version or litellm_params.get("api_version")},route=native_endpoint,- default_api_version=request_query_params.get("api-version") if request_query_params else None,)return (httpx.URL(complete_url),diff --git a/tests/test_litellm/llms/azure/passthrough/test_azure_passthrough_transformation.py b/tests/test_litellm/llms/azure/passthrough/test_azure_passthrough_transformation.pyindex 8ffd632fe85..262a281aeb3 100644--- a/tests/test_litellm/llms/azure/passthrough/test_azure_passthrough_transformation.py+++ b/tests/test_litellm/llms/azure/passthrough/test_azure_passthrough_transformation.py@@ -207,18 +207,24 @@ def _complete_url(request_query_params: dict, litellm_params: dict) -> httpx.URLreturn url-def test_azure_passthrough_url_falls_back_to_the_callers_api_version():+def test_azure_passthrough_url_forwards_the_callers_api_version():url = _complete_url(request_query_params={"api-version": "2025-04-01-preview"}, litellm_params={})assert url.path == "/openai/deployments/gpt-4.1-mini/chat/completions"assert url.params["api-version"] == "2025-04-01-preview"-def test_azure_passthrough_url_prefers_the_deployments_api_version():+def test_azure_passthrough_url_prefers_the_callers_api_version_over_the_deployments():url = _complete_url(request_query_params={"api-version": "2025-04-01-preview"}, litellm_params={"api_version": "2024-10-21"})+ assert url.params["api-version"] == "2025-04-01-preview"+++def test_azure_passthrough_url_fills_in_the_deployments_api_version_when_the_caller_sends_none():+ url = _complete_url(request_query_params={}, litellm_params={"api_version": "2024-10-21"})+assert url.params["api-version"] == "2024-10-21"