BerriAI/litellm · error · ValueError
image variation provider not found
Error message
image variation provider not found: {custom_llm_provider}. What it means
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.
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
Example fix
# before
resp = litellm.image_variations(
image=open("cat.png","rb"), model="dall-e-3" # dall-e-3 has no variations endpoint
)
# after
resp = litellm.image_variations(
image=open("cat.png","rb"), model="dall-e-2" # the only OpenAI model with /images/variations
) Defensive patterns
Strategy: validation
Validate before calling
# check model/provider support before calling variations
VARIATION_CAPABLE = {"dall-e-2", "dall-e-2-variations"} # OpenAI side
def supports_variations(model: str) -> bool:
return model in VARIATION_CAPABLE
assert supports_variations(model), f"{model} has no image-variations support; use dall-e-2" Type guard
def variation_provider_available(model: str) -> bool:
"""True only for models backed by a registered image-variation config."""
supported = {"dall-e-2"} # OpenAI provider
topaz = {"topaz-.*"} # Topaz provider (regex family)
import re
return model in supported or any(re.fullmatch(p, model) for p in topaz) Try / catch
try:
resp = litellm.image_variations(image=img, model=model)
except ValueError as e:
if "provider not found" in str(e):
resp = litellm.image_variations(image=img, model="dall-e-2") # fall back
else:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- CANCEL eval is not supported for
- CREATE eval is not supported for
- CREATE run is not supported for
- data field is required, for openai image variations. Got=
- DELETE eval is not supported for
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/2a695c5b9ff8538a.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/openai/image_variations/handler.py:137
timeout: float | None,
custom_llm_provider: str,
logging_obj: LiteLLMLoggingObj,
optional_params: dict,
litellm_params: dict,
print_verbose: Callable | None = None,
logger_fn=None,
client=None,
organization: str | None = None,
headers: dict | None = None,
) -> ImageResponse:
try:
provider_config: Final = ProviderConfigManager.get_provider_image_variation_config(
model=model or "", # openai defaults to dall-e-2
provider=LlmProviders.OPENAI,
)
if provider_config is None:
raise ValueError(f"image variation provider not found: {custom_llm_provider}.")
max_retries: Final = optional_params.pop("max_retries", 2)
data: Final = provider_config.transform_request_image_variation(
model=model,
image=image,
optional_params=optional_params,
headers=headers or {},
)
json_data: Final = data.get("data")
if not json_data:
raise ValueError(f"data field is required, for openai image variations. Got={data}")
## LOGGING
logging_obj.pre_call(
input="",
api_key=api_key,
additional_args={
"headers": headers,View on GitHub (pinned to 77b7c6c40c)