most-vr-18651
11/07/2025, 9:58 AMwhy do i get this error whenever i specify a voice id in eleven labs :
TTS", "attempt": 1, "streamed": true, "timestamp": "2025-11-07T09:52:05.554038+00:00"}
{"message": "failed to synthesize speech, retrying in 2.0s", "level": "WARNING", "name": "livekit.agents", "exc_info": "Traceback (most recent call last):\n File \"C:\\Users\\YUSUF\\miniconda3\\envs\\newagents\\lib\\site-packages\\livekit\\plugins\\elevenlabs\\tts.py\", line 420, in _run\n await waiter\nlivekit.agents._exceptions.APITimeoutError: 11labs tts timed out after 10.0 seconds (body=None, retryable=True)\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"C:\\Users\\YUSUF\\miniconda3\\envs\\newagents\\lib\\site-packages\\livekit\\agents\\tts\\tts.py\", line 383, in _main_task\n await self._run(output_emitter)\n File \"C:\\Users\\YUSUF\\miniconda3\\envs\\newagents\\lib\\site-packages\\livekit\\plugins\\elevenlabs\\tts.py\", line 426, in _run\n raise APIStatusError(\"Could not synthesize\") from e\nlivekit.agents._exceptions.APIStatusError: Could not synthesize (status_code=-1, request_id=None, body=None, retryable=True)", "room": "prepAI-e93182", "user_id": "1176", "tts": "livekit.plugins.elevenlabs.tts.TTS", "attempt": 2, "streamed": true, "timestamp": "2025-11-07T09:52:15.656468+00:00"}
session = AgentSession(
vad=ctx.proc.userdata["vad"],
llm=openai.LLM(model="gpt-4.1-mini", temperature=0.3),
stt= openai.STT(model="whisper-1"),
tts=elevenlabs.TTS(
voice_id="AWxJjhmijML4C3mGaEAT",
model="eleven_multilingual_v2"),
# tts=deepgram.TTS(),
allow_interruptions=True
)tall-airline-16756
11/07/2025, 9:58 AMtall-airline-16756
11/07/2025, 9:58 AMlist_voices() method in the ElevenLabs plugin to see which voices are available to you.
• API Key Configuration: It’s important to make sure your ELEVEN_API_KEY is set up correctly in your environment or passed explicitly when you initialize TTS.
• Timeout and Network Delays: If the default timeout feels too short, try adjusting it with APIConnectOptions. This gives your request more time to complete, especially if your network is a bit slow.
• Model and Voice Compatibility: Double-check that the voice you’ve chosen works well with the model you’re using, like making sure multilingual voices go with eleven_multilingual_v2.
Here’s a quick way to verify your voice ID:
tts = elevenlabs.TTS()
voices = await tts.list_voices() # Returns list of accessible voices
Also, please confirm your API key is set up properly, and if needed, try increasing the timeout to help with any network delays. If you run into any more questions or need a hand with this, just let me know—I’m here to help! Sources: ElevenLabs TTS plugin guide | LiveKit Docs | ElevenLabs TTS | LiveKit docs | examples/other/text-to-speech/sync_tts_transcription.py | agents/src/tts/tts.tsmost-vr-18651
11/07/2025, 10:01 AMtall-airline-16756
11/07/2025, 10:01 AMELEVEN_API_KEY is set in your environment or passed directly when you initialize elevenlabs.TTS(). This step is key to connecting properly.
• Listing Voices: After you create your TTS instance, use the list_voices() method to fetch the available voices. Here’s a little example to guide you: tts = elevenlabs.TTS(api_key="your_api_key")
voices = await tts.list_voices()
logger.info(voices)
• Session Initialization: Double-check that your TTS instance is correctly included in the AgentSession setup.
If anything feels unclear or you’d like a hand walking through these steps, just let me know—I’m here to help! Sources: ElevenLabs TTS | LiveKit docs | examples/src/anam_realtime_agent.ts | livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/__ini... | ElevenLabs TTS | LiveKit Docs | pipeline-tts/changing_language/README.mdmost-vr-18651
11/07/2025, 10:02 AMtall-airline-16756
11/07/2025, 10:02 AMfrom livekit.agents import AgentSession
from livekit.plugins.elevenlabs import TTS
# Initialize ElevenLabs TTS with API key
api_key = "your_api_key" # Replace with your actual API key
tts = TTS(api_key=api_key)
# List available voices
voices = await tts.list_voices()
logger.info(voices) # Log the list of voices
# Create the AgentSession
session = AgentSession(
vad=ctx.proc.userdata["vad"],
llm=openai.LLM(model="gpt-4.1-mini"),
stt=openai.STT(model="whisper-1"),
tts=tts, # Pass the initialized TTS instance
allow_interruptions=True
)
# Set the session reference
agent.session = session
Just be sure to replace "your_api_key" with your actual ElevenLabs API key. This snippet sets up the TTS instance, fetches the available voices, and creates the AgentSession for you. If you have any questions or need a hand with anything else, please don’t hesitate to ask—I’m here to help!most-vr-18651
11/07/2025, 10:06 AMtall-airline-16756
11/07/2025, 10:06 AM