{"record":{"id":"84b14a87a35d4da5","repo":"BerriAI/litellm","slug":"unmapped-llm-provider-for-this-endpoint-you-passe","errorCode":null,"errorMessage":"Unmapped LLM provider for this endpoint. You passed model={model}, custom_llm_provider={custom_llm_provider}. Check supported provider and route: https://docs.litellm.ai/docs/providers","messagePattern":"Unmapped LLM provider for this endpoint\\. You passed model=(.+?), custom_llm_provider=(.+?)\\. Check supported provider and route: https://docs\\.litellm\\.ai/docs/providers","errorType":"exception","errorClass":"LiteLLMUnknownProvider","httpStatus":400,"severity":"error","filePath":"litellm/images/main.py","lineNumber":507,"sourceCode":"                prompt=prompt,\n                timeout=timeout,\n                logging_obj=litellm_logging_obj,\n                optional_params=optional_params,\n                model_response=model_response,\n                aimg_generation=aimg_generation,\n                client=client,\n                api_base=api_base,\n                api_key=api_key,\n            )\n        elif custom_llm_provider in litellm._custom_providers:  # Assume custom LLM provider\n            # Get the Custom Handler\n            custom_handler: CustomLLM | None = None\n            for item in litellm.custom_provider_map:\n                if item[\"provider\"] == custom_llm_provider:\n                    custom_handler = item[\"custom_handler\"]\n\n            if custom_handler is None:\n                raise LiteLLMUnknownProvider(model=model, custom_llm_provider=custom_llm_provider)\n\n            ## ROUTE LLM CALL ##\n            if aimg_generation is True:\n                async_custom_client: AsyncHTTPHandler | None = None\n                if client is not None and isinstance(client, AsyncHTTPHandler):\n                    async_custom_client = client\n\n                ## CALL FUNCTION\n                model_response = custom_handler.aimage_generation(\n                    model=model,\n                    prompt=prompt,\n                    api_key=api_key,\n                    api_base=api_base,\n                    model_response=model_response,\n                    optional_params=optional_params,\n                    logging_obj=litellm_logging_obj,\n                    timeout=timeout,\n                    client=async_custom_client,","sourceCodeStart":489,"sourceCodeEnd":525,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/images/main.py#L489-L525","documentation":"During image generation, custom_llm_provider was found in litellm._custom_providers (registered custom provider namespace), but no matching entry exists in litellm.custom_provider_map, so no CustomLLM handler instance could be located; litellm raises LiteLLMUnknownProvider pointing at the provider docs (litellm/images/main.py:507 region).","triggerScenarios":"Adding a provider name to litellm._custom_providers (or using a reserved custom name) without appending {'provider': name, 'custom_handler': CustomLLM()} to litellm.custom_provider_map; typo between the name used in the call and the name in custom_provider_map.","commonSituations":"Teams wrapping internal image endpoints with CustomLLM but initializing the map lazily/conditionally so the image call runs before registration; case-mismatch ('MyProvider' vs 'myprovider'); or code copied between projects that drops the registration block.","solutions":["Register the handler before any call: litellm.custom_provider_map.append({'provider': 'my_provider', 'custom_handler': MyCustomHandler()})","Ensure the handler subclasses CustomLLM and implements image_generation/aimage_generation","Use the exact same provider string in the call (model='my_provider/model-x') as the registered key"],"exampleFix":"# before\nlitellm.image_generation(model=\"acme/img\", prompt=\"a cat\")  # acme never registered\n\n# after\nfrom litellm.integrations.custom_logger import CustomLLM\nclass AcmeImages(CustomLLM):\n    def image_generation(self, model, prompt, **kwargs): ...\nlitellm.custom_provider_map.append({\"provider\": \"acme\", \"custom_handler\": AcmeImages()})\nlitellm.image_generation(model=\"acme/img\", prompt=\"a cat\")","handlingStrategy":"validation","validationCode":"def custom_provider_registered(provider: str) -> bool:\n    import litellm\n    return any(item[\"provider\"] == provider for item in litellm.custom_provider_map)","typeGuard":null,"tryCatchPattern":"from litellm.exceptions import LiteLLMUnknownProvider\ntry:\n    r = litellm.image_generation(model=\"acme/img\", prompt=p)\nexcept LiteLLMUnknownProvider:\n    # handler not registered — degrade or register and retry once\n    raise","preventionTips":["Register custom providers in litellm.custom_provider_map at process startup, before any request","Add a startup assertion that every provider referenced by your model list is registered","Keep provider names as constants shared between registration and call sites"],"tags":["image-generation","custom-provider","registration","litellm"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}