fix(router): stop ttft_timeout/stream_idle_timeout leaking to provider API

When set in a deployment's litellm_params, ttft_timeout and stream_idle_timeout were
assembled into input_kwargs and forwarded to litellm.acompletion. Because neither key
was in all_litellm_params, the provider param filtering treated them as model-specific
extras and passed them to the upstream API, which 400s on unknown fields; this broke the
exact per-deployment configuration the feature documents.

Add both keys to all_litellm_params alongside stream_timeout so filter_out_litellm_params
strips them before the provider call, while the router still resolves their values from
litellm_params. Regression test asserts they are filtered out while genuine provider
params (temperature) are kept.
This commit is contained in:
Nathan Price 2026-06-16 07:28:01 -05:00
parent 15bd7fb804
commit f45f71b2d3
2 changed files with 22 additions and 0 deletions

View file

@ -3196,6 +3196,8 @@ all_litellm_params = (
"no-log",
"base_model",
"stream_timeout",
"ttft_timeout",
"stream_idle_timeout",
"supports_system_message",
"region_name",
"allowed_model_region",

View file

@ -34,3 +34,23 @@ def test_filter_out_litellm_params():
assert "litellm_trace_id" not in filtered
assert "proxy_server_request" not in filtered
assert "secret_fields" not in filtered
def test_filter_out_router_timeout_params_not_forwarded_to_provider():
"""ttft_timeout / stream_idle_timeout are router-internal params; they must be filtered
out so they are never forwarded to the upstream provider API (where they would 400),
while genuine provider params are kept. Regression for the params leaking via
per-deployment litellm_params."""
kwargs = {
"ttft_timeout": 8.0,
"stream_idle_timeout": 30.0,
"stream_timeout": 60.0,
"temperature": 0.5,
}
filtered = filter_out_litellm_params(kwargs=kwargs)
assert "ttft_timeout" not in filtered
assert "stream_idle_timeout" not in filtered
assert "stream_timeout" not in filtered
assert filtered["temperature"] == 0.5