Cookbook / Coding voice mode
Talk to your
coding agent
The tests pass. Should I open the pull request?
Example run. A scripted example of the app at work, not a recording.
- Models
- sonic-3.6, ink-2
- Languages
- English, Spanish, French, Hindi, Japanese
- License
- Apache-2.0
- Stack
- PythonFastMCPsounddeviceuv
- Cartesia products
- Sonic 3.6Ink 2
What it does
It works with Claude Code, Cursor and Codex. There is no push-to-talk key and no silence timeout to tune, because Ink 2 decides when you have finished. It works the same way as mbailey/voicemode, an open-source voice server for coding agents, so an agent that knows one can use the other.
Run it yourself
Get the server
Run the commands below. You need uv, a microphone and headphones. On Linux, install libportaudio2 first.
Environment variables - CARTESIA_API_KEY
play.cartesia.ai/keys- CARTESIA_VOICE_ID
- Optional. A voice from
play.cartesia.ai/voices. Defaults to Daniel (en-US) - CARTESIA_TURN_END_TIMEOUT_MS
- Optional. 640 to 11200, how long a pause can be before Ink 2 ends your turn
- CARTESIA_KEYTERMS
- Optional. Comma-separated names to bias transcription toward
Install it in your agent
setup.shrunsuv syncand cartesia-voice-mode install for claude, cursor, codex or all. Add--dry-runto see what would change.Start talking
Restart the agent and say, or type, "let's talk" or "voice mode". If nothing happens,
uv run cartesia-voice-modedoctor checks the key.
Build it with your coding agent
One prompt that tells your coding agent where to start and what to read first.
Prompt
Set up voice mode for my coding agent with Cartesia. Start from https:/ and follow its AGENTS.md for the commands, files and rules. It is a local stdio MCP server with a converse tool: Sonic 3.6 (sonic-3.6) speaks the message over /tts/sse, then Ink 2 (ink-2) on /stt/turns/websocket listens until turn.end and returns the transcript as the tool result. Install it with ./setup.sh for my client, and keep the API key out of the client config. If I don't have a Cartesia API key yet, follow https:/ to get one.
How it works
/tts/sse and plays it/stt/turns/websocketturn.end transcript, read as your next messageWhy it works this way
Turn detection ends your turn
The server waits for Ink 2's turn.end event, which means Ink 2 thinks you have finished. A pause mid-sentence does not cut you off the way a fixed silence timeout would.
Long waits need a longer timeout in Codex
Codex stops a tool call after 60 seconds by default. One voice turn plays the message and then listens for up to 120 seconds, so the setup script raises Codex's tool_timeout_sec to 180. It edits your Codex config in place and keeps your comments. If you let it listen longer, raise that timeout too.
Make it yours
Change the voice
Set CARTESIA_VOICE_ID, or ask the agent to call the list_voices tool and pick one.
Speak another language
Ink 2 detects English, Spanish, French, Hindi and Japanese by itself. Set CARTESIA_LANGUAGE and a matching CARTESIA_VOICE_ID so Sonic answers in the same language.
Teach it your words
Put repo and library names in CARTESIA_KEYTERMS so Ink 2 spells them the way your code does.
Join the teams making the switch to Cartesia
Questions
Which coding agents does it work with?
Claude Code, Cursor and Codex. The setup script installs it for one of them or all three.
Is my Cartesia API key safe?
Yes. The installer writes only the command that starts the server into your agent's config. The key stays in your shell, or in a file only you can read if you pass --save-key, and it never shows up in error messages or logs.
Can I interrupt the agent while it talks?
No. The microphone opens only after the agent finishes speaking, so it never hears itself, and there is no echo cancellation. Use headphones.
How fast is it?
It depends on your network and region. The server prints how long Sonic took to start speaking on every call, so you can check. To change how long a pause has to be before your turn ends, set CARTESIA_TURN_END_TIMEOUT_MS.
How is this different from mbailey/voicemode?
That project can also run local models and use other voice providers. This server uses Cartesia only.
Is there a step-by-step guide to this template?
Yes. The recipe walks through the code, the README covers setup, environment variables and deployment, and the Ink 2 turn detection docs explain the Cartesia side.
More from the cookbook
Get started today
Talk to an expert.
Connect with a member of our team and learn how Cartesia can help you build world-class voice experiences.
Start building.
Access our models via API and bring a voice agent into production in minutes.

