BerriAI/litellm · error · ValueError

image generation config is not supported for {custom_llm_pro

Error message

image generation config is not supported for {custom_llm_provider}

What it means

litellm throws this ValueError when image generation is routed to a provider in its handler list (RECRAFT, AIML, GEMINI, FAL_AI, STABILITY, RUNWAYML, VERTEX_AI, OPENROUTER, DASHSCOPE) but ProviderConfigManager.get_provider_image_generation_config() returned None for the given model/provider pair (see litellm/images/main.py:257-262). The config object is mandatory for these providers because it drives auth, api_base resolution, and request transform. Effectively it means 'this provider is routable for images, but no image-generation config was resolved for the model you named'.

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 6c2dcb801b)

Solutions

  1. Check the exact model string against litellm's provider docs (e.g. 'black-forest-labs/flux-pro-1.0', 'gemini/gemini-2.0-flash-exp', 'recraft/recraft-v3') and pass the fully-qualified form
  2. Upgrade litellm to the latest version: pip install -U litellm — new image providers/configs are added frequently
  3. Pass the model explicitly (not None) and let get_llm_provider derive custom_llm_provider from the 'provider/model' prefix instead of supplying custom_llm_provider with a bare model
  4. If the provider genuinely has no image config support, use a supported provider for image generation

Example fix

// before
img = litellm.image_generation(model="flux-pro-1.0", prompt="a cat", custom_llm_provider="fal_ai")

// after
img = litellm.image_generation(model="fal_ai/fml-standard", prompt="a cat")
Defensive patterns

Strategy: validation

Validate before calling

from litellm.types.utils import LITELLM_IMAGE_VARIATION_PROVIDERS  # noqa
from litellm.provider_config_manager import ProviderConfigManager as PCM  # adjust import to your version

def has_image_gen_config(model: str, provider: str) -> bool:
    try:
        cfg = PCM.get_provider_image_generation_config(model=model, provider=provider)
        return cfg is not None
    except Exception:
        return False

assert has_image_gen_config("fal_ai/fml-standard", "fal_ai"), "no image gen config for this model/provider"

Try / catch

try:
    resp = litellm.image_generation(model=m, prompt=p)
except ValueError as e:
    if "image generation config is not supported" in str(e):
        raise UnsupportedImageModel(m) from e
    raise

Prevention

When it happens

Trigger: Calling litellm.image_generation(model=..., custom_llm_provider='gemini'|'recraft'|'fal_ai'|'stability'|'runwayml'|'vertex_ai'|'openrouter'|'dashscope'|'aiml') with a model string that does not resolve to a registered BaseImageGenerationConfig; or omitting/mistyping the model so base_model/model matches nothing in the provider config registry; or hitting a provider whose config class was added to the routing tuple in a newer litellm version than the one installed.

Common situations: Typos in the model name ('flux-pro' vs 'flux-pro-1.0'), using a provider/model combination introduced after your installed litellm release, passing custom_llm_provider explicitly while the model string alone gives the config lookup nothing to match, or calling with model=None.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/aca01bc8276e6336. Report an issue: GitHub.