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

For image generation (as opposed to edit), LiteLLM's Stability config supports only n, size, and response_format (size is translated to aspect_ratio; n and response_format are handled internally). Any other OpenAI parameter present in non_default_params while drop_params is False raises this ValueError during map_openai_params, before the request is sent.

Source

Thrown at litellm/llms/stability/image_generation/transformation.py:93

        for k, v in non_default_params.items():
            if k not in optional_params:
                if k in supported_params:
                    # Map size to aspect_ratio
                    if k == "size" and v in OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO:
                        optional_params["aspect_ratio"] = OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO[v]
                    elif k == "n":
                        # Store n for later, but don't pass to Stability
                        optional_params["_n"] = v
                    elif k == "response_format":
                        # Stability only returns base64, store for response handling
                        optional_params["_response_format"] = v
                    else:
                        optional_params[k] = v
                elif drop_params:
                    pass
                else:
                    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."
                    )

        return optional_params

    def _get_model_endpoint(self, model: str) -> str:
        """
        Get the API endpoint for a given model.
        """
        # Remove "stability/" prefix if present
        model_name = model.lower()
        model_name = model_name.removeprefix("stability/")  # Remove "stability/" prefix

        # Check if model is in our mapping
        for key, endpoint in STABILITY_GENERATION_MODELS.items():
            if key in model_name:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Strip the unsupported parameter named in the message; keep only n, size, response_format.
  2. Pass drop_params=True on the call, or construct the client with litellm.client.LiteLLM(drop_params=True).
  3. Set litellm.drop_params = True globally (or DROP_PARAMS: true in proxy config) for multi-provider routing.
  4. Use supported size values ('1024x1024', '1152x896', etc.) so size maps to aspect_ratio correctly.

Example fix

# before
resp = litellm.image_generation(
    model="stability/stable-image-core",
    prompt="a cat astronaut",
    quality="hd",
    style="vivid",
)

# after
resp = litellm.image_generation(
    model="stability/stable-image-core",
    prompt="a cat astronaut",
    size="1024x1024",
    n=1,
    drop_params=True,
)
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_GEN = {"n", "size", "response_format"}

def sanitize_for_stability_gen(params: dict) -> dict:
    """Drop params Stability image generation cannot accept."""
    return {k: v for k, v in params.items() if k in SUPPORTED_GEN}

safe = sanitize_for_stability_gen({"prompt": "cat", "quality": "hd", "n": 1})
# -> {'n': 1}; call with prompt=..., **safe

Try / catch

try:
    litellm.image_generation(model="stability/...", prompt=p, **params)
except ValueError as e:
    if "is not supported for model" in str(e):
        litellm.image_generation(model="stability/...", prompt=p, drop_params=True, **params)
    else:
        raise

Prevention

When it happens

Trigger: Calling litellm.image_generation(model="stability/stable-diffusion-3.5-large", quality="hd", style="natural", user="u1") or any OpenAI DALL-E option besides n/size/response_format; the error fires only when drop_params is False.

Common situations: Reusing a DALL-E payload against a stability/ model; generic gateway code that appends tracking params like user to every request; teams enabling new OpenAI image options (e.g. quality or background) and assuming all providers accept them.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/2fadb747819a9ec3. Report an issue: GitHub.