{"record":{"id":"77e694d3f204c506","repo":"BerriAI/litellm","slug":"setting-user-encoding-format-is-not-supported-by","errorCode":null,"errorMessage":"Setting user/encoding format is not supported by {custom_llm_provider}. To drop it from the call, set `litellm.drop_params = True`.","messagePattern":"Setting user/encoding format is not supported by (.+?)\\. To drop it from the call, set `litellm\\.drop_params = True`\\.","errorType":"validation","errorClass":"UnsupportedParamsError","httpStatus":500,"severity":"error","filePath":"litellm/assistants/utils.py","lineNumber":103,"sourceCode":"        \"quality\": None,\n        \"response_format\": None,\n        \"size\": None,\n        \"style\": None,\n        \"user\": None,\n    }\n\n    non_default_params = {k: v for k, v in passed_params.items() if (k in default_params and v != default_params[k])}\n    optional_params = {}\n\n    ## raise exception if non-default value passed for non-openai/azure embedding calls\n    def _check_valid_arg(supported_params):\n        if len(non_default_params.keys()) > 0:\n            keys: Final = list(non_default_params.keys())\n            for k in keys:\n                if litellm.drop_params is True and k not in supported_params:  # drop the unsupported non-default values\n                    non_default_params.pop(k, None)\n                elif k not in supported_params:\n                    raise UnsupportedParamsError(\n                        status_code=500,\n                        message=f\"Setting user/encoding format is not supported by {custom_llm_provider}. To drop it from the call, set `litellm.drop_params = True`.\",\n                    )\n            return non_default_params\n\n    if (\n        custom_llm_provider == \"openai\"\n        or custom_llm_provider == \"azure\"\n        or custom_llm_provider in litellm.openai_compatible_providers\n    ):\n        optional_params = non_default_params\n    elif custom_llm_provider == \"bedrock\":\n        supported_params = [\"size\"]\n        _check_valid_arg(supported_params=supported_params)\n        if size is not None:\n            width, height = size.split(\"x\")\n            optional_params[\"width\"] = int(width)\n            optional_params[\"height\"] = int(height)","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/assistants/utils.py#L85-L121","documentation":"get_optional_params_image_gen() whitelists image-generation parameters per provider: OpenAI/Azure/compatible providers accept everything, Bedrock only supports size, Vertex AI only supports n. Passing any other non-default parameter (user, quality, response_format, style) to a restricted provider raises UnsupportedParamsError (status 500) unless litellm.drop_params is enabled, in which case the param is silently dropped. The message text mentions user/encoding format because the same guard originated for embeddings.","triggerScenarios":"Calling litellm.image_generation(model=\"bedrock/...\", quality=\"hd\", user=\"u1\") — quality is not in Bedrock's supported list; passing style or response_format to vertex_ai image models; reusing OpenAI-style kwargs against provider-restricted image endpoints without drop_params.","commonSituations":"Porting working OpenAI image code (with user/quality/style) to Bedrock or Vertex; generic wrappers that always attach user for tracking; unaware that drop_params=True changes behavior from raising to silently dropping.","solutions":["Remove parameters the target provider does not support (check the whitelist: Bedrock=size only, Vertex=n only)","Set litellm.drop_params = True (or the drop_params proxy setting) to auto-drop unsupported params","Branch your kwargs per provider instead of sharing one dict across providers","Reserve user/quality/style for openai/azure/compatible providers"],"exampleFix":"# before\nimg = litellm.image_generation(\n    model=\"bedrock/stability.stable-diffusion-xl-v1\",\n    prompt=\"a cat\",\n    quality=\"hd\",\n    user=\"user-123\",\n)\n\n# after\nimg = litellm.image_generation(\n    model=\"bedrock/stability.stable-diffusion-xl-v1\",\n    prompt=\"a cat\",\n    size=\"1024x1024\",   # only 'size' is supported on bedrock\n)\n# or globally: litellm.drop_params = True\n","handlingStrategy":"validation","validationCode":"IMAGE_GEN_SUPPORTED = {\n    \"bedrock\": {\"size\"},\n    \"vertex_ai\": {\"n\"},\n}\n\ndef sanitize_image_gen_kwargs(custom_llm_provider: str, kwargs: dict) -> dict:\n    supported = IMAGE_GEN_SUPPORTED.get(custom_llm_provider)\n    if supported is None:  # openai/azure/compatible: everything allowed\n        return kwargs\n    return {k: v for k, v in kwargs.items() if k in supported}\n","typeGuard":"def params_supported(params: dict, supported: set[str]) -> bool:\n    return all(k in supported for k in params)\n","tryCatchPattern":"from litellm.exceptions import UnsupportedParamsError\n\ntry:\n    img = litellm.image_generation(model=model, **kwargs)\nexcept UnsupportedParamsError as e:\n    if litellm.drop_params:\n        kwargs = {k: v for k, v in kwargs.items() if k in supported_for(model)}\n        img = litellm.image_generation(model=model, **kwargs)\n    else:\n        raise\n","preventionTips":["Keep per-provider kwarg whitelists in your calling code instead of one shared dict","Set litellm.drop_params = True when porting OpenAI kwargs to Bedrock/Vertex and silent dropping is acceptable","Consult the provider's image-generation docs for supported params before adding new ones"],"tags":["image-generation","bedrock","vertex-ai","unsupported-params","drop-params"],"backgroundTag":"unsupported-parameter","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}