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
LiteLLM maps OpenAI-style image-edit parameters onto Stability AI's edit API, which only supports n, size, response_format, and mask (size is translated to aspect_ratio). When map_openai_params encounters an OpenAI parameter outside that set (e.g. quality, style, user) and drop_params is False, it raises this ValueError before any HTTP request is made. The message lists the exact supported set and points to drop_params=True as the escape hatch.
Source
Thrown at litellm/llms/stability/image_edit/transformations.py:93
# 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 _get_model_endpoint(self, model: str) -> str:
"""
Get the API endpoint for a given model.View on GitHub (pinned to 77b7c6c40c)
Solutions
- Remove the unsupported parameter(s) named in the message from the image_edit call — keep only n, size, response_format, mask.
- Set drop_params=True to have LiteLLM silently drop them: litellm.image_edit(..., drop_params=True) or litellm.client.LiteLLM(drop_params=True).
- Set it globally with litellm.drop_params = True (or DROP_PARAMS in proxy config) when routing the same call across multiple image providers.
- Replace size values like '256x256' with a size present in OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO (e.g. '1024x1024', '1536x1024') so it maps to aspect_ratio.
Example fix
# before
resp = litellm.image_edit(
model="stability/stability-image-edit",
prompt="remove the background",
image=open("in.png", "rb"),
quality="hd", # not supported by Stability
)
# after
resp = litellm.image_edit(
model="stability/stability-image-edit",
prompt="remove the background",
image=open("in.png", "rb"),
size="1024x1024", # maps to aspect_ratio
drop_params=True, # or simply omit quality
) Defensive patterns
Strategy: validation
Validate before calling
import litellm
from litellm.types.llms.stability import OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO
SUPPORTED = {"n", "size", "response_format", "mask"}
def validate_stability_edit_params(params: dict) -> list[str]:
"""Return list of params that would raise; empty list means safe to call."""
bad = []
for k, v in params.items():
if k not in SUPPORTED:
bad.append(k)
elif k == "size" and v not in OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO:
bad.append(f"size={v} (no aspect_ratio mapping)")
return bad
bad = validate_stability_edit_params({"quality": "hd", "size": "1024x1024"})
assert not bad, f"strip these before calling: {bad}" Try / catch
try:
litellm.image_edit(model="stability/...", prompt=p, image=fp, **params)
except ValueError as e:
if "is not supported for model" in str(e):
# client-side param rejection: strip params or set drop_params and retry once
litellm.image_edit(model="stability/...", prompt=p, image=fp, drop_params=True, **params)
else:
raise Prevention
- Build image-edit payloads from an allowlist (n, size, response_format, mask) instead of forwarding full OpenAI kwargs.
- Set drop_params=True in multi-provider gateways so provider-specific extras never hard-fail.
- Keep a unit test asserting your request dict passes get_supported_openai_params for every provider you route to.
When it happens
Trigger: Calling litellm.image_edit(model="stability/stable-image-edit", ...) with OpenAI-only kwargs such as quality="hd", style="natural", user="abc", or background="transparent". Also passing size values that are not in OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO leaves 'size' unmapped and it can then fall through as unsupported. Reproduced only when drop_params is False (the default unless litellm.drop_params=True is set globally).
Common situations: Porting working OpenAI DALL-E image-edit code to a stability/ model without stripping OpenAI-specific options; a shared wrapper that injects user/quality for all providers; upgrading litellm versions where the supported-param list changed; forgetting that drop_params can be set globally via litellm.modify_params or the client constructor.
Related errors
- Parameter {k} is not supported for model {model}. Supported
- STABILITY_API_KEY is not set. Please set it via environment
- image edit is not supported for {custom_llm_provider}
- Parameter {k} is not supported for model {model}. Supported
- Max recursion depth {max_depth} reached while reading image
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/93a7f8d9619612e2.
Report an issue: GitHub.