{"record":{"id":"4e8acf2656eb1226","repo":"BerriAI/litellm","slug":"unmapped-llm-provider-for-this-endpoint-you-passe-4e8acf","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/main.py","lineNumber":4760,"sourceCode":"    custom_prompt_dict: Final = ctx.custom_prompt_dict\n    headers = ctx.headers\n    litellm_params: Final = ctx.litellm_params\n    logger_fn: Final = ctx.logger_fn\n    logging: Final = ctx.logging\n    messages: Final = ctx.messages\n    model: Final = ctx.model\n    model_response: Final = ctx.model_response\n    optional_params: Final = ctx.optional_params\n    stream: Final = ctx.stream\n    timeout: Final = ctx.timeout\n\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    handler_fn: Final = custom_chat_llm_router(async_fn=acompletion, stream=stream, custom_llm=custom_handler)\n\n    headers = headers or litellm.headers or {}\n\n    ## CALL FUNCTION\n    response: Final = handler_fn(\n        model=model,\n        messages=messages,\n        headers=headers,\n        model_response=model_response,\n        print_verbose=print_verbose,\n        api_key=api_key,\n        api_base=api_base,\n        acompletion=acompletion,\n        logging_obj=logging,\n        optional_params=optional_params,","sourceCodeStart":4742,"sourceCodeEnd":4778,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/main.py#L4742-L4778","documentation":"LiteLLMUnknownProvider raised in _complete_custom_providers when custom_llm_provider does not match any entry in litellm.custom_provider_map. This branch handles providers litellm treats as user-registered custom handlers, so an unmatched name means nothing is registered to serve the model.","triggerScenarios":"Passing custom_llm_provider='my_llm' (or model='my_llm/...') without ever appending {'provider': 'my_llm', 'custom_handler': MyHandler()} to litellm.custom_provider_map; or a typo/case mismatch between the model prefix and the registered provider key.","commonSituations":"Custom handler registered in one process/service but the call happens in another (worker, notebook) where registration never ran; renaming the handler and forgetting the map; team code copying the call but not the registration lines.","solutions":["Register the handler before calling: litellm.custom_provider_map.append({'provider': 'my_llm', 'custom_handler': MyCustomLLM()})","Check exact string equality (case-sensitive) between the provider in the model string and the map entry","If you just want an OpenAI-compatible endpoint, use model='openai/<model>' with api_base and skip custom providers entirely","Move registration to import time / app startup so every worker registers before serving traffic"],"exampleFix":"# before\nlitellm.completion(model='acme-turbo/gpt', messages=m)  # LiteLLMUnknownProvider\n\n# after\nfrom litellm.integrations.custom_logger import CustomLLM\nclass AcmeHandler(CustomLLM):\n    def completion(self, **kwargs): ...\nlitellm.custom_provider_map.append({'provider': 'acme-turbo', 'custom_handler': AcmeHandler()})\nresp = litellm.completion(model='acme-turbo/gpt', messages=m)","handlingStrategy":"validation","validationCode":"providers = {entry['provider'] for entry in litellm.custom_provider_map}\nif custom_llm_provider not in providers:\n    raise SystemExit(f'{custom_llm_provider!r} not registered in litellm.custom_provider_map')","typeGuard":"def provider_registered(provider: str, provider_map: list[dict]) -> bool:\n    return any(entry.get('provider') == provider for entry in provider_map)","tryCatchPattern":"from litellm.exceptions import LiteLLMUnknownProvider\ntry:\n    resp = litellm.completion(model='acme-turbo/gpt', messages=m)\nexcept LiteLLMUnknownProvider as e:\n    raise RuntimeError('register the custom handler before calling this model') from e","preventionTips":["Register custom handlers at module import time so every worker/process shares the registration","Derive the provider prefix in the model string from the same constant used in custom_provider_map","Add a startup assertion that iterates your config's models and checks each provider is registered or known","Prefer 'openai/<model>' + api_base for plain OpenAI-compatible servers instead of custom providers"],"tags":["custom-provider","provider-registration","routing","litellm"],"backgroundTag":"unsupported-provider","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}