feat(bfl): add kontext models to image generation support

Kontext models (flux-kontext-pro, flux-kontext-max) support both
text-to-image and image editing. Add them to IMAGE_GENERATION_MODELS
and update supported_endpoints in model prices JSON.
This commit is contained in:
Chesars 2026-03-04 19:12:28 -03:00
parent 7ee4a40fc4
commit 88dc0c1b18
3 changed files with 17 additions and 2 deletions

View file

@ -36,4 +36,7 @@ IMAGE_GENERATION_MODELS: Dict[str, str] = {
"flux-pro-1.1-ultra": "/v1/flux-pro-1.1-ultra",
"flux-dev": "/v1/flux-dev",
"flux-pro": "/v1/flux-pro",
# Kontext models support both text-to-image and image editing
"flux-kontext-pro": "/v1/flux-kontext-pro",
"flux-kontext-max": "/v1/flux-kontext-max",
}

View file

@ -7792,7 +7792,8 @@
"output_cost_per_image": 0.04,
"source": "https://bfl.ai/pricing",
"supported_endpoints": [
"/v1/images/edits"
"/v1/images/edits",
"/v1/images/generations"
]
},
"black_forest_labs/flux-kontext-max": {
@ -7801,7 +7802,8 @@
"output_cost_per_image": 0.08,
"source": "https://bfl.ai/pricing",
"supported_endpoints": [
"/v1/images/edits"
"/v1/images/edits",
"/v1/images/generations"
]
},
"black_forest_labs/flux-pro-1.0-fill": {

View file

@ -178,6 +178,16 @@ class TestBlackForestLabsImageGenerationTransformation:
endpoint = self.config._get_model_endpoint("flux-pro")
assert endpoint == "/v1/flux-pro"
def test_get_model_endpoint_flux_kontext_pro(self):
"""Test endpoint for flux-kontext-pro model (supports both generation and editing)."""
endpoint = self.config._get_model_endpoint("flux-kontext-pro")
assert endpoint == "/v1/flux-kontext-pro"
def test_get_model_endpoint_flux_kontext_max(self):
"""Test endpoint for flux-kontext-max model (supports both generation and editing)."""
endpoint = self.config._get_model_endpoint("flux-kontext-max")
assert endpoint == "/v1/flux-kontext-max"
def test_get_model_endpoint_unknown_raises(self):
"""Test that unknown models raise ValueError."""
with pytest.raises(ValueError, match="Unknown BFL image generation model"):