{"record":{"id":"91bb0091b5b455f0","repo":"BerriAI/litellm","slug":"unknown-bfl-image-generation-model-model-name","errorCode":null,"errorMessage":"Unknown BFL image generation model: {model_name}. Supported models: {list(IMAGE_GENERATION_MODELS.keys())}","messagePattern":"Unknown BFL image generation model: (.+?)\\. Supported models: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/black_forest_labs/image_generation/transformation.py","lineNumber":183,"sourceCode":"        headers[\"Content-Type\"] = \"application/json\"\n        headers[\"Accept\"] = \"application/json\"\n\n        return headers\n\n    def _get_model_endpoint(self, model: str) -> str:\n        \"\"\"\n        Get the API endpoint for a given model.\n        \"\"\"\n        # Remove provider prefix if present (e.g., \"black_forest_labs/flux-pro-1.1\")\n        model_name = model.lower()\n        if \"/\" in model_name:\n            model_name = model_name.split(\"/\")[-1]\n\n        # Check if model is in our mapping\n        if model_name in IMAGE_GENERATION_MODELS:\n            return IMAGE_GENERATION_MODELS[model_name]\n\n        raise ValueError(\n            f\"Unknown BFL image generation model: {model_name}. \"\n            f\"Supported models: {list(IMAGE_GENERATION_MODELS.keys())}\"\n        )\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        api_key: str | None,\n        model: str,\n        optional_params: dict,\n        litellm_params: dict,\n        stream: bool | None = None,\n    ) -> str:\n        \"\"\"\n        Get the complete URL for the Black Forest Labs API request.\n        \"\"\"\n        base_url: str = api_base or get_secret_str(\"BFL_API_BASE\") or DEFAULT_API_BASE\n        base_url = base_url.rstrip(\"/\")","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/black_forest_labs/image_generation/transformation.py#L165-L201","documentation":"_get_model_endpoint lowercases the model name, strips any provider prefix (text after the last '/'), and looks the remainder up in the IMAGE_GENERATION_MODELS dict. No match raises this ValueError listing the supported models. It is a client-side routing error: the request never leaves the machine.","triggerScenarios":"model=\"bfl/flux-2\" or \"flux-pro\" (names not in the mapping) instead of supported entries like \"flux-pro-1.1\"; typo in the model id; using a newly released BFL model on an older litellm that lacks the mapping.","commonSituations":"Model-name guesses from BFL marketing pages that don't match litellm's registered ids; stale litellm versions missing new models; passing the full endpoint URL as the model.","solutions":["Use a model id from the error message's supported list, with or without the provider prefix (e.g. 'black_forest_labs/flux-pro-1.1' or 'flux-pro-1.1').","Upgrade litellm if the model is newly released by BFL: pip install -U litellm.","Check litellm's BFL docs / IMAGE_GENERATION_MODELS for the canonical ids."],"exampleFix":"# before\nlitellm.images.generate(model=\"bfl/flux-2-pro\", prompt=p)\n\n# after\nlitellm.images.generate(model=\"black_forest_labs/flux-pro-1.1\", prompt=p)","handlingStrategy":"validation","validationCode":"SUPPORTED_BFL = {\"flux-pro-1.1\", \"flux-dev\", \"flux-pro-1.1-ultra\", \"flux-kontext-pro\"}  # sync with litellm version\nif model.split(\"/\")[-1].lower() not in SUPPORTED_BFL:\n    raise ValueError(f\"model '{model}' not registered for BFL; choices: {sorted(SUPPORTED_BFL)}\")","typeGuard":"def is_bfl_model_supported(model: str) -> bool:\n    return model.lower().split(\"/\")[-1] in get_bfl_supported_models()  # mirror IMAGE_GENERATION_MODELS keys","tryCatchPattern":"try:\n    litellm.images.generate(model=model, prompt=p)\nexcept ValueError as e:\n    if \"Unknown BFL image generation model\" in str(e):\n        model = fallback_default_bfl_model  # pick from the listed supported models\n        litellm.images.generate(model=model, prompt=p)\n    else:\n        raise","preventionTips":["Source model ids from config validated against the running litellm version, not hardcoded guesses.","Re-validate model lists after upgrading litellm or when BFL ships new models.","Catch this ValueError and present the supported list to users in self-serve UIs."],"tags":["bfl","model-name","validation","routing"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}