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(router): rank litellm_settings.request_timeout on the passthrough route like the completion route
mateo-berrie75ad61fceaf
diff --git a/litellm/router.py b/litellm/router.pyindex a5523d7af79..e3e9454ddce 100644--- a/litellm/router.py+++ b/litellm/router.py@@ -3877,11 +3877,17 @@ class Router:)_router_timeout: Final = (- float(self._explicit_timeout) if isinstance(self._explicit_timeout, (int, float)) else None+ self.request_timeout+ if self.request_timeout is not None+ else float(self._explicit_timeout)+ if isinstance(self._explicit_timeout, (int, float))+ else None)_router_stream_timeout: Final = (self.stream_timeoutif self.stream_timeout is not None+ else self.request_timeout+ if self.request_timeout is not Noneelse self.default_litellm_params.get("stream_timeout"))kwargs["timeout"] = resolve_llm_passthrough_timeout(diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.pyindex e92e5de23dc..148ca0b0ffa 100644--- a/tests/test_litellm/test_router.py+++ b/tests/test_litellm/test_router.py@@ -8230,6 +8230,16 @@ class TestRouterRequestTimeoutPropagation:== 60)+ def test_passthrough_prefers_request_timeout_over_router_timeout(self, explicit_request_timeout):+ router = self._make_router(timeout=330)+ deployment: Final = router.model_list[0]+ assert _passthrough_timeout(router, deployment, stream=False) == 300.0+ assert _passthrough_timeout(router, deployment, stream=True) == 300.0++ def test_passthrough_stream_timeout_still_wins_over_request_timeout(self, explicit_request_timeout):+ router = self._make_router(timeout=330, stream_timeout=45)+ assert _passthrough_timeout(router, router.model_list[0], stream=True) == 45.0+# ---------------------------------------------------------------------------# Deferred-stream eager-fetch tests