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

In the BFL transformation layer, each OpenAI-style image parameter is checked against the model's supported params. Unknown parameters raise this ValueError unless drop_params is enabled. This mirrors litellm's standard 'unsupported param' guard: it prevents silently sending parameters the BFL endpoint would reject or ignore.

Source

Thrown at litellm/llms/black_forest_labs/image_generation/transformation.py:107

            if k in optional_params:
                continue

            if k in supported_params:
                # Map OpenAI 'size' to BFL width/height
                if k == "size" and v:
                    self._map_size_param(v, optional_params)
                elif k == "n":
                    if "ultra" in model.lower():
                        optional_params["num_images"] = v
                    # non-ultra: silently skip (n=1 is BFL default)
                elif k == "quality":
                    if v == "hd" and "ultra" in model.lower():
                        optional_params["raw"] = True
                    # other quality values have no BFL mapping
                else:
                    optional_params[k] = v
            elif 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."
                )

        return optional_params

    def _map_size_param(self, size: str, optional_params: dict) -> None:
        """Map OpenAI size parameter to BFL width/height."""
        # Common size mappings
        size_mapping: Final = {
            "1024x1024": (1024, 1024),
            "1792x1024": (1792, 1024),
            "1024x1792": (1024, 1792),
            "512x512": (512, 512),
            "256x256": (256, 256),
        }

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Remove the unsupported parameter named in the message for BFL calls, or gate it per provider.
  2. Pass drop_params=True (or set litellm.drop_params=True globally) to have litellm silently drop unsupported params.
  3. Check the supported params list printed in the error message and map your param to a supported equivalent (e.g. size -> width/height is handled for you).

Example fix

# before
litellm.images.generate(model="bfl/flux-dev", prompt=p, style="natural")

# after
litellm.images.generate(model="bfl/flux-dev", prompt=p, drop_params=True)
Defensive patterns

Strategy: validation

Validate before calling

BFL_SUPPORTED = {"prompt", "model", "size", "n", "quality"}  # verify against error message/docs
cleaned = {k: v for k, v in request_params.items() if k in BFL_SUPPORTED}

Try / catch

try:
    litellm.images.generate(model="bfl/flux-dev", **params)
except ValueError as e:
    if "not supported" in str(e):
        params = {k: v for k, v in params.items() if k not in str(e)}
        litellm.images.generate(model="bfl/flux-dev", drop_params=True, **params)
    else:
        raise

Prevention

When it happens

Trigger: Calling image generation with a parameter not in the supported list for the BFL model — e.g. passing 'quality' with a value other than 'hd' on an ultra model path is fine, but passing params like 'style' or 'response_format' when not supported, without drop_params=True.

Common situations: Porting code written for OpenAI images (which accepts style/response_format) to BFL models; generic wrapper code that forwards a fixed parameter dict to every provider; new OpenAI params not yet mapped for BFL.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/11eac0dbcc88b5a2. Report an issue: GitHub.