From 52d2ea237fefa0d8e2baf28525e834890c0a6c12 Mon Sep 17 00:00:00 2001 From: Chesars Date: Wed, 4 Mar 2026 18:33:56 -0300 Subject: [PATCH] fix(bfl): remove unsupported params and error on unknown models - Remove response_format from supported params (BFL always returns URLs) - Remove n and size from image edit supported params (not mapped) - Raise ValueError on unknown model names instead of silently defaulting --- .../black_forest_labs/image_edit/transformation.py | 12 +++++------- .../image_generation/transformation.py | 7 ++++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/litellm/llms/black_forest_labs/image_edit/transformation.py b/litellm/llms/black_forest_labs/image_edit/transformation.py index 5732b8786db..23ebd9840ab 100644 --- a/litellm/llms/black_forest_labs/image_edit/transformation.py +++ b/litellm/llms/black_forest_labs/image_edit/transformation.py @@ -54,11 +54,7 @@ class BlackForestLabsImageEditConfig(BaseImageEditConfig): Note: BFL uses different parameter names, these are mapped in map_openai_params. """ - return [ - "n", # Number of images (BFL returns 1 per request) - "size", # Maps to aspect_ratio - "response_format", # b64_json or url - ] + return [] def map_openai_params( self, @@ -155,8 +151,10 @@ class BlackForestLabsImageEditConfig(BaseImageEditConfig): if model_name in IMAGE_EDIT_MODELS: return IMAGE_EDIT_MODELS[model_name] - # Default to kontext-pro - return IMAGE_EDIT_MODELS["flux-kontext-pro"] + raise ValueError( + f"Unknown BFL image edit model: {model_name}. " + f"Supported models: {list(IMAGE_EDIT_MODELS.keys())}" + ) def get_complete_url( self, diff --git a/litellm/llms/black_forest_labs/image_generation/transformation.py b/litellm/llms/black_forest_labs/image_generation/transformation.py index 7e1c2d286d3..7a97adafe80 100644 --- a/litellm/llms/black_forest_labs/image_generation/transformation.py +++ b/litellm/llms/black_forest_labs/image_generation/transformation.py @@ -61,7 +61,6 @@ class BlackForestLabsImageGenerationConfig(BaseImageGenerationConfig): return [ "n", # Number of images (BFL returns 1 per request, but ultra supports up to 4) "size", # Maps to width/height or aspect_ratio - "response_format", # b64_json or url "quality", # Maps to raw mode for ultra ] @@ -176,8 +175,10 @@ class BlackForestLabsImageGenerationConfig(BaseImageGenerationConfig): if model_name in IMAGE_GENERATION_MODELS: return IMAGE_GENERATION_MODELS[model_name] - # Default to flux-pro-1.1 - return IMAGE_GENERATION_MODELS["flux-pro-1.1"] + raise ValueError( + f"Unknown BFL image generation model: {model_name}. " + f"Supported models: {list(IMAGE_GENERATION_MODELS.keys())}" + ) def get_complete_url( self,