{"record":{"id":"2a695c5b9ff8538a","repo":"BerriAI/litellm","slug":"image-variation-provider-not-found-custom-llm-pr-2a695c","errorCode":null,"errorMessage":"image variation provider not found: {custom_llm_provider}.","messagePattern":"image variation provider not found: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/openai/image_variations/handler.py","lineNumber":137,"sourceCode":"        timeout: float | None,\n        custom_llm_provider: str,\n        logging_obj: LiteLLMLoggingObj,\n        optional_params: dict,\n        litellm_params: dict,\n        print_verbose: Callable | None = None,\n        logger_fn=None,\n        client=None,\n        organization: str | None = None,\n        headers: dict | None = None,\n    ) -> ImageResponse:\n        try:\n            provider_config: Final = ProviderConfigManager.get_provider_image_variation_config(\n                model=model or \"\",  # openai defaults to dall-e-2\n                provider=LlmProviders.OPENAI,\n            )\n\n            if provider_config is None:\n                raise ValueError(f\"image variation provider not found: {custom_llm_provider}.\")\n\n            max_retries: Final = optional_params.pop(\"max_retries\", 2)\n\n            data: Final = provider_config.transform_request_image_variation(\n                model=model,\n                image=image,\n                optional_params=optional_params,\n                headers=headers or {},\n            )\n            json_data: Final = data.get(\"data\")\n            if not json_data:\n                raise ValueError(f\"data field is required, for openai image variations. Got={data}\")\n            ## LOGGING\n            logging_obj.pre_call(\n                input=\"\",\n                api_key=api_key,\n                additional_args={\n                    \"headers\": headers,","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/openai/image_variations/handler.py#L119-L155","documentation":"litellm's image variations entry point looks up a provider-specific variation config via ProviderConfigManager.get_provider_image_variation_config before transforming the request; if no config is registered for the provider/model combination it raises ValueError('image variation provider not found'). Only providers with an implemented BaseImageVariationConfig (currently OpenAI and Topaz) can serve image variations.","triggerScenarios":"Routing an image-variations call through a provider/model whose variation config is not registered - e.g. invoking the handler with a custom_llm_provider that has no image-variation implementation, or a model string that fails to resolve to a supported provider config. Note the OpenAI handler itself hardcodes provider=OPENAI, so in stock code this fires mainly through unsupported/custom provider paths.","commonSituations":"Custom provider integrations that reuse the OpenAI image-variations handler without registering a variation config; passing a model that only supports generation (not variations) like dall-e-3 or gpt-image-1 into the variations endpoint; litellm versions where the provider you added locally is not wired into ProviderConfigManager.","solutions":["Use a model that actually supports image variations: OpenAI's dall-e-2 (or a Topaz model via its provider path)","If you maintain a custom provider, register a BaseImageVariationConfig subclass for it in ProviderConfigManager so the lookup succeeds","Check the litellm version - provider support for image variations has changed over releases; upgrade to get current provider coverage","Verify the model string is spelled exactly as litellm expects so it resolves to the intended provider"],"exampleFix":"# before\nresp = litellm.image_variations(\n    image=open(\"cat.png\",\"rb\"), model=\"dall-e-3\"  # dall-e-3 has no variations endpoint\n)\n\n# after\nresp = litellm.image_variations(\n    image=open(\"cat.png\",\"rb\"), model=\"dall-e-2\"  # the only OpenAI model with /images/variations\n)","handlingStrategy":"validation","validationCode":"# check model/provider support before calling variations\nVARIATION_CAPABLE = {\"dall-e-2\", \"dall-e-2-variations\"}  # OpenAI side\n\ndef supports_variations(model: str) -> bool:\n    return model in VARIATION_CAPABLE\n\nassert supports_variations(model), f\"{model} has no image-variations support; use dall-e-2\"","typeGuard":"def variation_provider_available(model: str) -> bool:\n    \"\"\"True only for models backed by a registered image-variation config.\"\"\"\n    supported = {\"dall-e-2\"}          # OpenAI provider\n    topaz = {\"topaz-.*\"}              # Topaz provider (regex family)\n    import re\n    return model in supported or any(re.fullmatch(p, model) for p in topaz)","tryCatchPattern":"try:\n    resp = litellm.image_variations(image=img, model=model)\nexcept ValueError as e:\n    if \"provider not found\" in str(e):\n        resp = litellm.image_variations(image=img, model=\"dall-e-2\")  # fall back\n    else:\n        raise","preventionTips":["Restrict image_variations calls to dall-e-2 (OpenAI) - dall-e-3 and gpt-image-1 have no variations endpoint","If you add a custom provider, register its variation config in ProviderConfigManager before routing calls","Guard the model string in your UI/API layer so unsupported models never reach the variations handler","Pin litellm and re-check provider coverage on upgrades - variation support evolves"],"tags":["image-variations","provider-support","configuration","openai"],"backgroundTag":"provider-not-supported","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}