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
test(router): cover passthrough stream_timeout without patching proxy globals
clonyluefb2bcd87fae
diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py b/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.pyindex d697a114613..7f8663ea860 100644--- a/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py+++ b/tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py@@ -1167,14 +1167,14 @@ def test_resolve_llm_passthrough_timeout_stream_timeout_precedence():)== 90.0)- with patch("litellm.proxy.proxy_server.general_settings", {}):- assert (- resolve_llm_passthrough_timeout(- litellm_params={"stream_timeout": 1800},- router_stream_timeout=1800,- )- == DEFAULT_PASS_THROUGH_REQUEST_TIMEOUT_SECONDS+ assert (+ resolve_llm_passthrough_timeout(+ litellm_params={"stream_timeout": 1800},+ router_timeout=120,+ router_stream_timeout=1800,)+ == 120.0+ )@pytest.mark.asynciodiff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.pyindex 70ce182c028..4c39f8ba4e4 100644--- a/tests/test_litellm/test_router.py+++ b/tests/test_litellm/test_router.py@@ -5494,6 +5494,7 @@ def test_update_kwargs_with_deployment_passthrough_honors_stream_timeout():"litellm_params": {"model": "anthropic/claude-sonnet-4-5","api_key": "fake-key",+ "timeout": 60,"stream_timeout": 1800,},},@@ -5505,37 +5506,42 @@ def test_update_kwargs_with_deployment_passthrough_honors_stream_timeout():},},],+ timeout=120,stream_timeout=900,)per_deployment, router_default = router.model_list- with patch(- "litellm.proxy.proxy_server.general_settings",- {"pass_through_request_timeout": 6},- ):- kwargs: dict = {"stream": True}- router._update_kwargs_with_deployment(- deployment=per_deployment,- kwargs=kwargs,- function_name="_ageneric_api_call_with_fallbacks",- )- assert kwargs["timeout"] == 1800.0+ kwargs: dict = {"stream": True}+ router._update_kwargs_with_deployment(+ deployment=per_deployment,+ kwargs=kwargs,+ function_name="_ageneric_api_call_with_fallbacks",+ )+ assert kwargs["timeout"] == 1800.0- kwargs = {"stream": True}- router._update_kwargs_with_deployment(- deployment=router_default,- kwargs=kwargs,- function_name="_ageneric_api_call_with_fallbacks",- )- assert kwargs["timeout"] == 900.0+ kwargs = {"stream": True}+ router._update_kwargs_with_deployment(+ deployment=router_default,+ kwargs=kwargs,+ function_name="_ageneric_api_call_with_fallbacks",+ )+ assert kwargs["timeout"] == 900.0- kwargs = {"stream": False}- router._update_kwargs_with_deployment(- deployment=per_deployment,- kwargs=kwargs,- function_name="_ageneric_api_call_with_fallbacks",- )- assert kwargs["timeout"] == 6.0+ kwargs = {"stream": False}+ router._update_kwargs_with_deployment(+ deployment=per_deployment,+ kwargs=kwargs,+ function_name="_ageneric_api_call_with_fallbacks",+ )+ assert kwargs["timeout"] == 60.0++ kwargs = {"stream": False}+ router._update_kwargs_with_deployment(+ deployment=router_default,+ kwargs=kwargs,+ function_name="_ageneric_api_call_with_fallbacks",+ )+ assert kwargs["timeout"] == 120.0@pytest.mark.asyncio