cold-waiter-86140
10/25/2025, 3:00 PMtall-airline-16756
10/25/2025, 3:01 PMtall-airline-16756
10/25/2025, 3:01 PMfrom livekit.agents import TTS
tts = TTS(
model="elevenlabs/eleven_flash_v2_5",
voice="your_voice_id" # You can choose a voice ID from the ElevenLabs voice library
)
stream = tts.stream()
This model is quite versatile and supports a variety of languages, including English, Japanese, Chinese, German, Hindi, French, Korean, Portuguese, Italian, Spanish, Indonesian, Dutch, Turkish, and more.
Just a quick note on pricing: the service costs $150 per 1M characters through LiveKit Inference. If you want to explore different voices, feel free to check out the ElevenLabs voice library to find the perfect voice ID for your project.
Sources: ElevenLabs TTS plugin guide | LiveKit Docs | Text-to-speech (TTS) models | LiveKit Docs | Build voice, video, and physical AI | LiveKitcold-waiter-86140
10/25/2025, 3:05 PMtall-airline-16756
10/25/2025, 3:05 PMinference.tts(). Here's a simple example to guide you:
from livekit.agents.inference import tts as inference_tts
tts = inference_tts.TTS(
model="elevenlabs/eleven_flash_v2_5",
voice="voice_id", # Be sure to replace this with the voice ID you want to use
language="en",
api_key="your_livekit_api_key",
api_secret="your_livekit_api_secret"
)
Just a quick note: please make sure to replace voice_id with a valid ElevenLabs voice ID. Currently, custom or cloned voices aren't supported in LiveKit Inference.
If you want to customize things a bit more, you can add options like inactivity_timeout and apply_text_normalization through extra_kwargs. Here's how that looks:
tts = inference_tts.TTS(
model="elevenlabs/eleven_flash_v2_5",
voice="voice_id",
language="en",
api_key="your_livekit_api_key",
api_secret="your_livekit_api_secret",
extra_kwargs={"inactivity_timeout": 120, "apply_text_normalization": "on"}
)
If anything feels unclear or if you have any more questions, please don’t hesitate to reach out. I’m here to help!
Sources: docs/index.yaml | plugins/elevenlabs/src/tts.ts | ElevenLabs TTS | LiveKit Docs | livekit-agents/livekit/agents/inference/tts.py | Build voice, video, and physical AI | LiveKitcold-waiter-86140
10/25/2025, 3:06 PMtall-airline-16756
10/25/2025, 3:06 PMtts = cartesia.TTS()
source = rtc.AudioSource(tts.sample_rate, tts.num_channels)
track = rtc.LocalAudioTrack.create_audio_track("agent-mic", source)
await job.room.local_participant.publish_track(track)
stream = tts.stream()
text = "hello from Cartesia. I hope you are having a great day."
words = text.split()
for i in range(0, len(words), 2):
chunk = " ".join(words[i : i + 2])
stream.push_text(chunk + " ")
stream.flush()
stream.end_input()
This example gently simulates LLM streaming by breaking the text into smaller chunks and pushing them to the TTS stream. Plus, if you'd like, you can customize the LLM output before sending it to TTS by using the before_tts_cb callback to clean up or transform the text exactly how you want.
Please feel free to reach out if you'd like me to walk you through any part of this or if you have specific configurations in mind. I'm here to help!
Sources: Tool definition and use | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_activity.py | README.md | Pipeline nodes and hooks | LiveKit Docs | chain-of-thought-tts/README.mdoccold-waiter-86140
10/25/2025, 3:36 PMtall-airline-16756
10/25/2025, 3:37 PMllm_node sends output chunks asynchronously as they’re generated, and the tts_node processes these chunks bit by bit. This way, if your TTS model supports streaming, you get real-time synthesis.
If your TTS model doesn’t support streaming natively, no worries! LiveKit uses a sentence tokenizer to split the text into smaller segments for incremental synthesis. You don’t need to create separate node functions for this since the streaming behavior is already built into the agent pipeline architecture.
Please feel free to reach out if you’d like me to clarify anything further or help you with your setup—I’m here for you!
Sources: livekit-agents/livekit/agents/voice/agent_activity.py | Pipeline nodes and hooks | LiveKit Docs | Docs::Agents | Modifying LLM output before TTS | LiveKit Docs