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
This commit is contained in:
Chesars 2026-03-04 18:33:56 -03:00
parent 8eb7ca3726
commit 52d2ea237f
2 changed files with 9 additions and 10 deletions

View file

@ -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,

View file

@ -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,