BerriAI/litellm · error · ValueError
image generation config is not supported for
Error message
image generation config is not supported for {custom_llm_provider} What it means
Raised by litellm's image-generation router when the resolved provider (RECRAFT, AIML, GEMINI, FAL_AI, STABILITY, RUNWAYML, VERTEX_AI, OPENROUTER, DASHSCOPE) is dispatched through the generic HTTP handler but litellm found no registered BaseImageGenerationConfig for it. The config is looked up earlier via ProviderConfigManager.get_provider_image_generation_config (litellm/images/main.py:257-262); a None result means this installed litellm build has no image-generation config class wired for that provider/model combination, so the handler cannot be invoked safely.
Solutions
- Use the exact provider-prefixed model syntax from the litellm image-generation docs for your provider (e.g. 'recraft/recraft-v3', 'gemini/gemini-2.0-flash-exp-image-generation') so get_llm_provider resolves provider and model correctly.
- Upgrade litellm (pip install -U litellm) to a version where the provider's image-generation config is registered in ProviderConfigManager.
- Pre-check support in your installed version: ProviderConfigManager.get_provider_image_generation_config(model, LlmProviders(provider)) must not return None before you route the call.
- If the provider genuinely has no litellm image config in your version, call the provider's native API (or its OpenAI-compatible endpoint with custom_llm_provider='openai' plus api_base) instead.
Example fix
// before resp = litellm.image_generation(model="stability/stable-image-core", prompt="a cat") # ValueError: image generation config is not supported for stability (on a litellm build lacking the config) // after pip install -U litellm resp = litellm.image_generation(model="stability/stable-image-core", prompt="a cat")
Defensive patterns
Strategy: validation
Validate before calling
from litellm.utils import ProviderConfigManager
from litellm import LlmProviders
MODEL, PROVIDER = "stability/stable-image-core", "stability"
cfg = ProviderConfigManager.get_provider_image_generation_config(
model=MODEL.split("/", 1)[1], provider=LlmProviders(PROVIDER)
)
if cfg is None:
raise RuntimeError(f"image generation not wired for {PROVIDER} in litellm {__import__('litellm').__version__}; upgrade litellm") Try / catch
try:
resp = litellm.image_generation(model=model, prompt=prompt)
except ValueError as e:
if "image generation config is not supported" in str(e):
raise RuntimeError(f"provider config missing for {model}; upgrade litellm or use a supported model") from e
raise Prevention
- Always use provider-prefixed model strings exactly as in litellm's image-generation docs.
- Pin a litellm version known to support your image providers and record it in requirements.
- Run the ProviderConfigManager pre-check in a startup smoke test for every image model you route.
- Catch ValueError from image_generation separately from provider HTTP errors so config gaps surface distinctly.
When it happens
Trigger: Calling litellm.image_generation() (or aimg_generation) with custom_llm_provider set to one of the listed providers whose config class is not registered in your litellm version; a provider-prefixed model string (e.g. 'stability/...') that resolves into the tuple but has no registry entry; a typo'd or case-mismatched provider value that still maps into LlmProviders; upgrading the LlmProviders enum (new provider added) while the config mapping lags behind.
Common situations: Using a provider-prefixed image model on an older litellm that predates its image-gen support (e.g. dashscope/openrouter image models); typo in Router model_info litellm_params.custom_llm_provider (e.g. 'Stability' vs 'stability'); a custom fork or pinned litellm version where the enum member exists but ProviderConfigManager was never taught the provider.
Related errors
- image edit is not supported for
- image variation provider has no known model info config -…
- completion_response must be of type ImageResponse for…
- Error parsing OpenRouter response
- Error transforming OpenRouter image generation response
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/aca01bc8276e6336.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/images/main.py:390
headers=headers,
litellm_params=litellm_params_dict,
)
#########################################################
# Providers using llm_http_handler
#########################################################
elif custom_llm_provider in (
litellm.LlmProviders.RECRAFT,
litellm.LlmProviders.AIML,
litellm.LlmProviders.GEMINI,
litellm.LlmProviders.FAL_AI,
litellm.LlmProviders.STABILITY,
litellm.LlmProviders.RUNWAYML,
litellm.LlmProviders.VERTEX_AI,
litellm.LlmProviders.OPENROUTER,
litellm.LlmProviders.DASHSCOPE,
):
if image_generation_config is None:
raise ValueError(f"image generation config is not supported for {custom_llm_provider}")
# Resolve api_base from litellm.api_base if not explicitly provided
_api_base: Final = api_base or litellm.api_base
litellm_params_dict["api_base"] = _api_base
return llm_http_handler.image_generation_handler(
api_key=api_key,
model=model,
prompt=prompt,
image_generation_provider_config=image_generation_config,
image_generation_optional_request_params=optional_params,
custom_llm_provider=custom_llm_provider,
litellm_params=litellm_params_dict,
logging_obj=litellm_logging_obj,
timeout=timeout,
client=client,
)
elif custom_llm_provider == "black_forest_labs":View on GitHub (pinned to 77b7c6c40c)