BerriAI/litellm · error · LiteLLMUnknownProvider
Unmapped LLM provider for this endpoint. You passed model={m
Error message
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 What it means
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).
Source
Thrown at litellm/images/main.py:507
prompt=prompt,
timeout=timeout,
logging_obj=litellm_logging_obj,
optional_params=optional_params,
model_response=model_response,
aimg_generation=aimg_generation,
client=client,
api_base=api_base,
api_key=api_key,
)
elif custom_llm_provider in litellm._custom_providers: # Assume custom LLM provider
# Get the Custom Handler
custom_handler: CustomLLM | None = None
for item in litellm.custom_provider_map:
if item["provider"] == custom_llm_provider:
custom_handler = item["custom_handler"]
if custom_handler is None:
raise LiteLLMUnknownProvider(model=model, custom_llm_provider=custom_llm_provider)
## ROUTE LLM CALL ##
if aimg_generation is True:
async_custom_client: AsyncHTTPHandler | None = None
if client is not None and isinstance(client, AsyncHTTPHandler):
async_custom_client = client
## CALL FUNCTION
model_response = custom_handler.aimage_generation(
model=model,
prompt=prompt,
api_key=api_key,
api_base=api_base,
model_response=model_response,
optional_params=optional_params,
logging_obj=litellm_logging_obj,
timeout=timeout,
client=async_custom_client,View on GitHub (pinned to 6c2dcb801b)
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
Example fix
# before
litellm.image_generation(model="acme/img", prompt="a cat") # acme never registered
# after
from litellm.integrations.custom_logger import CustomLLM
class AcmeImages(CustomLLM):
def image_generation(self, model, prompt, **kwargs): ...
litellm.custom_provider_map.append({"provider": "acme", "custom_handler": AcmeImages()})
litellm.image_generation(model="acme/img", prompt="a cat") Defensive patterns
Strategy: validation
Validate before calling
def custom_provider_registered(provider: str) -> bool:
import litellm
return any(item["provider"] == provider for item in litellm.custom_provider_map) Try / catch
from litellm.exceptions import LiteLLMUnknownProvider
try:
r = litellm.image_generation(model="acme/img", prompt=p)
except LiteLLMUnknownProvider:
# handler not registered — degrade or register and retry once
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unknown hook: {hook_name}. Available hooks: {list(ENTERPRISE
- Violated guardrail policy
- `banned_keywords_list` can either be a list or filepath. Non
- Model not found in cost map. Tried checking {models_to_check
- No pricing information found for model {model}. Tried checki
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/84b14a87a35d4da5.
Report an issue: GitHub.