From 18564992a300e25b4f965ecbfaf705b9903b1a80 Mon Sep 17 00:00:00 2001 From: Hannah Smith <64043506+hannahmadison@users.noreply.github.com> Date: Thu, 18 Jun 2026 08:06:18 -0400 Subject: [PATCH] fix: increase health check max_tokens from 5 to 16 (#23836) (#26610) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GPT-5 models enforce a minimum of 16 for max_output_tokens. The current default of 5 still causes health checks to fail for these models. Bump the non-wildcard default to 16 — the smallest value that satisfies all known provider minimums while keeping health checks lightweight. Also tightens the wildcard test assertion from a weak disjunctive check to strict key-absence. Co-authored-by: Sameer Kankute --- litellm/proxy/health_check.py | 4 ++-- tests/test_litellm/proxy/test_health_check_max_tokens.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/health_check.py b/litellm/proxy/health_check.py index 652800b4aef..488467e1b99 100644 --- a/litellm/proxy/health_check.py +++ b/litellm/proxy/health_check.py @@ -401,7 +401,7 @@ def _resolve_health_check_max_tokens( 3. For non-wildcard reasoning routes: BACKGROUND_HEALTH_CHECK_MAX_TOKENS_REASONING from env (if set) 4. BACKGROUND_HEALTH_CHECK_MAX_TOKENS (global, any route including wildcards) - 5. Non-wildcard default: 5 + 5. Non-wildcard default: 16 6. Wildcard and nothing from (1)(4): leave unset (caller omits max_tokens) """ explicit = model_info.get("health_check_max_tokens", None) @@ -432,7 +432,7 @@ def _resolve_health_check_max_tokens( return int(BACKGROUND_HEALTH_CHECK_MAX_TOKENS) if not is_wildcard: - return 16 # OpenAI GPT-5 models require max_output_tokens >= 16 + return 16 return None diff --git a/tests/test_litellm/proxy/test_health_check_max_tokens.py b/tests/test_litellm/proxy/test_health_check_max_tokens.py index db82f11c5cc..e56eb9bfdd6 100644 --- a/tests/test_litellm/proxy/test_health_check_max_tokens.py +++ b/tests/test_litellm/proxy/test_health_check_max_tokens.py @@ -49,8 +49,7 @@ async def test_update_litellm_params_max_tokens_wildcard(): updated_params = _update_litellm_params_for_health_check(model_info, litellm_params) - # Should not be set to 1 - assert "max_tokens" not in updated_params or updated_params["max_tokens"] != 1 + assert "max_tokens" not in updated_params @pytest.mark.asyncio