BerriAI/litellm · error · ValueError
ElevenLabs voice_id is required. Pass `voice` when calling `
Error message
ElevenLabs voice_id is required. Pass `voice` when calling `litellm.speech()`.
What it means
Error "ElevenLabs voice_id is required. Pass `voice` when calling `litellm.speech()`." thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/elevenlabs/text_to_speech/transformation.py:108
if isinstance(voice, str) and voice.strip():
mapped_voice = self._extract_voice_id(voice)
elif isinstance(voice, dict):
for key in ("voice_id", "id", "name"):
candidate = voice.get(key)
if isinstance(candidate, str) and candidate.strip():
mapped_voice = self._extract_voice_id(candidate)
break
elif voice is not None:
mapped_voice = self._extract_voice_id(str(voice))
if mapped_voice is None:
voice_override: Final = params.pop("voice_id", None)
if isinstance(voice_override, str) and voice_override.strip():
mapped_voice = self._extract_voice_id(voice_override)
if mapped_voice is None:
raise ValueError("ElevenLabs voice_id is required. Pass `voice` when calling `litellm.speech()`.")
return mapped_voice
def map_openai_params(
self,
model: str,
optional_params: dict,
voice: str | dict | None = None,
drop_params: bool = False,
kwargs: dict[str, Any] | None = None,
) -> tuple[str | None, dict]:
"""
Map OpenAI parameters to ElevenLabs TTS parameters
"""
mapped_params: Final[dict[str, Any]] = {}
query_params: Final[dict[str, Any]] = {}
# Work on a copy so we don't mutate the caller's dictionaryView on GitHub (pinned to 6c2dcb801b)
Solutions
- Pass voice when calling litellm.speech().
When it happens
Trigger: Thrown at litellm/llms/elevenlabs/text_to_speech/transformation.py:108 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/a94ad84786d99b96.
Report an issue: GitHub.