{"record":{"id":"2fadb747819a9ec3","repo":"BerriAI/litellm","slug":"parameter-k-is-not-supported-for-model-model-2fadb7","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_generation/transformation.py","lineNumber":93,"sourceCode":"\n        for k, v in non_default_params.items():\n            if k not in optional_params:\n                if k in supported_params:\n                    # Map size to aspect_ratio\n                    if k == \"size\" and v in OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO:\n                        optional_params[\"aspect_ratio\"] = OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO[v]\n                    elif k == \"n\":\n                        # Store n for later, but don't pass to Stability\n                        optional_params[\"_n\"] = v\n                    elif k == \"response_format\":\n                        # Stability only returns base64, store for response handling\n                        optional_params[\"_response_format\"] = v\n                    else:\n                        optional_params[k] = v\n                elif drop_params:\n                    pass\n                else:\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\n        return optional_params\n\n    def _get_model_endpoint(self, model: str) -> str:\n        \"\"\"\n        Get the API endpoint for a given model.\n        \"\"\"\n        # Remove \"stability/\" prefix if present\n        model_name = model.lower()\n        model_name = model_name.removeprefix(\"stability/\")  # Remove \"stability/\" prefix\n\n        # Check if model is in our mapping\n        for key, endpoint in STABILITY_GENERATION_MODELS.items():\n            if key in model_name:","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/stability/image_generation/transformation.py#L75-L111","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Strip the unsupported parameter named in the message; keep only n, size, response_format.","Pass drop_params=True on the call, or construct the client with litellm.client.LiteLLM(drop_params=True).","Set litellm.drop_params = True globally (or DROP_PARAMS: true in proxy config) for multi-provider routing.","Use supported size values ('1024x1024', '1152x896', etc.) so size maps to aspect_ratio correctly."],"exampleFix":"# before\nresp = litellm.image_generation(\n    model=\"stability/stable-image-core\",\n    prompt=\"a cat astronaut\",\n    quality=\"hd\",\n    style=\"vivid\",\n)\n\n# after\nresp = litellm.image_generation(\n    model=\"stability/stable-image-core\",\n    prompt=\"a cat astronaut\",\n    size=\"1024x1024\",\n    n=1,\n    drop_params=True,\n)","handlingStrategy":"validation","validationCode":"SUPPORTED_GEN = {\"n\", \"size\", \"response_format\"}\n\ndef sanitize_for_stability_gen(params: dict) -> dict:\n    \"\"\"Drop params Stability image generation cannot accept.\"\"\"\n    return {k: v for k, v in params.items() if k in SUPPORTED_GEN}\n\nsafe = sanitize_for_stability_gen({\"prompt\": \"cat\", \"quality\": \"hd\", \"n\": 1})\n# -> {'n': 1}; call with prompt=..., **safe","typeGuard":null,"tryCatchPattern":"try:\n    litellm.image_generation(model=\"stability/...\", prompt=p, **params)\nexcept ValueError as e:\n    if \"is not supported for model\" in str(e):\n        litellm.image_generation(model=\"stability/...\", prompt=p, drop_params=True, **params)\n    else:\n        raise","preventionTips":["Treat DALL-E options (quality, style, user, background) as provider-specific, not portable.","Centralize drop_params=True at the client level so per-call mistakes degrade instead of crashing.","Log the supported-params list from get_supported_openai_params during onboarding of a new image provider."],"tags":["stability-ai","image-generation","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"}