From f3cb45765baa05beabaff76eb6e0f277986b1281 Mon Sep 17 00:00:00 2001 From: Chesars Date: Wed, 4 Mar 2026 22:36:13 -0300 Subject: [PATCH] fix(bfl): close docstring in get_supported_openai_params, prevent quality/n param leak for non-ultra models --- .../black_forest_labs/image_generation/transformation.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/litellm/llms/black_forest_labs/image_generation/transformation.py b/litellm/llms/black_forest_labs/image_generation/transformation.py index 1ad866fac6d..fd664b3ea7e 100644 --- a/litellm/llms/black_forest_labs/image_generation/transformation.py +++ b/litellm/llms/black_forest_labs/image_generation/transformation.py @@ -57,6 +57,7 @@ class BlackForestLabsImageGenerationConfig(BaseImageGenerationConfig): Return list of OpenAI params supported by Black Forest Labs. Note: BFL uses different parameter names, these are mapped in map_openai_params. + """ return [ "n", # Number of images (BFL returns 1 per request, but ultra supports up to 4) "size", # Maps to width/height or aspect_ratio @@ -95,13 +96,13 @@ class BlackForestLabsImageGenerationConfig(BaseImageGenerationConfig): if k == "size" and v: self._map_size_param(v, optional_params) elif k == "n": - # BFL uses num_images for ultra model if "ultra" in model.lower(): optional_params["num_images"] = v - elif k == "quality" and v == "hd": - # Map 'hd' quality to raw mode for more natural look - if "ultra" in model.lower(): + # 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: