mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-08 08:08:37 +00:00
Add an opt-in litellm_params.max_output_tokens_cap (int) per deployment. At deployment time, any caller-requested output budget the request already carries (max_tokens / max_completion_tokens / max_output_tokens) above the cap is lowered to the cap. Smaller budgets are respected and requests without a budget are untouched: a default remains the job of default_litellm_params, which the cap now also bounds. Works for both dict and pydantic deployment params; invalid cap values are ignored. Operators fronting self-hosted OpenAI-compatible engines need a hard output ceiling per deployment to bound queue latency and memory; router defaults only fill in missing parameters, they cannot lower a caller budget. Registers the new param in the proxy credential-registry classification tables (NotSecret), as its guard test requires of every LiteLLM_Params field with a credential-shaped name. Tests: tests/unit/test_router/test_max_output_tokens_cap.py (12 passing). Signed-off-by: Chao Huan <chao.huan@nio.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_enforce_model_rate_limits.py | ||
| test_io_token_rate_limits.py | ||
| test_max_output_tokens_cap.py | ||
| test_router.py | ||
| test_router_callback_hook_sequence.py | ||
| test_router_endpoints.py | ||
| test_router_fallbacks.py | ||
| test_router_get_deployments.py | ||
| test_router_helper_utils.py | ||
| test_router_max_parallel_requests.py | ||
| test_router_provider_endpoints.py | ||
| test_router_retries.py | ||
| test_router_surface_check.py | ||
| test_router_timeout.py | ||
| test_router_vector_store_endpoints.py | ||