BerriAI/litellm · error · ValueError

Parameter {k} is not supported for model {model}. Supported

Error message

Parameter {k} is not supported for model {model}. Supported parameters are {supported_params}. Set drop_params=True to drop unsupported parameters.

What it means

When mapping OpenAI images/edits params onto Stability AI's schema, the transformer only allows params that are supported for the model or explicitly mapped (size -> aspect_ratio, n -> _n, response_format -> _response_format). Any other OpenAI param raises ValueError listing supported params unless drop_params=True is set, mirroring litellm's global get_optional_params behavior.

Source

Thrown at litellm/llms/bedrock/image_edit/stability_transformation.py:135

        # Create a copy to not mutate original - convert TypedDict to regular dict
        mapped_params: Final[dict[str, Any]] = dict(image_edit_optional_params)

        for k, v in image_edit_optional_params.items():
            if k in param_mapping:
                # Map param if mapping exists and value is valid
                if k == "size" and v in OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO:
                    mapped_params[param_mapping[k]] = OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO[v]
                # Don't copy "size" itself to final dict
            elif k == "n":
                # Store for logic but do not add to outgoing params
                mapped_params["_n"] = v
            elif k == "response_format":
                # Only b64 supported at Stability; store for postprocessing
                mapped_params["_response_format"] = v
            elif k not in supported_params:
                if not drop_params:
                    raise ValueError(
                        f"Parameter {k} is not supported for model {model}. "
                        f"Supported parameters are {supported_params}. "
                        f"Set drop_params=True to drop unsupported parameters."
                    )
                # Otherwise, param will simply be dropped
            else:
                # param is supported and not mapped, keep as-is
                continue

        # Remove OpenAI params that have been mapped unless they're in stability
        for mapped in ["size", "n", "response_format"]:
            mapped_params.pop(mapped, None)

        return mapped_params

    def transform_image_edit_request(
        self,
        model: str,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Set drop_params=True (litellm.drop_params = True, or per-call drop_params=True) to silently drop unsupported params.
  2. Or remove/whitelist params client-side to only those listed in the error's supported_params.
  3. Map size manually: only specific OpenAI sizes convert to Stability aspect ratios; unsupported size strings also fall through to this path.

Example fix

# before
litellm.image_edit(model="bedrock/stability.sd3-large-img-edit",
                  image=img, prompt="...", quality="hd")  # ValueError
# after
litellm.image_edit(model="bedrock/stability.sd3-large-img-edit",
                  image=img, prompt="...", drop_params=True)
Defensive patterns

Strategy: validation

Validate before calling

STABILITY_ALLOWED = {"prompt", "image", "mask", "size", "n", "response_format"}

def filter_stability_params(d: dict) -> dict:
    return {k: v for k, v in d.items() if k in STABILITY_ALLOWED}

Type guard

def is_stability_edit_param(k: object) -> bool:
    return k in {"prompt", "image", "mask", "size", "n", "response_format"}

Prevention

When it happens

Trigger: Calling bedrock stability image edits with extra OpenAI params like 'quality', 'style', 'user', or 'background', none of which exist in Stability's supported set; the check fires before the request is sent.

Common situations: Porting DALL-E 3 or gpt-image-1 edit calls (which accept quality/style/background/user) to bedrock/stability.*; passing through user-supplied param dicts unfiltered.

Related errors


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