BerriAI/litellm · error · ValueError

Model {model} is not supported for Azure AI image editing.

Error message

Model {model} is not supported for Azure AI image editing.

What it means

get_image_edit_config() dispatches Azure AI image-edit requests to a handler based on the model name: MAI (OpenAI image) models, FLUX 2 models, and FLUX 1 as the default for anything containing 'flux'. Any other model string raises ValueError 'Model {model} is not supported for Azure AI image editing.' — i.e. the provider only edits images with specific model families on Foundry.

Source

Thrown at litellm/llms/azure_ai/image_edit/__init__.py:42

    Get the appropriate image edit config for an Azure AI model.

    - MAI models use /mai/v1/images/edits with multipart form data and size
    - FLUX 2 models use JSON with base64 image
    - FLUX 1 models use multipart/form-data
    """
    if AzureFoundryMAIImageGenerationConfig.is_mai_model(model):
        return AzureFoundryMAIImageEditConfig()

    # Check if it's a FLUX 2 model
    if AzureFoundryFluxImageGenerationConfig.is_flux2_model(model):
        return AzureFoundryFlux2ImageEditConfig()

    # Default to FLUX 1 config for other FLUX models
    model_normalized: Final = model.lower().replace("-", "").replace("_", "")
    if model_normalized == "" or "flux" in model_normalized:
        return AzureFoundryFluxImageEditConfig()

    raise ValueError(f"Model {model} is not supported for Azure AI image editing.")

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Use a supported model family: an FLUX image-edit deployment (model string containing 'flux') or an MAI image model.
  2. If you meant OpenAI DALL-E / gpt-image-1 on plain Azure OpenAI, call the azure/ (not azure_ai/) provider route.
  3. Update litellm — new Foundry model families get dispatch support over time.
  4. If the model genuinely is FLUX but the string is an alias, pass the real model name and keep aliases in your proxy layer.

Example fix

# before
litellm.image_edit(model='azure_ai/my-alias', image=img, prompt='...')

# after
litellm.image_edit(model='azure_ai/flux-1.1-pro', image=img, prompt='...')
# or, for OpenAI image models on Azure OpenAI:
litellm.image_edit(model='azure/gpt-image-1', image=img, prompt='...')
Defensive patterns

Strategy: type-guard

Validate before calling

def is_supported_image_edit_model(model: str) -> bool:
    m = model.lower().replace('-', '').replace('_', '')
    return m != '' and ('flux' in m or is_mai_model(model))  # extend as litellm adds families

Type guard

def is_supported_image_edit_model(model: str) -> bool:
    normalized = model.lower().replace('-', '').replace('_', '')
    if 'flux' in normalized:
        return True
    return model.lower().startswith(('gpt-image',)) or 'mai' in normalized

Try / catch

try:
    litellm.image_edit(model=m, image=img, prompt=p)
except ValueError as e:
    if 'not supported for Azure AI image editing' in str(e):
        m = pick_supported_image_edit_model()  # fall back to a known FLUX deployment
    raise

Prevention

When it happens

Trigger: litellm.image_edit(..., model='azure_ai/<name>') where <name> contains neither 'flux' (case-insensitive, dash/underscore-stripped) nor matches the MAI/FLUX2 detectors — e.g. a DALL-E or Stable Diffusion name, a typo, or a custom deployment alias.

Common situations: Assuming image_edit supports the same models as image_variation or chat; using a friendly deployment alias in a proxy that hides the real model name; typos like 'flx' or 'Fluxx'; new Azure model family not yet supported by the installed litellm version.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/12df82b29a3ca2ea. Report an issue: GitHub.