{"record":{"id":"93a7f8d9619612e2","repo":"BerriAI/litellm","slug":"parameter-k-is-not-supported-for-model-model-93a7f8","errorCode":null,"errorMessage":"Parameter {k} is not supported for model {model}. Supported parameters are {supported_params}. Set drop_params=True to drop unsupported parameters.","messagePattern":"Parameter (.+?) is not supported for model (.+?)\\. Supported parameters are (.+?)\\. Set drop_params=True to drop unsupported parameters\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/stability/image_edit/transformations.py","lineNumber":93,"sourceCode":"\n        # Create a copy to not mutate original - convert TypedDict to regular dict\n        mapped_params: Final[dict[str, Any]] = dict(image_edit_optional_params)\n\n        for k, v in image_edit_optional_params.items():\n            if k in param_mapping:\n                # Map param if mapping exists and value is valid\n                if k == \"size\" and v in OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO:\n                    mapped_params[param_mapping[k]] = OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO[v]\n                # Don't copy \"size\" itself to final dict\n            elif k == \"n\":\n                # Store for logic but do not add to outgoing params\n                mapped_params[\"_n\"] = v\n            elif k == \"response_format\":\n                # Only b64 supported at Stability; store for postprocessing\n                mapped_params[\"_response_format\"] = v\n            elif k not in supported_params:\n                if not drop_params:\n                    raise ValueError(\n                        f\"Parameter {k} is not supported for model {model}. \"\n                        f\"Supported parameters are {supported_params}. \"\n                        f\"Set drop_params=True to drop unsupported parameters.\"\n                    )\n                # Otherwise, param will simply be dropped\n            else:\n                # param is supported and not mapped, keep as-is\n                continue\n\n        # Remove OpenAI params that have been mapped unless they're in stability\n        for mapped in [\"size\", \"n\", \"response_format\"]:\n            mapped_params.pop(mapped, None)\n\n        return mapped_params\n\n    def _get_model_endpoint(self, model: str) -> str:\n        \"\"\"\n        Get the API endpoint for a given model.","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/stability/image_edit/transformations.py#L75-L111","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\nresp = litellm.image_edit(\n    model=\"stability/stability-image-edit\",\n    prompt=\"remove the background\",\n    image=open(\"in.png\", \"rb\"),\n    quality=\"hd\",          # not supported by Stability\n)\n\n# after\nresp = litellm.image_edit(\n    model=\"stability/stability-image-edit\",\n    prompt=\"remove the background\",\n    image=open(\"in.png\", \"rb\"),\n    size=\"1024x1024\",      # maps to aspect_ratio\n    drop_params=True,      # or simply omit quality\n)","handlingStrategy":"validation","validationCode":"import litellm\nfrom litellm.types.llms.stability import OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO\n\nSUPPORTED = {\"n\", \"size\", \"response_format\", \"mask\"}\n\ndef validate_stability_edit_params(params: dict) -> list[str]:\n    \"\"\"Return list of params that would raise; empty list means safe to call.\"\"\"\n    bad = []\n    for k, v in params.items():\n        if k not in SUPPORTED:\n            bad.append(k)\n        elif k == \"size\" and v not in OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO:\n            bad.append(f\"size={v} (no aspect_ratio mapping)\")\n    return bad\n\nbad = validate_stability_edit_params({\"quality\": \"hd\", \"size\": \"1024x1024\"})\nassert not bad, f\"strip these before calling: {bad}\"","typeGuard":null,"tryCatchPattern":"try:\n    litellm.image_edit(model=\"stability/...\", prompt=p, image=fp, **params)\nexcept ValueError as e:\n    if \"is not supported for model\" in str(e):\n        # client-side param rejection: strip params or set drop_params and retry once\n        litellm.image_edit(model=\"stability/...\", prompt=p, image=fp, drop_params=True, **params)\n    else:\n        raise","preventionTips":["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."],"tags":["stability-ai","image-edit","parameter-validation","openai-compat","litellm"],"backgroundTag":"unsupported-request-parameter","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}