BerriAI/litellm · error · Exception

Unable to map the custom llm provider={custom_llm_provider}

Error message

Unable to map the custom llm provider={custom_llm_provider} to a known provider={litellm.provider_list}.

What it means

In the TTS/speech path, after attempting the provider-specific handlers, response is still None — custom_llm_provider did not map to any known speech-capable provider in litellm.provider_list, so a generic Exception is raised.

Source

Thrown at litellm/main.py:8326

        response = aws_polly_config.dispatch_text_to_speech(
            model=model,
            input=input,
            voice=voice,
            optional_params=optional_params,
            litellm_params_dict=litellm_params_dict,
            logging_obj=logging_obj,
            timeout=timeout,
            extra_headers=extra_headers,
            base_llm_http_handler=base_llm_http_handler,
            aspeech=aspeech or False,
            api_base=api_base,
            api_key=api_key,
            **kwargs,
        )

    if response is None:
        raise Exception(
            f"Unable to map the custom llm provider={custom_llm_provider} to a known provider={litellm.provider_list}."
        )
    return response


##### Health Endpoints #######################


async def ahealth_check(
    model_params: dict,
    mode: str | None = "chat",
    prompt: str | None = None,
    input: list | None = None,
):
    """
    Support health checks for different providers. Return remaining rate limit, etc.

    Returns:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a TTS-capable model: litellm.speech(model='openai/tts-1', voice='alloy', input='hello')
  2. For custom providers, implement speech()/aspeech() on the CustomLLM handler
  3. Verify the provider name against litellm.provider_list
  4. Upgrade litellm

Example fix

# before
resp = litellm.speech(model="gpt-4o-mini", input="hello")

# after
resp = litellm.speech(model="openai/tts-1", voice="alloy", input="hello")
Defensive patterns

Strategy: validation

Validate before calling

import litellm

provider = model.partition("/")[0]
if provider not in litellm.provider_list:
    raise ValueError(f"unknown TTS provider: {provider!r}")
# also confirm the provider actually implements TTS before calling

Try / catch

try:
    audio = litellm.speech(model=model, input=text)
except Exception as e:
    if "Unable to map the custom llm provider" in str(e):
        raise RuntimeError(f"{model!r} has no TTS route") from e
    raise

Prevention

When it happens

Trigger: litellm.speech(model='myprov/tts', input='text') where 'myprov' has no TTS handler; passing custom_llm_provider of a chat-only provider to speech().

Common situations: Assuming every provider supports TTS; typos in the provider prefix; custom handlers where only speech() or only aspeech() is implemented.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/21459898b61397eb. Report an issue: GitHub.