Overview
AssemblyAI text-to-speech is available in LiveKit Agents through LiveKit Inference and the AssemblyAI plugin. With LiveKit Inference, your agent runs on LiveKit's infrastructure to minimize latency. No separate provider API key is required, and usage and rate limits are managed through LiveKit Cloud. Use the plugin instead if you want to manage your own billing and rate limits. Pricing for LiveKit Inference is available on the pricing page .
LiveKit Inference
Use LiveKit Inference to access AssemblyAI TTS without a separate AssemblyAI API key.
| Model name | Model ID | Languages |
|---|---|---|
| AssemblyAI TTS 1 | assemblyai/assemblyai-tts-1 | en, es, de, fr, it, pt |
Usage
To use AssemblyAI, use the TTS class from the inference module:
from livekit.agents import AgentSession, inferencesession = AgentSession(tts=inference.TTS(model="assemblyai/assemblyai-tts-1",voice="49c443a4-8a1d-5f7e-b70b-98bdbd9823c3", # Audreylanguage="en"),# ... llm, stt, vad, turn_handling, etc.)
import { AgentSession, inference } from '@livekit/agents';const session = new AgentSession({tts: new inference.TTS({model: "assemblyai/assemblyai-tts-1",voice: "49c443a4-8a1d-5f7e-b70b-98bdbd9823c3", // Audreylanguage: "en"}),// ... llm, stt, vad, turnHandling, etc.});
Parameters
modelstringThe model ID from the models list.
voicestringThe ID of the voice to use. See voices for guidance on selecting a voice.
languageLanguageCodeLanguage code for the input text. AssemblyAI doesn't detect the language of the text, so set this to match what your LLM produces.
extra_kwargsdictAdditional parameters to pass to the AssemblyAI TTS API. See model parameters for supported fields.
In Node.js this parameter is called modelOptions.
Model parameters
Pass the following parameters inside extra_kwargs (Python) or modelOptions (Node.js):
| Parameter | Type | Default | Notes |
|---|---|---|---|
word_timestamps | bool | True | Whether to return per-word timings with the audio. LiveKit uses them for aligned transcripts. |
Voices
LiveKit Inference supports the voices in the AssemblyAI voice library . To use a voice, copy its ID from the voice library into your agent session.
Each voice is recorded in one language. A voice can speak any supported language, but it keeps the accent of its recording, so pick a voice recorded in the language of your text and set language to match.
Custom AssemblyAI voices cloned in your own AssemblyAI account aren't available through LiveKit Inference. To use these, use the AssemblyAI plugin.
String descriptors
As a shortcut, you can also pass a descriptor with the model ID and voice directly to the tts argument in your AgentSession:
from livekit.agents import AgentSessionsession = AgentSession(tts="assemblyai/assemblyai-tts-1:49c443a4-8a1d-5f7e-b70b-98bdbd9823c3",# ... llm, stt, vad, turn_handling, etc.)
import { AgentSession } from '@livekit/agents';const session = new AgentSession({tts: "assemblyai/assemblyai-tts-1:49c443a4-8a1d-5f7e-b70b-98bdbd9823c3",// ... llm, stt, vad, turnHandling, etc.});
Plugin
LiveKit's plugin support for AssemblyAI lets you connect directly to AssemblyAI's Streaming TTS API with your own API key.
Installation
Install the plugin:
uv add "livekit-agents[assemblyai]~=1.8"
pnpm add @livekit/agents-plugin-assemblyai@1.x
Authentication
The AssemblyAI plugin requires an AssemblyAI API key .
Set ASSEMBLYAI_API_KEY in your .env file.
Usage
Use AssemblyAI TTS within an AgentSession or as a standalone speech generator. For example, you can use this TTS in the Voice AI quickstart.
from livekit.plugins import assemblyaisession = AgentSession(tts=assemblyai.TTS(model="assemblyai-tts-1",voice="49c443a4-8a1d-5f7e-b70b-98bdbd9823c3", # Audrey),# ... llm, stt, etc.)
import * as assemblyai from '@livekit/agents-plugin-assemblyai';const session = new voice.AgentSession({tts: new assemblyai.TTS({model: "assemblyai-tts-1",voice: "49c443a4-8a1d-5f7e-b70b-98bdbd9823c3", // Audrey}),// ... llm, stt, etc.});
The plugin keeps a pool of open websocket sessions and reuses them across replies. To open a session before the agent's first reply, call prewarm() on the TTS instance.
Parameters
This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.
modelstringDefault: "assemblyai-tts-1"The model to synthesize with, by name or alias.
voicestringDefault: AudreyThe ID of the voice to use, from the AssemblyAI voice library or a custom voice cloned in your AssemblyAI account. Voice slugs such as "aai-audrey" also work, but slugs can change and IDs don't.
A custom voice speaks only the language of its reference recording and is available only in the data zone where you created it.
languagestringThe language to synthesize, as a code (for example, "es" or "es-MX") or an English name (for example, "spanish"). Defaults to English for library voices, even one recorded in another language, so set this when you use a non-English voice. For a custom voice, defaults to the language of its reference recording.
sample_rateintDefault: 24000Output sample rate in Hz. Valid values: 8000, 16000, 22050, 24000, 44100, 48000. The default is the service's native rate.
word_timestampsboolDefault: TrueWhether to request per-word timings. LiveKit uses them for aligned transcripts.
base_urlstringDefault: "wss://tts.us.assemblyai.com"The Streaming TTS host. Set to "wss://tts.eu.assemblyai.com" to keep text and audio in the EU data zone.
text_pacingbool | SentenceStreamPacerDefault: FalsePaces sentence requests behind the audio already generated for the stream. Set to True to use the default pacer.
To change the voice, language, or model during a session, call update_options() (Python) or updateOptions() (Node.js). A reply that's already playing keeps its voice until it finishes.
Transcription timing
AssemblyAI TTS returns per-word timings by default, which LiveKit uses to sync the agent's transcript with its speech and to record how much of an interrupted reply the user heard. Set use_tts_aligned_transcript=True in your AgentSession configuration to use them. To learn more, see the docs.
Additional resources
The following resources provide more information about using AssemblyAI with LiveKit Agents.