{"record":{"id":"a94ad84786d99b96","repo":"BerriAI/litellm","slug":"elevenlabs-voice-id-is-required-pass-voice-when","errorCode":null,"errorMessage":"ElevenLabs voice_id is required. Pass `voice` when calling `litellm.speech()`.","messagePattern":"ElevenLabs voice_id is required\\. Pass `voice` when calling `litellm\\.speech\\(\\)`\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/elevenlabs/text_to_speech/transformation.py","lineNumber":108,"sourceCode":"\n        if isinstance(voice, str) and voice.strip():\n            mapped_voice = self._extract_voice_id(voice)\n        elif isinstance(voice, dict):\n            for key in (\"voice_id\", \"id\", \"name\"):\n                candidate = voice.get(key)\n                if isinstance(candidate, str) and candidate.strip():\n                    mapped_voice = self._extract_voice_id(candidate)\n                    break\n        elif voice is not None:\n            mapped_voice = self._extract_voice_id(str(voice))\n\n        if mapped_voice is None:\n            voice_override: Final = params.pop(\"voice_id\", None)\n            if isinstance(voice_override, str) and voice_override.strip():\n                mapped_voice = self._extract_voice_id(voice_override)\n\n        if mapped_voice is None:\n            raise ValueError(\"ElevenLabs voice_id is required. Pass `voice` when calling `litellm.speech()`.\")\n\n        return mapped_voice\n\n    def map_openai_params(\n        self,\n        model: str,\n        optional_params: dict,\n        voice: str | dict | None = None,\n        drop_params: bool = False,\n        kwargs: dict[str, Any] | None = None,\n    ) -> tuple[str | None, dict]:\n        \"\"\"\n        Map OpenAI parameters to ElevenLabs TTS parameters\n        \"\"\"\n        mapped_params: Final[dict[str, Any]] = {}\n        query_params: Final[dict[str, Any]] = {}\n\n        # Work on a copy so we don't mutate the caller's dictionary","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/elevenlabs/text_to_speech/transformation.py#L90-L126","documentation":"Error \"ElevenLabs voice_id is required. Pass `voice` when calling `litellm.speech()`.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/elevenlabs/text_to_speech/transformation.py:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass voice when calling litellm.speech()."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}