BerriAI/litellm · error · ValueError

Unsupported Bedrock image-edit model: {model!r}. Use a stabi

Error message

Unsupported Bedrock image-edit model: {model!r}. Use a stability.* image-edit model id or add supports_nova_canvas_image_edit in model_prices for this id.

What it means

BedrockImageEdit.get_config_class performs the same routing as the standalone helper: stability.* edit models, then Nova Canvas when flagged in model_cost; otherwise ValueError. This is the entry-point check on every bedrock image_edit call, so an unrecognized model never reaches AWS.

Source

Thrown at litellm/llms/bedrock/image_edit/handler.py:63

    endpoint_url: str
    prepped: AWSPreparedRequest
    body: bytes
    data: dict


class BedrockImageEdit(BaseAWSLLM):
    """
    Bedrock Image Edit handler
    """

    @classmethod
    def get_config_class(cls, model: str | None):
        if BedrockStabilityImageEditConfig._is_stability_edit_model(model):
            return BedrockStabilityImageEditConfig
        if BedrockAmazonNovaCanvasImageEditConfig._is_nova_canvas_image_edit_model(model):
            return BedrockAmazonNovaCanvasImageEditConfig
        raise ValueError(
            f"Unsupported Bedrock image-edit model: {model!r}. "
            "Use a stability.* image-edit model id or add supports_nova_canvas_image_edit "
            "in model_prices for this id."
        )

    def image_edit(
        self,
        model: str,
        image: list,
        prompt: str | None,
        model_response: ImageResponse,
        optional_params: dict,
        logging_obj: LitellmLogging,
        timeout: float | httpx.Timeout | None,
        aimage_edit: bool = False,
        api_base: str | None = None,
        extra_headers: dict | None = None,
        client: HTTPHandler | AsyncHTTPHandler | None = None,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Check the model id: it must match a stability.* image-edit pattern or be a nova-canvas id with supports_nova_canvas_image_edit.
  2. Register custom ids with the flag in model_prices (or update litellm to a version that knows the model).
  3. Route generation-only models to /v1/images/generations.
Defensive patterns

Strategy: validation

Validate before calling

EDIT_MODEL_PREFIXES = ("stability.",)
EDIT_MODEL_SUBSTR = "nova-canvas"

def editable(model: str) -> bool:
    m = model.split("/")[-1]
    return m.startswith(EDIT_MODEL_PREFIXES) or EDIT_MODEL_SUBSTR in m

Type guard

def is_edit_routed(model: object) -> bool:
    return isinstance(model, str) and (
        model.split("/")[-1].startswith("stability.") or "nova-canvas" in model
    )

Prevention

When it happens

Trigger: Any litellm.image_edit(model='bedrock/<id>', ...) or /v1/images/edits where <id> fails both _is_stability_edit_model and _is_nova_canvas_image_edit_model checks.

Common situations: Passing chat/inference model ids (bedrock/anthropic.claude-...) to images/edits by mistake; using model aliases without metadata; typo'd ids; litellm version predating nova-canvas edit support.

Related errors


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