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]

feat(passthrough): add configurable pass-through request timeouts (#30266)

Sameer Kankutee8e5b47fc2a5
diff --git a/litellm/passthrough/main.py b/litellm/passthrough/main.py
index c4c9aea6f64..3e60988b9e7 100644
--- a/litellm/passthrough/main.py
+++ b/litellm/passthrough/main.py
@@ -20,7 +20,6 @@ from typing import (
import httpx
from httpx._types import CookieTypes, QueryParamTypes, RequestFiles
-import litellm
from litellm._logging import verbose_logger
from litellm.litellm_core_utils.get_llm_provider_logic import get_llm_provider
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
@@ -201,12 +200,6 @@ def llm_passthrough_route(
_is_async = allm_passthrough_route
- if client is None:
- if _is_async:
- client = litellm.module_level_aclient
- else:
- client = litellm.module_level_client
-
litellm_logging_obj = cast("LiteLLMLoggingObj", kwargs.get("litellm_logging_obj"))
model, custom_llm_provider, api_key, api_base = get_llm_provider(
@@ -218,6 +211,26 @@ def llm_passthrough_route(
litellm_params_dict = get_litellm_params(**kwargs)
+ if client is None:
+ from litellm.llms.custom_httpx.http_handler import (
+ _get_httpx_client,
+ get_async_httpx_client,
+ )
+ from litellm.passthrough.timeout_utils import resolve_llm_passthrough_timeout
+ from litellm.types.llms.custom_http import httpxSpecialProvider
+
+ resolved_timeout = resolve_llm_passthrough_timeout(
+ kwargs=kwargs,
+ litellm_params=litellm_params_dict,
+ )
+ if _is_async:
+ client = get_async_httpx_client(
+ llm_provider=httpxSpecialProvider.PassThroughEndpoint,
+ params={"timeout": resolved_timeout},
+ )
+ else:
+ client = _get_httpx_client(params={"timeout": resolved_timeout})
+
# Add model_id to litellm_params if present in kwargs (for Bedrock Application Inference Profiles)
if "model_id" in kwargs:
litellm_params_dict["model_id"] = kwargs["model_id"]
diff --git a/litellm/passthrough/timeout_utils.py b/litellm/passthrough/timeout_utils.py
new file mode 100644
index 00000000000..a423db2aa91
--- /dev/null
+++ b/litellm/passthrough/timeout_utils.py
@@ -0,0 +1,58 @@
+import sys
+from typing import Optional
+
+DEFAULT_PASS_THROUGH_REQUEST_TIMEOUT_SECONDS = 600.0
+
+
+def resolve_pass_through_request_timeout(
+ endpoint_timeout: Optional[float] = None,
+) -> float:
+ """
+ Resolve the upstream httpx timeout for pass_through_request.
+
+ Precedence: per-endpoint timeout -> general_settings.pass_through_request_timeout -> 600s default.
+
+ Uses sys.modules to read general_settings only when the proxy module is already
+ loaded, avoiding a fastapi transitive import in pure SDK contexts.
+ """
+ if endpoint_timeout is not None:
+ return float(endpoint_timeout)
+
+ try:
+ proxy_server = sys.modules.get("litellm.proxy.proxy_server")
+ if proxy_server is not None:
+ global_timeout = getattr(proxy_server, "general_settings", {}).get(
+ "pass_through_request_timeout"
+ )
+ if global_timeout is not None:
+ return float(global_timeout)
+ except Exception:
+ pass
+
+ return DEFAULT_PASS_THROUGH_REQUEST_TIMEOUT_SECONDS
+
+
+def resolve_llm_passthrough_timeout(
+ kwargs: Optional[dict] = None,
+ litellm_params: Optional[dict] = None,
+ router_timeout: Optional[float] = None,
+) -> float:
+ """
+ Resolve upstream httpx timeout for SDK native passthrough (e.g. Bedrock /converse).
+
+ Precedence: kwargs timeout/request_timeout -> litellm_params timeout/request_timeout
+ -> router_timeout -> general_settings.pass_through_request_timeout -> 600s default.
+ """
+ kwargs = kwargs or {}
+ litellm_params = litellm_params or {}
+
+ for source in (kwargs, litellm_params):
+ for key in ("timeout", "request_timeout"):
+ val = source.get(key)
+ if val is not None:
+ return float(val)
+
+ if router_timeout is not None:
+ return float(router_timeout)
+
+ return resolve_pass_through_request_timeout()
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py
index a9b8319745c..e6ffe71a971 100644
--- a/litellm/proxy/_types.py
+++ b/litellm/proxy/_types.py
@@ -2049,6 +2049,10 @@ class PassThroughGenericEndpoint(LiteLLMPydanticObjectBase):
default=0.0,
description="The USD cost per request to the target endpoint. This is used to calculate the cost of the request to the target endpoint.",
)
+ timeout: Optional[float] = Field(
+ default=None,
+ description="Upstream request timeout in seconds for this pass-through endpoint. If unset, uses general_settings.pass_through_request_timeout (default 600).",
+ )
auth: bool = Field(
default=True,
description="Whether authentication is required for the pass-through endpoint. Defaults to True so a pass-through silently created without an explicit value still requires a valid LiteLLM API key — set to False only if the endpoint is meant to be a public forwarder (e.g. an unauthenticated webhook target).",
@@ -2278,6 +2282,10 @@ class ConfigGeneralSettings(LiteLLMPydanticObjectBase):
default=False,
description="Public model hub for users to see what models they have access to, supported openai params, etc.",
)
+ pass_through_request_timeout: Optional[float] = Field(
+ default=None,
+ description="Default upstream request timeout in seconds for native and custom pass-through endpoints that use pass_through_request. Defaults to 600 when unset.",
+ )
pass_through_endpoints: Optional[List[PassThroughGenericEndpoint]] = Field(
default=None,
description="Set-up pass-through endpoints for provider-specific endpoints. Docs - https://docs.litellm.ai/docs/proxy/pass_through",
diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
index 04c9256fdf8..e3cb9dec884 100644
--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
@@ -694,6 +694,13 @@ def _carry_guardrail_logging_info(
metadata.setdefault("standard_logging_guardrail_information", list(entries))
+from litellm.passthrough.timeout_utils import (
+ DEFAULT_PASS_THROUGH_REQUEST_TIMEOUT_SECONDS, # noqa: F401 - re-exported for backward compat
+ resolve_llm_passthrough_timeout, # noqa: F401 - re-exported for backward compat
+ resolve_pass_through_request_timeout,
+)
+
+
async def pass_through_request( # noqa: PLR0915
request: Request,
target: str,
@@ -708,6 +715,7 @@ async def pass_through_request( # noqa: PLR0915
cost_per_request: Optional[float] = None,
custom_llm_provider: Optional[str] = None,
guardrails_config: Optional[dict] = None,
+ timeout: Optional[float] = None,
):
"""
Pass through endpoint handler, makes the httpx request for pass-through endpoints and ensures logging hooks are called
@@ -726,6 +734,8 @@ async def pass_through_request( # noqa: PLR0915
cost_per_request: Optional field - cost per request to the target endpoint
custom_llm_provider: Optional field - custom LLM provider for the endpoint
guardrails_config: Optional field - guardrails configuration for passthrough endpoint
+ timeout: Optional per-endpoint timeout in seconds. Falls back to
+ general_settings.pass_through_request_timeout, then 600s.
"""
from litellm.exceptions import ModifyResponseException
from litellm.litellm_core_utils.litellm_logging import Logging
@@ -865,9 +875,10 @@ async def pass_through_request( # noqa: PLR0915
data=_parsed_body,
call_type="pass_through_endpoint",
)
+ resolved_timeout = resolve_pass_through_request_timeout(timeout)
async_client_obj = get_async_httpx_client(
llm_provider=httpxSpecialProvider.PassThroughEndpoint,
- params={"timeout": 600},
+ params={"timeout": resolved_timeout},
)
async_client = async_client_obj.client
passthrough_logging_payload = PassthroughStandardLoggingPayload(
@@ -1529,7 +1540,7 @@ async def _parse_request_data_by_content_type(
return query_params_data, custom_body_data, file_data, stream
-def create_pass_through_route(
+def create_pass_through_route( # noqa: PLR0915
endpoint,
target: str,
custom_headers: Optional[Mapping[str, Any]] = None,
@@ -1544,6 +1555,7 @@ def create_pass_through_route(
default_query_params: Optional[dict] = None,
guardrails: Optional[Dict[str, Any]] = None,
config_file_path: Optional[str] = None,
+ timeout: Optional[float] = None,
):
# check if target is an adapter.py or a url
from litellm._uuid import uuid
@@ -1627,6 +1639,7 @@ def create_pass_through_route(
"merge_query_params": _merge_query_params,
"cost_per_request": cost_per_request,
"guardrails": None,
+ "timeout": timeout,
}
if passthrough_params is not None:
@@ -1646,6 +1659,7 @@ def create_pass_through_route(
)
param_guardrails = target_params.get("guardrails", None)
param_default_query_params = target_params.get("default_query_params", None)
+ param_timeout = target_params.get("timeout", timeout)
# Construct the full target URL with subpath if needed
full_target = (
@@ -1700,6 +1714,7 @@ def create_pass_through_route(
cost_per_request=cast(Optional[float], param_cost_per_request),
custom_llm_provider=custom_llm_provider,
guardrails_config=cast(Optional[dict], param_guardrails),
+ timeout=cast(Optional[float], param_timeout),
)
finally:
if hasattr(request.state, LITELLM_PASS_THROUGH_CUSTOM_BODY_STATE_KEY):
@@ -2348,6 +2363,7 @@ class InitPassThroughEndpointHelpers:
default_query_params: Optional[dict] = None,
config_file_path: Optional[str] = None,
auth: bool = False,
+ timeout: Optional[float] = None,
):
"""Add exact path route for pass-through endpoint"""
# Default to all methods if none specified (backward compatibility)
@@ -2388,6 +2404,7 @@ class InitPassThroughEndpointHelpers:
default_query_params=default_query_params,
guardrails=guardrails,
config_file_path=config_file_path,
+ timeout=timeout,
),
methods=methods,
dependencies=dependencies,
@@ -2409,6 +2426,7 @@ class InitPassThroughEndpointHelpers:
"dependencies": dependencies,
"cost_per_request": cost_per_request,
"guardrails": guardrails,
+ "timeout": timeout,
},
}
@@ -2428,6 +2446,7 @@ class InitPassThroughEndpointHelpers:
default_query_params: Optional[dict] = None,
config_file_path: Optional[str] = None,
auth: bool = False,
+ timeout: Optional[float] = None,
):
"""Add wildcard route for sub-paths"""
# Default to all methods if none specified (backward compatibility)
@@ -2469,6 +2488,7 @@ class InitPassThroughEndpointHelpers:
default_query_params=default_query_params,
guardrails=guardrails,
config_file_path=config_file_path,
+ timeout=timeout,
),
methods=methods,
dependencies=dependencies,
@@ -2490,6 +2510,7 @@ class InitPassThroughEndpointHelpers:
"dependencies": dependencies,
"cost_per_request": cost_per_request,
"guardrails": guardrails,
+ "timeout": timeout,
},
}
@@ -2683,6 +2704,7 @@ async def _register_pass_through_endpoint(
guardrails = endpoint_data.get("guardrails")
methods = endpoint_data.get("methods")
cost_per_request = endpoint_data.get("cost_per_request")
+ timeout = endpoint_data.get("timeout")
verbose_proxy_logger.debug(
"Initializing pass through endpoint: %s (ID: %s)", path, endpoint_id
@@ -2702,6 +2724,7 @@ async def _register_pass_through_endpoint(
default_query_params=default_query_params,
config_file_path=config_file_path,
auth=auth_enforced,
+ timeout=timeout,
)
methods_for_key = methods if methods else ["GET", "POST", "PUT", "DELETE", "PATCH"]
@@ -2728,6 +2751,7 @@ async def _register_pass_through_endpoint(
default_query_params=default_query_params,
config_file_path=config_file_path,
auth=auth_enforced,
+ timeout=timeout,
)
visited_endpoints.add(f"{endpoint_id}:subpath:{path}:{methods_str}")
@@ -3111,6 +3135,7 @@ async def update_pass_through_endpoints(
methods=updated_endpoint.methods,
default_query_params=updated_endpoint.default_query_params,
auth=updated_endpoint.auth,
+ timeout=updated_endpoint.timeout,
)
else:
InitPassThroughEndpointHelpers.add_exact_path_route(
@@ -3127,6 +3152,7 @@ async def update_pass_through_endpoints(
methods=updated_endpoint.methods,
default_query_params=updated_endpoint.default_query_params,
auth=updated_endpoint.auth,
+ timeout=updated_endpoint.timeout,
)
return PassThroughEndpointResponse(
@@ -3206,6 +3232,7 @@ async def create_pass_through_endpoints(
methods=created_endpoint.methods,
default_query_params=created_endpoint.default_query_params,
auth=created_endpoint.auth,
+ timeout=created_endpoint.timeout,
)
else:
InitPassThroughEndpointHelpers.add_exact_path_route(
@@ -3222,6 +3249,7 @@ async def create_pass_through_endpoints(
methods=created_endpoint.methods,
default_query_params=created_endpoint.default_query_params,
auth=created_endpoint.auth,
+ timeout=created_endpoint.timeout,
)
return PassThroughEndpointResponse(endpoints=[created_endpoint])
diff --git a/litellm/router.py b/litellm/router.py
index 9d614dd21e2..34f67c11873 100644
--- a/litellm/router.py
+++ b/litellm/router.py
@@ -562,6 +562,7 @@ class Router:
else:
self.max_fallbacks = litellm.ROUTER_MAX_FALLBACKS
+ self._explicit_timeout = timeout # None when user did not pass timeout
self.timeout = timeout or litellm.request_timeout
self.stream_timeout = stream_timeout
@@ -3225,9 +3226,25 @@ class Router:
kwargs["model_info"] = model_info
- kwargs["timeout"] = self._get_timeout(
- kwargs=kwargs, data=deployment["litellm_params"]
- )
+ if function_name == "_ageneric_api_call_with_fallbacks":
+ from litellm.passthrough.timeout_utils import (
+ resolve_llm_passthrough_timeout,
+ )
+
+ _router_timeout = (
+ float(self._explicit_timeout)
+ if isinstance(self._explicit_timeout, (int, float))
+ else None
+ )
+ kwargs["timeout"] = resolve_llm_passthrough_timeout(
+ kwargs=kwargs,
+ litellm_params=deployment["litellm_params"],
+ router_timeout=_router_timeout,
+ )
+ else:
+ kwargs["timeout"] = self._get_timeout(
+ kwargs=kwargs, data=deployment["litellm_params"]
+ )
self._update_kwargs_with_default_litellm_params(
kwargs=kwargs, metadata_variable_name=metadata_variable_name
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.py
index 31f1c1c57d6..2e4b7f9ae74 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
@@ -16,9 +16,13 @@ sys.path.insert(
) # Adds the parent directory to the system path
from litellm.proxy.pass_through_endpoints.pass_through_endpoints import (
+ DEFAULT_PASS_THROUGH_REQUEST_TIMEOUT_SECONDS,
HttpPassThroughEndpointHelpers,
LITELLM_PASS_THROUGH_CUSTOM_BODY_STATE_KEY,
+ create_pass_through_route,
pass_through_request,
+ resolve_pass_through_request_timeout,
+ resolve_llm_passthrough_timeout,
)
from litellm.types.passthrough_endpoints.pass_through_endpoints import (
LITELLM_PASS_THROUGH_RAW_BODY_STATE_KEY,
@@ -871,6 +875,131 @@ async def test_create_pass_through_route_with_cost_per_request():
assert call_kwargs["cost_per_request"] == 3.75
+def test_resolve_pass_through_request_timeout_precedence():
+ assert resolve_pass_through_request_timeout(endpoint_timeout=900) == 900.0
+
+ with patch(
+ "litellm.proxy.proxy_server.general_settings",
+ {"pass_through_request_timeout": 1200},
+ ):
+ assert resolve_pass_through_request_timeout() == 1200.0
+ assert resolve_pass_through_request_timeout(endpoint_timeout=800) == 800.0
+
+ with patch("litellm.proxy.proxy_server.general_settings", {}):
+ assert (
+ resolve_pass_through_request_timeout()
+ == DEFAULT_PASS_THROUGH_REQUEST_TIMEOUT_SECONDS
+ )
+
+
+def test_resolve_llm_passthrough_timeout_precedence():
+ assert resolve_llm_passthrough_timeout(kwargs={"timeout": 45}) == 45.0
+ assert (
+ resolve_llm_passthrough_timeout(
+ kwargs={"request_timeout": 30},
+ litellm_params={"timeout": 60},
+ )
+ == 30.0
+ )
+ assert (
+ resolve_llm_passthrough_timeout(
+ litellm_params={"timeout": 90},
+ )
+ == 90.0
+ )
+
+ with patch(
+ "litellm.proxy.proxy_server.general_settings",
+ {"pass_through_request_timeout": 6},
+ ):
+ assert resolve_llm_passthrough_timeout() == 6.0
+
+
+async def test_pass_through_request_uses_resolved_timeout():
+ with patch("litellm.proxy.proxy_server.proxy_logging_obj") as mock_proxy_logging:
+ with patch(
+ "litellm.proxy.pass_through_endpoints.pass_through_endpoints.get_async_httpx_client"
+ ) as mock_get_client:
+ mock_proxy_logging.pre_call_hook = AsyncMock(
+ side_effect=lambda **kwargs: kwargs["data"]
+ )
+
+ mock_client = MagicMock()
+ mock_client.client = MagicMock()
+ mock_client.client.request = AsyncMock(
+ side_effect=httpx.HTTPError("Request failed")
+ )
+ mock_get_client.return_value = mock_client
+
+ mock_request = MagicMock(spec=Request)
+ mock_request.method = "POST"
+ mock_request.body = AsyncMock(return_value=b'{"test": "data"}')
+ mock_request.headers = Headers({})
+ mock_request.query_params = QueryParams({})
+
+ mock_user_api_key_dict = MagicMock()
+
+ with pytest.raises(Exception):
+ await pass_through_request(
+ request=mock_request,
+ target="http://test.com",
+ custom_headers={},
+ user_api_key_dict=mock_user_api_key_dict,
+ timeout=1500,
+ )
+
+ mock_get_client.assert_called_once()
+ assert mock_get_client.call_args[1]["params"]["timeout"] == 1500
+
+
+async def test_create_pass_through_route_forwards_timeout():
+ unique_path = "/test/path/unique/timeout"
+ endpoint_func = create_pass_through_route(
+ endpoint=unique_path,
+ target="http://example.com",
+ custom_headers={},
+ _forward_headers=True,
+ _merge_query_params=False,
+ dependencies=[],
+ timeout=1800,
+ )
+
+ with (
+ patch(
+ "litellm.proxy.pass_through_endpoints.pass_through_endpoints.pass_through_request"
+ ) as mock_pass_through,
+ patch(
+ "litellm.proxy.pass_through_endpoints.pass_through_endpoints.InitPassThroughEndpointHelpers.is_registered_pass_through_route"
+ ) as mock_is_registered,
+ patch(
+ "litellm.proxy.pass_through_endpoints.pass_through_endpoints.InitPassThroughEndpointHelpers.get_registered_pass_through_route"
+ ) as mock_get_registered,
+ ):
+ mock_pass_through.return_value = MagicMock()
+ mock_is_registered.return_value = True
+ mock_get_registered.return_value = None
+
+ mock_request = MagicMock(spec=Request)
+ mock_request.url = MagicMock()
+ mock_request.url.path = unique_path
+ mock_request.path_params = {}
+ mock_request.query_params = QueryParams({})
+
+ mock_user_api_key_dict = MagicMock()
+ mock_user_api_key_dict.api_key = "test-key"
+
+ await endpoint_func(
+ request=mock_request,
+ user_api_key_dict=mock_user_api_key_dict,
+ fastapi_response=MagicMock(),
+ )
+
+ call_kwargs = mock_pass_through.call_args[1]
+ assert call_kwargs["timeout"] == 1800
+
+
def test_initialize_pass_through_endpoints_with_cost_per_request():
"""
Test that initialize_pass_through_endpoints correctly passes cost_per_request to route creation
diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.py
index bd19f951553..830edf6412d 100644
--- a/tests/test_litellm/test_router.py
+++ b/tests/test_litellm/test_router.py
@@ -213,9 +213,10 @@ async def test_encrypted_content_affinity_model_group_config_is_additive():
)
assert unfiltered == healthy_deployments
- assert "encrypted_content_affinity_enabled" not in disabled_request_kwargs[
- "litellm_metadata"
- ]
+ assert (
+ "encrypted_content_affinity_enabled"
+ not in disabled_request_kwargs["litellm_metadata"]
+ )
global_check = EncryptedContentAffinityCheck(
enable_global_affinity=True,
@@ -1265,10 +1266,16 @@ async def test_ageneric_api_call_deployment_model_overrides_alias():
# calling the helper through async_function_with_fallbacks).
kwargs["model"] = "not-gemini-2.5-flash"
- with patch.object(router, "async_get_available_deployment") as mock_dep, \
- patch.object(router, "_update_kwargs_with_deployment", side_effect=inject_alias_into_kwargs), \
- patch.object(router, "async_routing_strategy_pre_call_checks"), \
- patch.object(router, "_get_client", return_value=None):
+ with (
+ patch.object(router, "async_get_available_deployment") as mock_dep,
+ patch.object(
+ router,
+ "_update_kwargs_with_deployment",
+ side_effect=inject_alias_into_kwargs,
+ ),
+ patch.object(router, "async_routing_strategy_pre_call_checks"),
+ patch.object(router, "_get_client", return_value=None),
+ ):
mock_dep.return_value = {
"model_name": "not-gemini-2.5-flash",
"litellm_params": {
@@ -1282,9 +1289,9 @@ async def test_ageneric_api_call_deployment_model_overrides_alias():
original_generic_function=capture_model,
)
- assert captured["model"] == "vertex_ai/gemini-2.5-flash", (
- f"Expected deployment model 'vertex_ai/gemini-2.5-flash', got '{captured['model']}'"
- )
+ assert (
+ captured["model"] == "vertex_ai/gemini-2.5-flash"
+ ), f"Expected deployment model 'vertex_ai/gemini-2.5-flash', got '{captured['model']}'"
def test_router_get_model_access_groups_team_only_models():
@@ -2920,6 +2927,33 @@ def test_add_deployment_model_to_endpoint_for_llm_passthrough_route():
), f"Expected '/model/us.meta.llama3-8b-instruct-v1:0/invoke', got '{result['endpoint']}'"
+def test_update_kwargs_with_deployment_uses_pass_through_request_timeout():
+ router = litellm.Router(
+ model_list=[
+ {
+ "model_name": "my-bedrock-model",
+ "litellm_params": {
+ "model": "bedrock/us.anthropic.claude-opus-4-5-20251101-v1:0",
+ },
+ }
+ ],
+ )
+ deployment = router.model_list[0]
+ kwargs: dict = {}
+
+ with patch(
+ "litellm.proxy.proxy_server.general_settings",
+ {"pass_through_request_timeout": 6},
+ ):
+ router._update_kwargs_with_deployment(
+ deployment=deployment,
+ kwargs=kwargs,
+ function_name="_ageneric_api_call_with_fallbacks",
+ )
+
+ assert kwargs["timeout"] == 6.0
+
+
@pytest.mark.asyncio
async def test_router_acompletion_with_unknown_model_and_default_fallback():
"""
diff --git a/ui/litellm-dashboard/src/components/add_pass_through.tsx b/ui/litellm-dashboard/src/components/add_pass_through.tsx
index 18621b99c54..505c023000e 100644
--- a/ui/litellm-dashboard/src/components/add_pass_through.tsx
+++ b/ui/litellm-dashboard/src/components/add_pass_through.tsx
@@ -326,6 +326,31 @@ const AddPassThroughEndpoint: React.FC<AddFallbacksProps> = ({
{/* Guardrails Section */}
<PassThroughGuardrailsSection accessToken={accessToken} value={guardrails} onChange={setGuardrails} />
+ {/* Performance Section */}
+ <Card className="p-6">
+ <Title className="text-lg font-semibold text-gray-900 mb-2">Performance</Title>
+ <Subtitle className="text-gray-600 mb-6">Configure upstream request timeout for this endpoint</Subtitle>
+
+ <Form.Item
+ label={
+ <span className="text-sm font-medium text-gray-700 flex items-center">
+ Request Timeout (seconds)
+ <Tooltip title="Max time to wait for the upstream API to respond. Leave empty to use general_settings.pass_through_request_timeout (default 600s).">
+ <InfoCircleOutlined className="ml-2 text-gray-400 hover:text-gray-600" />
+ </Tooltip>
+ </span>
+ }
+ name="timeout"
+ extra={
+ <div className="text-xs text-gray-500 mt-2">
+ Use a higher value for slow upstream APIs (e.g. 1200 for long-running LLM calls)
+ </div>
+ }
+ >
+ <NumericalInput min={1} step={1} precision={0} placeholder="600" size="large" />
+ </Form.Item>
+ </Card>
+
{/* Billing Section */}
<Card className="p-6">
<Title className="text-lg font-semibold text-gray-900 mb-2">Billing</Title>
diff --git a/ui/litellm-dashboard/src/components/pass_through_info.tsx b/ui/litellm-dashboard/src/components/pass_through_info.tsx
index d57ea8a6f6f..172e751dd1f 100644
--- a/ui/litellm-dashboard/src/components/pass_through_info.tsx
+++ b/ui/litellm-dashboard/src/components/pass_through_info.tsx
@@ -40,6 +40,7 @@ interface PassThroughEndpoint {
headers: Record<string, any>;
include_subpath?: boolean;
cost_per_request?: number;
+ timeout?: number;
auth?: boolean;
methods?: string[];
guardrails?: Record<string, { request_fields?: string[]; response_fields?: string[] } | null>;
@@ -101,6 +102,7 @@ const PassThroughInfoView: React.FC<PassThroughInfoProps> = ({
headers: headers,
include_subpath: values.include_subpath,
cost_per_request: values.cost_per_request,
+ timeout: values.timeout,
auth: premiumUser ? values.auth : undefined,
methods: selectedMethods && selectedMethods.length > 0 ? selectedMethods : undefined,
guardrails: guardrails && Object.keys(guardrails).length > 0 ? guardrails : undefined,
@@ -297,6 +299,7 @@ const PassThroughInfoView: React.FC<PassThroughInfoProps> = ({
headers: endpointData.headers ? JSON.stringify(endpointData.headers, null, 2) : "",
include_subpath: endpointData.include_subpath || false,
cost_per_request: endpointData.cost_per_request,
+ timeout: endpointData.timeout,
auth: endpointData.auth || false,
methods: endpointData.methods || [],
}}
@@ -350,6 +353,14 @@ const PassThroughInfoView: React.FC<PassThroughInfoProps> = ({
<InputNumber min={0} step={0.01} precision={2} placeholder="0.00" addonBefore="$" />
</Form.Item>
+ <Form.Item
+ label="Request Timeout (seconds)"
+ name="timeout"
+ extra="Max time to wait for upstream response. Leave empty to use the global pass_through_request_timeout (default 600s)."
+ >
+ <InputNumber min={1} step={1} precision={0} placeholder="600" style={{ width: "100%" }} />
+ </Form.Item>
+
<PassThroughSecuritySection
premiumUser={premiumUser}
authEnabled={authEnabled}
@@ -394,6 +405,12 @@ const PassThroughInfoView: React.FC<PassThroughInfoProps> = ({
<div>${endpointData.cost_per_request}</div>
</div>
)}
+ {endpointData.timeout !== undefined && endpointData.timeout !== null && (
+ <div>
+ <Text className="font-medium">Request Timeout</Text>
+ <div>{endpointData.timeout}s</div>
+ </div>
+ )}
<div>
<Text className="font-medium">Authentication Required</Text>
<Badge color={endpointData.auth ? "green" : "gray"}>{endpointData.auth ? "Yes" : "No"}</Badge>
diff --git a/ui/litellm-dashboard/src/components/pass_through_settings.tsx b/ui/litellm-dashboard/src/components/pass_through_settings.tsx
index 3d53de70727..66b41f092c5 100644
--- a/ui/litellm-dashboard/src/components/pass_through_settings.tsx
+++ b/ui/litellm-dashboard/src/components/pass_through_settings.tsx
@@ -38,6 +38,7 @@ export interface passThroughItem {
headers: object;
include_subpath?: boolean;
cost_per_request?: number;
+ timeout?: number;
auth?: boolean;
methods?: string[];
guardrails?: Record<string, { request_fields?: string[]; response_fields?: string[] } | null>;
diff --git a/ui/litellm-dashboard/src/lib/http/schema.d.ts b/ui/litellm-dashboard/src/lib/http/schema.d.ts
index 3786b6e728b..4797e41a62b 100644
--- a/ui/litellm-dashboard/src/lib/http/schema.d.ts
+++ b/ui/litellm-dashboard/src/lib/http/schema.d.ts
@@ -22203,6 +22203,11 @@ export interface components {
* @description Set-up pass-through endpoints for provider-specific endpoints. Docs - https://docs.litellm.ai/docs/proxy/pass_through
*/
pass_through_endpoints?: components["schemas"]["PassThroughGenericEndpoint"][] | null;
+ /**
+ * Pass Through Request Timeout
+ * @description Default upstream request timeout in seconds for native and custom pass-through endpoints that use pass_through_request. Defaults to 600 when unset.
+ */
+ pass_through_request_timeout?: number | null;
/**
* Reject Clientside Metadata Tags
* @description When set to True, rejects requests that contain client-side 'metadata.tags' to prevent users from influencing budgets by sending different tags. Tags can only be inherited from the API key metadata.
@@ -27993,6 +27998,11 @@ export interface components {
* @description The URL to which requests for this path should be forwarded.
*/
target: string;
+ /**
+ * Timeout
+ * @description Upstream request timeout in seconds for this pass-through endpoint. If unset, uses general_settings.pass_through_request_timeout (default 600).
+ */
+ timeout?: number | null;
};
/**
* PassThroughGuardrailSettings