TOOL WIKI · VOICE & REALTIME
Cartesia
Provides voice-generation and related audio capabilities for applications.
Jump to a section 10 sections
EXAMPLE USE CASE
Generate low-latency speech from a verified response
A spoken support interface needs capture, turn handling, transcription or playback with explicit media formats and a verifiable outcome.
- Input
- A fixed support sentence, configured voice and explicit output format.
- Expected output
- A WAV encoded as 24 kHz mono PCM.
- Success check: The output WAV contains the supplied text at the configured sample rate.
- Try a failure: Verify the returned container/encoding before playback and handle invalid voice IDs.
Example scope: Actual TTS bytes request using the stated API version; it does not perform order lookup.
Capture an explicitly authorized audio stream with a known sample format.
Transcribe the speech and preserve interruption signals.
processTo 03 · Agent + toolsResolve the task and authorize business actions before generating a reply.
resultTo 04 · CartesiaA voice pipeline that needs a configurable speech layer. Measure actual streaming latency and interruption handling in your client.
Play the returned audio and cancel stale playback when the user interrupts.
Measure audio delay, interruption recovery, and whether the user task succeeded.
Result or stopping point
A voice pipeline that needs a configurable speech layer. Measure actual streaming latency and interruption handling in your client.
When to consider it
- A voice pipeline that needs a configurable speech layer.
A design decision to make
- Measure actual streaming latency and interruption handling in your client.
Prerequisites and setup
- Python 3.11+ and provider credentials where stated. Audio/provider calls may incur usage.
- Use a short synthetic recording or your own test speech; no real customer audio is needed.
python3 -m venv .venv
source .venv/bin/activate
pip install requests
export CARTESIA_API_KEY="YOUR_KEY"
export CARTESIA_MODEL_ID="YOUR_ENABLED_TTS_MODEL"
export CARTESIA_VOICE_ID="YOUR_AVAILABLE_VOICE_ID"Try a small integration
speak.py
import os
import requests
response = requests.post("https://api.cartesia.ai/tts/bytes",timeout=60,
headers={"Authorization":"Bearer "+os.environ["CARTESIA_API_KEY"],"Cartesia-Version":"2026-08-14"},
json={"model_id":os.environ["CARTESIA_MODEL_ID"],"voice":os.environ["CARTESIA_VOICE_ID"],
"transcript":"Your order is packed. The delivery date is not available yet.",
"output_format":{"container":"wav","encoding":"pcm_s16le","sample_rate":24000}})
response.raise_for_status()
with open("reply.wav","wb") as output:
output.write(response.content)
print("Saved reply.wav:",len(response.content),"bytes")Run and check the result
python speak.py
# Play reply.wav in an audio player.- The output WAV contains the supplied text at the configured sample rate.
- This request uses the 2026-08-14 contract, where voice is a string ID. Older API versions use a different voice shape.
Common failures
- No audio: verify input/output codecs, sample rate, channel count, permission and selected device separately.
- Handle provider errors and interrupted streams explicitly; do not interpret a disconnected call as a completed business action.
Production decisions
- Keep permanent credentials on a trusted server; use short-lived session credentials for clients. Define audio/transcript retention and consent.
- Measure end-of-turn latency, interruption handling, silence, reconnects, tool deadlines and session cost with real microphones and networks.
- Pin the API version, test upgrades and align the returned encoding with your transport/player rather than relabeling raw audio bytes.
Keep exploring
Explore the same layer
Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.