{"record":{"id":"aca01bc8276e6336","repo":"BerriAI/litellm","slug":"image-generation-config-is-not-supported-for-cust","errorCode":null,"errorMessage":"image generation config is not supported for {custom_llm_provider}","messagePattern":"image generation config is not supported for (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/images/main.py","lineNumber":390,"sourceCode":"                headers=headers,\n                litellm_params=litellm_params_dict,\n            )\n        #########################################################\n        # Providers using llm_http_handler\n        #########################################################\n        elif custom_llm_provider in (\n            litellm.LlmProviders.RECRAFT,\n            litellm.LlmProviders.AIML,\n            litellm.LlmProviders.GEMINI,\n            litellm.LlmProviders.FAL_AI,\n            litellm.LlmProviders.STABILITY,\n            litellm.LlmProviders.RUNWAYML,\n            litellm.LlmProviders.VERTEX_AI,\n            litellm.LlmProviders.OPENROUTER,\n            litellm.LlmProviders.DASHSCOPE,\n        ):\n            if image_generation_config is None:\n                raise ValueError(f\"image generation config is not supported for {custom_llm_provider}\")\n\n            # Resolve api_base from litellm.api_base if not explicitly provided\n            _api_base: Final = api_base or litellm.api_base\n            litellm_params_dict[\"api_base\"] = _api_base\n\n            return llm_http_handler.image_generation_handler(\n                api_key=api_key,\n                model=model,\n                prompt=prompt,\n                image_generation_provider_config=image_generation_config,\n                image_generation_optional_request_params=optional_params,\n                custom_llm_provider=custom_llm_provider,\n                litellm_params=litellm_params_dict,\n                logging_obj=litellm_logging_obj,\n                timeout=timeout,\n                client=client,\n            )\n        elif custom_llm_provider == \"black_forest_labs\":","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/images/main.py#L372-L408","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","Upgrade litellm to the latest version: pip install -U litellm — new image providers/configs are added frequently","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","If the provider genuinely has no image config support, use a supported provider for image generation"],"exampleFix":"// before\nimg = litellm.image_generation(model=\"flux-pro-1.0\", prompt=\"a cat\", custom_llm_provider=\"fal_ai\")\n\n// after\nimg = litellm.image_generation(model=\"fal_ai/fml-standard\", prompt=\"a cat\")","handlingStrategy":"validation","validationCode":"from litellm.types.utils import LITELLM_IMAGE_VARIATION_PROVIDERS  # noqa\nfrom litellm.provider_config_manager import ProviderConfigManager as PCM  # adjust import to your version\n\ndef has_image_gen_config(model: str, provider: str) -> bool:\n    try:\n        cfg = PCM.get_provider_image_generation_config(model=model, provider=provider)\n        return cfg is not None\n    except Exception:\n        return False\n\nassert has_image_gen_config(\"fal_ai/fml-standard\", \"fal_ai\"), \"no image gen config for this model/provider\"","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.image_generation(model=m, prompt=p)\nexcept ValueError as e:\n    if \"image generation config is not supported\" in str(e):\n        raise UnsupportedImageModel(m) from e\n    raise","preventionTips":["Always pass fully-qualified model strings ('provider/model') for image generation","Pin and regularly upgrade litellm — image provider coverage changes per release","Wrap model choice in a small allowlist validated at app startup"],"tags":["image-generation","provider-config","validation","litellm"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}