BerriAI/litellm · error · ValueError
image edit is not supported for
Error message
image edit is not supported for {custom_llm_provider} What it means
litellm.image_edit dispatches per-provider only when ProviderConfigManager.get_provider_image_edit_config returns a BaseImageEditConfig for the model/provider pair (litellm/images/main.py:822-833). A None result means this litellm build has no image-edit config registered for that provider — the endpoint is treated as unsupported for it, even if the provider supports image generation.
Solutions
- Use a provider with registered edit support — openai (gpt-image-1), gemini, bedrock, black_forest_labs are the wired edit routes in this file.
- Upgrade litellm — edit configs are added release by release.
- Pre-check ProviderConfigManager.get_provider_image_edit_config(model, LlmProviders(provider)) before routing.
- For unsupported providers, call the provider's native edit API.
Example fix
# before resp = litellm.image_edit(model="recraft/recraft-v3", image=img, prompt="remove background") # ValueError: image edit is not supported for recraft # after resp = litellm.image_edit(model="openai/gpt-image-1", image=img, prompt="remove background")
Defensive patterns
Strategy: validation
Validate before calling
from litellm.utils import ProviderConfigManager
from litellm import LlmProviders
cfg = ProviderConfigManager.get_provider_image_edit_config(
model="gpt-image-1", provider=LlmProviders.OPENAI
)
if cfg is None:
raise RuntimeError("image edit not wired for this provider in your litellm version; use openai/bedrock/gemini/black_forest_labs or upgrade") Try / catch
try:
resp = litellm.image_edit(model=model, image=img, prompt=p)
except ValueError as e:
if "image edit is not supported" in str(e):
resp = litellm.image_edit(model="openai/gpt-image-1", image=img, prompt=p) # known-good route
else:
raise Prevention
- Maintain an allowlist of edit-capable providers per litellm version and validate against it.
- Pre-check get_provider_image_edit_config in startup smoke tests for every edit model you expose.
- Do not assume generation support implies edit support.
When it happens
Trigger: image_edit with a provider that only has generation support registered (e.g. recraft or stability on builds lacking edit configs); a model/provider combo missing from the registry on older litellm; typo'd model under a supported provider causing the registry lookup to miss.
Common situations: Assuming edit parity with generation providers; pinned older litellm versions; using newest providers (edit support lands later than generation support).
Related errors
- image generation config is not supported for
- image variation provider has no known model info config -…
- Error parsing BFL response
- Error parsing OpenRouter response
- Error transforming OpenRouter image edit response
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/7d5907de91f46528.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/images/main.py:833
image=images,
prompt=prompt,
model_response=model_response,
api_key=kwargs.get("api_key"),
api_base=kwargs.get("api_base"),
optional_params=kwargs,
logging_obj=litellm_logging_obj,
timeout=timeout,
client=custom_client,
)
# get provider config
image_edit_provider_config: BaseImageEditConfig | None = ProviderConfigManager.get_provider_image_edit_config(
model=model,
provider=litellm.LlmProviders(custom_llm_provider),
)
if image_edit_provider_config is None:
raise ValueError(f"image edit is not supported for {custom_llm_provider}")
local_vars.update(kwargs)
# Get ImageEditOptionalRequestParams with only valid parameters
image_edit_optional_params: Final[ImageEditOptionalRequestParams] = (
_get_ImageEditRequestUtils().get_requested_image_edit_optional_param(local_vars)
)
# Get optional parameters for the responses API
image_edit_request_params: Final[dict] = _get_ImageEditRequestUtils().get_optional_params_image_edit(
model=model,
image_edit_provider_config=image_edit_provider_config,
image_edit_optional_params=image_edit_optional_params,
drop_params=kwargs.get("drop_params"),
additional_drop_params=kwargs.get("additional_drop_params"),
)
# Pre Call logging
litellm_logging_obj.update_from_kwargs(
kwargs=kwargs,View on GitHub (pinned to 77b7c6c40c)