Cartesia Sonic TTS Tutorial: Build a Python Voice Agent with Sonic 3.6
TL;DR
- Cartesia Sonic is a text-to-speech (TTS) model built for real-time voice agents. Cartesia quotes first audio in under 90ms, 44 languages, and voice cloning from about 10 seconds of audio.
- The current model is Sonic 3.6 (
sonic-3.6, August 2026). Sonic 3.5 and Sonic 3 are still supported, and 3.6 is a drop-in upgrade for both. - With the Cartesia plugin for Vision Agents, adding Sonic to a Python voice agent is one line:
tts=cartesia.TTS(model_id="sonic-3.6"). - You can steer the voice with tags for emotion, speed, volume, pauses, and laughter, or swap in a cloned voice with its voice ID.
Note: We first published this tutorial in February 2026 for Sonic 3. Cartesia has since released Sonic 3.5 and 3.6, so we've updated the code to the current Vision Agents release and added sections on model versions, voice controls, voice cloning, and how Cartesia compares to other TTS providers.
Cartesia Sonic is a multilingual speech synthesis model that can produce realistic, natural-sounding voice output when integrated in AI apps. It has low latency, adjustable emotions, multiple language support, and the ability to clone voices from short audio samples.
The Cartesia plugin for Vision Agents makes building voice-enabled apps easier. Installing the plugin allows developers to add voice generation with human intonation and timing to AI services.
This demo walks you through how to build an agent that responds with Sonic's emotionally nuanced voice.
Key Features of the Demo
- A voice agent that speaks with realistic and low-latency response powered by Cartesia Sonic.
- It offers voice customization, sample rate adjustment, and voice cloning.
- The text-to-speech integration works in any agentic pipeline for natural-sounding conversations.
Sonic 3 vs. Sonic 3.5 vs. Sonic 3.6
Cartesia ships Sonic as dated snapshots. Each model ID, like sonic-3.6, points to the latest stable snapshot of that version.
| Model ID | Released | Languages | Status |
|---|---|---|---|
sonic-3.6 |
August 27, 2026 | 44 | Current. Cartesia's recommended model |
sonic-3.5 |
May 4, 2026 | 42 | Stable. The Vision Agents plugin's default |
sonic-3 |
October 27, 2025 | 42 | Stable. The original October 2025 snapshot sunset on October 20, 2026, and sonic-3 now points to the January 2026 snapshot |
According to Cartesia's migration guide, Sonic 3.5 is a drop-in replacement for Sonic 3: voice IDs and requests work unchanged, and it brings more natural pacing, cleaner audio, and better reading of codes, phone numbers, and emails. Sonic 3.6 improves naturalness and pronunciation again and adds Odia and Urdu. Voices cloned on older models also work on 3.6.
If you're on Sonic 3 today, upgrading is a one-word change to model_id.
Architecture Overview
- Cartesia Sonic 3.6 for speech synthesis.
- Cartesia Ink for speech-to-text and turn detection.
- Language Model: Use any preferred LLM (the demo uses Gemini).
- Vision Agents: Python framework for building voice/vision apps.
- Stream Video: A network transport for audio/video communication.
The original demo used Deepgram for speech recognition and Smart-Turn for turn detection. Both still work with Vision Agents, but Cartesia's own Ink model now handles transcription and turn detection, so this version needs one fewer API key.
Before You Start
Get the following API credentials and store them as environment variables in a .env file in your project.
CARTESIA_API_KEY=...
GOOGLE_API_KEY=... # Available in Google AI Studio
STREAM_API_KEY=...
STREAM_API_SECRET=...Quickstart
# Create a project
uv init cartesia-agent && cd cartesia-agent
# Install Vision Agents with the plugins this demo uses
uv add "vision-agents[getstream, cartesia, gemini]" python-dotenvExecutable Script
Add this Python script to your project as agent.py.
import logging
from dotenv import load_dotenv
from vision_agents.core import Agent, AgentLauncher, Runner, User
from vision_agents.plugins import cartesia, gemini, getstream
logger = logging.getLogger(__name__)
load_dotenv()
async def create_agent(**kwargs) -> Agent:
# Create agent with Cartesia speech-to-text and text-to-speech
agent = Agent(
edge=getstream.Edge(),
agent_user=User(name="TTS Bot", id="agent"),
instructions="You're a friendly voice assistant. Keep replies short and conversational.",
stt=cartesia.STT(),
llm=gemini.LLM("gemini-3-flash-preview"),
tts=cartesia.TTS(model_id="sonic-3.6"),
)
return agent
async def join_call(agent: Agent, call_type: str, call_id: str, **kwargs) -> None:
# Create a call
call = await agent.create_call(call_type, call_id)
# Join call and wait
async with agent.join(call):
await agent.responses.create("tell me something interesting in a short sentence")
await agent.finish()
if __name__ == "__main__":
Runner(AgentLauncher(create_agent=create_agent, join_call=join_call)).cli()Then run it:
uv run agent.py runThe CLI prints a link. Open it to join the call in your browser, prompt the agent with your voice, and hear a response from the Sonic speech generation model.
Configuring the Voice
The cartesia.TTS() class takes four options:
| Parameter | Default | What it does |
|---|---|---|
model_id |
"sonic-3.5" |
Which Sonic model to use |
voice_id |
A default Cartesia voice | Any voice from the Cartesia voice library, or one you've cloned |
sample_rate |
16000 |
Output sample rate in Hz: 8000, 16000, 22050, 24000, 44100, or 48000 |
api_key |
CARTESIA_API_KEY env var |
Your Cartesia API key |
To use a different voice, copy its ID from the Cartesia playground:
from vision_agents.plugins import cartesia
tts = cartesia.TTS(
model_id="sonic-3.6",
voice_id="your-voice-id",
sample_rate=24000,
)Use 8000 Hz for phone calls. The Vision Agents phone integration uses 8kHz audio, which is what telephony networks carry.
Emotion, speed, and laughter
By default, Sonic reads the emotional context of the text and adjusts its delivery to match. To control it directly, Cartesia supports inline tags in the text it speaks:
- Emotion:
<emotion value="excited"/>. Emotion tags are in beta and English-only. - Speed:
<speed ratio="1.2"/>, from 0.6 to 1.5. - Volume:
<volume ratio="1.5"/>, from 0.5 to 2.0. - Pauses:
<break time="500ms"/>. - Laughter:
[laughter]. - Spelling: wrap codes or names in
<spell></spell>to read them letter by letter.
Sonic treats these tags as guidance rather than strict rules. In a voice agent, the LLM writes the text, so the easiest way to use the tags is to tell the LLM about them in its instructions. The narrator example in the Vision Agents repo does exactly that:
from vision_agents.core import Agent, User
from vision_agents.plugins import cartesia, gemini, getstream
agent = Agent(
edge=getstream.Edge(),
agent_user=User(name="Narrator", id="agent"),
instructions=(
"You're the narrator of a story. Use Cartesia tags to make the story expressive: "
'<emotion value="excited"/> or <emotion value="sad"/> to change emotion, '
'<speed ratio="0.8"/> to slow down, <break time="1s"/> for dramatic pauses, '
"and [laughter] for funny moments."
),
stt=cartesia.STT(),
llm=gemini.LLM("gemini-3-flash-preview"),
tts=cartesia.TTS(model_id="sonic-3.6"),
)Cloning a voice
Cartesia's instant voice cloning needs about 10 seconds of audio, and Sonic 3.6 can learn from up to 60 seconds to better keep the speaker's accent. Record or upload a clip in the Cartesia playground, or call the Clone Voice API, then pass the new voice's ID as voice_id.
For voices with a rare accent or a distinctive character, Cartesia also offers Professional Voice Cloning, which trains on 30 minutes or more of audio from one speaker.
Cartesia vs. Other TTS Providers
Vision Agents has plugins for several TTS providers, so you can swap Cartesia for another one by changing the tts= line. A quick guide to the main options:
| Provider | Best for | Vision Agents tutorial |
|---|---|---|
| Cartesia Sonic | Low latency, emotion tags, and voice cloning from short clips | This post |
| ElevenLabs | The largest voice library and very natural English | ElevenLabs TTS with Vision Agents |
| Inworld | Life-like voices for games and interactive apps | Inworld TTS plugin |
| Grok TTS | Teams already using xAI models | Grok text-to-speech |
| On-device models | Privacy and offline use, with no API costs | Pocket TTS and best on-device TTS models |
For a deeper look at how neural TTS works and what drives latency, read how text-to-speech works. For a wider comparison of complete voice agent platforms, see the best AI voice agents.
Where To Go From Here
- Grab the source code from GitHub.
- Check out other Vision Agents sample apps.
- Visit the Vision Agents documentation.
- Refer to the Cartesia plugin for more configuration options.
- Follow our step-by-step guide to building an AI voice agent with Python and WebRTC, or see how Stream powers voice AI in production.
FAQ
What is Cartesia Sonic?
Cartesia Sonic is a text-to-speech model from Cartesia, built for real-time voice agents. It turns text into natural-sounding speech in 44 languages, with emotion and speed controls and voice cloning. The current version is Sonic 3.6.
How fast is Cartesia Sonic?
Cartesia quotes first audio in under 90 milliseconds. In a full voice agent, total response time also depends on your speech-to-text model, LLM, and network, so measure the whole pipeline. Our guide to real-time AI agent latency breaks this down.
Is Cartesia Sonic 3 still supported?
Yes. The sonic-3 model ID still works and now points to a January 2026 snapshot. The original October 2025 snapshot sunset on October 20, 2026. Cartesia recommends Sonic 3.6 for new projects, and switching is a one-word change to the model ID.
Can Cartesia clone voices?
Yes. Instant voice cloning works from about 10 seconds of audio, and Sonic 3.6 can use up to 60 seconds. Professional Voice Cloning trains on 30 minutes or more of audio for higher fidelity.
How does Cartesia compare to ElevenLabs?
Both are leading low-latency TTS providers with voice cloning. Cartesia focuses on speed and inline emotion tags, while ElevenLabs has the largest voice library. Both have Vision Agents plugins, so you can try each by changing one line of code.
Does Cartesia have a Python SDK?
Yes. Cartesia publishes the cartesia Python package. If you're building a voice agent, the Vision Agents Cartesia plugin wraps it and handles streaming audio into a call for you.
