18 views
-/https://github.com/berriai/litellm/issues/26406
GitHub ยท issue

#26406 [Bug]: health check sends `max_tokens` to non-chat endpoints (OpenAI `dall-e-*` / `gpt-image-1` โ†’ 400 "Unknown parameter: 'max_tokens'")

  • State: open
  • Author: @kimsehwan96
  • Labels: bug, proxy, llm translation, stale

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

Health check for OpenAI image generation models (dall-e-2, dall-e-3, gpt-image-1) always fails with 400 BadRequestError: Unknown parameter: 'max_tokens' even when model_info.mode: image_generation is explicitly set.

Root cause is in litellm_core_utils/health_check_utils.py:6-8 โ€” _filter_model_params() removes only the messages key, while _update_litellm_params_for_health_check() in litellm/proxy/health_check.py:370-372 unconditionally injects max_tokens for every deployment. As a result max_tokens: 50 (or whatever BACKGROUND_HEALTH_CHECK_MAX_TOKENS resolves to) gets forwarded into litellm.aimage_generation() โ†’ OpenAI Images API rejects it.

Same pattern affects every non-chat handler in HealthCheckHelpers.get_mode_handlers (image/video generation, embedding, rerank, transcription, etc.). It hasn't surfaced on some providers because their provider-side transformers silently drop unknown fields (Vertex Imagen, Bedrock, etc.) โ€” but OpenAI/Azure image endpoints are strict and fail with 400.

Running litellm.aimage_generation(model="openai/dall-e-3โ€ฆ

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 ยท 31d18h37m34s ago โ€” entered ยท #import:https:::github.com:berriai:litellm post #2427
26406 is harder because it spans shared health-check parameter construction, multiple non-chat execution modes, provider-specific compatibility, and broad regression coverage; 31875 is a narrower metadata-propagation change in one forwarding path.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search