is this how i use tts from elevenlabs tts=elevenla...
# ask-ai
c
is this how i use tts from elevenlabs tts=elevenlabs.TTS( api_key=os.getenv("ELEVENLABS_TTS_API_KEY"), voice_id="21m00Tcm4TlvDq8ikWAM", # Rachel - Professional female voice model_id="eleven_monolingual_v1" # High quality, low latency model )
t
Thanks for reaching out, raj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Your code snippet for using ElevenLabs TTS looks pretty good, but I wanted to share a few extra tips to make sure everything’s set up just right: • First, make sure you’ve installed the necessary plugin from PyPI with:
pip install "livekit-agents[elevenlabs]~=1.2"
. • Don’t forget to set your ElevenLabs API key as an environment variable like this:
ELEVEN_API_KEY=<your-api-key>
, or you can pass it directly when you create the TTS object. • Also, in your code, swap out
model_id
for
model
. So, you’d use something like
model="eleven_monolingual_v1"
. Here’s a little example with those tweaks:
Copy code
from livekit.plugins import elevenlabs

tts = elevenlabs.TTS(
    api_key=os.getenv("ELEVENLABS_TTS_API_KEY"),
    voice_id="21m00Tcm4TlvDq8ikWAM",  # Rachel - Professional female voice
    model="eleven_monolingual_v1"   # High quality, low latency model
)
If you hit any bumps or want to chat more about it, just let me know—I’m here to help! Sources: ElevenLabs TTS integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.p... | Working with plugins | LiveKit Docs