BerriAI/litellm · error · ValueError
Unknown BFL image edit model
Error message
Unknown BFL image edit model: {model_name}. Supported models: {list(IMAGE_EDIT_MODELS.keys())} What it means
Model-mapping guard in _get_model_endpoint: after stripping any provider prefix and lowercasing, the model name is not a key in IMAGE_EDIT_MODELS, so there is no known BFL endpoint for it. The supported model list is included in the error.
Solutions
- Use one of the supported BFL image edit models listed in the error.
- Check the model name for typos.
- Refer to BFL docs for the correct model identifier.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/llms/black_forest_labs/image_edit/transformation.py:171 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/96a2ad30ea0da451.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/black_forest_labs/image_edit/transformation.py:171
"""
BFL uses JSON requests, not multipart/form-data.
"""
return False
def _get_model_endpoint(self, model: str) -> str:
"""
Get the API endpoint for a given model.
"""
# Remove provider prefix if present (e.g., "black_forest_labs/flux-kontext-pro")
model_name = model.lower()
if "/" in model_name:
model_name = model_name.split("/")[-1]
# Check if model is in our mapping
if model_name in IMAGE_EDIT_MODELS:
return IMAGE_EDIT_MODELS[model_name]
raise ValueError(
f"Unknown BFL image edit model: {model_name}. Supported models: {list(IMAGE_EDIT_MODELS.keys())}"
)
def get_complete_url(
self,
model: str,
api_base: str | None,
litellm_params: dict,
) -> str:
"""
Get the complete URL for the Black Forest Labs API request.
"""
base_url: str = api_base or get_secret_str("BFL_API_BASE") or DEFAULT_API_BASE
base_url = base_url.rstrip("/")
endpoint: Final = self._get_model_endpoint(model)
return f"{base_url}{endpoint}"
View on GitHub (pinned to 77b7c6c40c)