Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(bfl): close docstring in get_supported_openai_params, prevent quality/n param leak for non-ultra models

Chesarsf3cb45765baa
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: