{"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":"exception","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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/black_forest_labs/image_generation/transformation.py#L165-L201","documentation":"BFL's transformation resolves the endpoint by lowercasing the model, stripping any 'provider/' prefix, and looking the remainder up in the IMAGE_GENERATION_MODELS dict. A name not in that dict raises this ValueError listing the supported models. LiteLLM therefore only routes BFL model names it explicitly knows.","triggerScenarios":"model=\"black_forest_labs/flux-pro\" (truncated name), \"flux-1.1-pro\" (wrong order), a newly released FLUX model not yet present in the installed litellm version, or an arbitrary string after the prefix.","commonSituations":"BFL ships a new model and users update the model string before updating litellm; mixing up BFL naming with other providers' conventions; case is forgiving (lowercased) but punctuation/order are not.","solutions":["Use one of the listed names from the error message itself (e.g. black_forest_labs/flux-pro-1.1).","pip install -U litellm to pick up newly registered BFL models.","Inspect the mapping: from litellm.llms.black_forest_labs.common_utils import IMAGE_GENERATION_MODELS; print(list(IMAGE_GENERATION_MODELS))."],"exampleFix":"# before\nlitellm.image_generation(model=\"black_forest_labs/flux-pro\", prompt=\"a cat\")\n\n# after\nlitellm.image_generation(model=\"black_forest_labs/flux-pro-1.1\", prompt=\"a cat\")","handlingStrategy":"validation","validationCode":"from litellm.llms.black_forest_labs.common_utils import IMAGE_GENERATION_MODELS\n\ndef valid_bfl_model(model: str) -> bool:\n    name = model.lower().split(\"/\")[-1]\n    return name in IMAGE_GENERATION_MODELS","typeGuard":null,"tryCatchPattern":"try:\n    litellm.image_generation(model=model, prompt=p)\nexcept ValueError as e:\n    if \"Unknown BFL image generation model\" in str(e):\n        # fall back to a known-good model\n        litellm.image_generation(model=\"black_forest_labs/flux-pro-1.1\", prompt=p)\n    else:\n        raise","preventionTips":["Pin model names as constants validated against IMAGE_GENERATION_MODELS at startup.","After upgrading BFL model strings, upgrade litellm in the same change."],"tags":["bfl","model-name","validation","image-generation"],"backgroundTag":"unknown-model-name","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}