BerriAI/litellm · error · UnsupportedParamsError
Setting user/encoding format is not supported by
Error message
Setting user/encoding format is not supported by {custom_llm_provider}. To drop it from the call, set `litellm.drop_params = True`. What it means
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.
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
Example fix
# before
img = litellm.image_generation(
model="bedrock/stability.stable-diffusion-xl-v1",
prompt="a cat",
quality="hd",
user="user-123",
)
# after
img = litellm.image_generation(
model="bedrock/stability.stable-diffusion-xl-v1",
prompt="a cat",
size="1024x1024", # only 'size' is supported on bedrock
)
# or globally: litellm.drop_params = True
Defensive patterns
Strategy: validation
Validate before calling
IMAGE_GEN_SUPPORTED = {
"bedrock": {"size"},
"vertex_ai": {"n"},
}
def sanitize_image_gen_kwargs(custom_llm_provider: str, kwargs: dict) -> dict:
supported = IMAGE_GEN_SUPPORTED.get(custom_llm_provider)
if supported is None: # openai/azure/compatible: everything allowed
return kwargs
return {k: v for k, v in kwargs.items() if k in supported}
Type guard
def params_supported(params: dict, supported: set[str]) -> bool:
return all(k in supported for k in params)
Try / catch
from litellm.exceptions import UnsupportedParamsError
try:
img = litellm.image_generation(model=model, **kwargs)
except UnsupportedParamsError as e:
if litellm.drop_params:
kwargs = {k: v for k, v in kwargs.items() if k in supported_for(model)}
img = litellm.image_generation(model=model, **kwargs)
else:
raise
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- completion_response must be of type ImageResponse for…
- err.response.text
- Error in response object format, got None
- Error
- Error transforming color guided generation params
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/77e694d3f204c506.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/assistants/utils.py:103
"quality": None,
"response_format": None,
"size": None,
"style": None,
"user": None,
}
non_default_params = {k: v for k, v in passed_params.items() if (k in default_params and v != default_params[k])}
optional_params = {}
## raise exception if non-default value passed for non-openai/azure embedding calls
def _check_valid_arg(supported_params):
if len(non_default_params.keys()) > 0:
keys: Final = list(non_default_params.keys())
for k in keys:
if litellm.drop_params is True and k not in supported_params: # drop the unsupported non-default values
non_default_params.pop(k, None)
elif k not in supported_params:
raise UnsupportedParamsError(
status_code=500,
message=f"Setting user/encoding format is not supported by {custom_llm_provider}. To drop it from the call, set `litellm.drop_params = True`.",
)
return non_default_params
if (
custom_llm_provider == "openai"
or custom_llm_provider == "azure"
or custom_llm_provider in litellm.openai_compatible_providers
):
optional_params = non_default_params
elif custom_llm_provider == "bedrock":
supported_params = ["size"]
_check_valid_arg(supported_params=supported_params)
if size is not None:
width, height = size.split("x")
optional_params["width"] = int(width)
optional_params["height"] = int(height)View on GitHub (pinned to 77b7c6c40c)