{"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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/images/main.py#L372-L408","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nresp = litellm.image_generation(model=\"stability/stable-image-core\", prompt=\"a cat\")\n# ValueError: image generation config is not supported for stability (on a litellm build lacking the config)\n\n// after\npip install -U litellm\nresp = litellm.image_generation(model=\"stability/stable-image-core\", prompt=\"a cat\")","handlingStrategy":"validation","validationCode":"from litellm.utils import ProviderConfigManager\nfrom litellm import LlmProviders\n\nMODEL, PROVIDER = \"stability/stable-image-core\", \"stability\"\ncfg = ProviderConfigManager.get_provider_image_generation_config(\n    model=MODEL.split(\"/\", 1)[1], provider=LlmProviders(PROVIDER)\n)\nif cfg is None:\n    raise RuntimeError(f\"image generation not wired for {PROVIDER} in litellm {__import__('litellm').__version__}; upgrade litellm\")","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.image_generation(model=model, prompt=prompt)\nexcept ValueError as e:\n    if \"image generation config is not supported\" in str(e):\n        raise RuntimeError(f\"provider config missing for {model}; upgrade litellm or use a supported model\") from e\n    raise","preventionTips":["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."],"tags":["litellm","image-generation","provider","provider-config","registry"],"backgroundTag":"unsupported-provider","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}