many-fall-81099
08/22/2025, 8:00 AMtall-airline-16756
08/22/2025, 8:00 AMtall-airline-16756
08/22/2025, 8:01 AMmodel parameter to "eleven_v3" when you initialize the ElevenLabs TTS service in the TTS() constructor. Here’s a quick example:
from livekit.plugins.elevenlabs import tts
eleven_tts = tts.TTS(
model="eleven_v3",
voice=...
)
This way, you get to tap into ElevenLabs' awesome text-to-speech features right within your voice apps built on the LiveKit Agents framework. If you need any help setting it up, just let me know!
Sources: livekit-plugins/livekit-plugins-elevenlabs/README.md | ElevenLabs integration guide | LiveKit Docsmany-fall-81099
08/22/2025, 8:03 AMtall-airline-16756
08/22/2025, 8:04 AMELEVEN_API_KEY environment variable or pass the key directly when you initialize the TTS service:
import os
from livekit.plugins import elevenlabs
# Option 1: Set environment variable
os.environ["ELEVEN_API_KEY"] = "your_api_key_here"
# Option 2: Pass directly in code
tts = elevenlabs.TTS(api_key="your_api_key_here")
Also, take a peek at your ElevenLabs dashboard to confirm your API key is active and correct.
2. Fix APIError: no audio frames were pushed
This happens when no audio data comes through. Here’s what to check:
• Make sure your text input isn’t empty and is valid:
stream.push_text("Hello! This is valid text.")
stream.end_input()
• Double-check that your voice_id and model are right. You can use list_voices() to see what’s available:
voices = await tts.list_voices()
print(voices)
• If you’re using enable_ssml_parsing=True, verify your SSML isn’t malformed.
• If network lag might be causing issues, try increasing the `inactivity_timeout`:
tts = elevenlabs.TTS(inactivity_timeout=600)
3. General Best Practices
• It’s a good idea to enable retry logic with APIConnectOptions to make your integration more robust:
from livekit.agents import APIConnectOptions
tts = elevenlabs.TTS(
conn_options=APIConnectOptions(max_retry=3, timeout=5)
)
• Try testing with a simple text input to help isolate any issues:
tts = elevenlabs.TTS()
stream = tts.synthesize("Hello")
audio = await stream.collect()
If you’re still stuck after trying these steps, feel free to reach out—I’m here to help you get this working smoothly!
Sources: livekit-plugins/livekit-plugins-resemble/livekit/plugins/resemble/tts.py | ElevenLabs TTS integration guide | LiveKit Docs