Overview
CARTER uses Cartesia’s Sonic model for ultra-realistic voice generation with emotional expression. This reference covers the key endpoints and parameters.Text-to-Speech Endpoints
Generate Audio (Bytes)
Generate complete audio files:Stream Audio (SSE)
Server-Sent Events for streaming:WebSocket Connection
For lowest latency:Parameters
Model ID
string
required
The model to use for generation. Use
"sonic" for latest features.Options: "sonic", "sonic-2", "sonic-turbo"Transcript
string
required
The text to convert to speech. Supports SSML tags for advanced control.
Voice
object
required
Voice configuration object
Output Format
object
required
Audio output configuration
Experimental Voice Controls
object
Control emotions and speech characteristics
Voice Emotions
Available emotional controls:
Example:
Response Format
Bytes Response
Stream Response (SSE)
WebSocket Messages
Voice Management
List Voices
Get Voice
Clone Voice
Rate Limits
Error Codes
Example error response:
SDK Methods
Best Practices
Choose the Right Endpoint
Choose the Right Endpoint
- Bytes: For pre-generated audio files
- SSE: For streaming in web applications
- WebSocket: For lowest latency in real-time apps
Optimize Sample Rate
Optimize Sample Rate
- 16000 Hz: Voice applications (lowest bandwidth)
- 22050 Hz: Balanced quality/size
- 44100 Hz: High quality music/effects
Use Context IDs
Use Context IDs
Maintain context_id across related requests for better latency and coherence.
Handle Rate Limits
Handle Rate Limits
Implement exponential backoff and retry logic for 429 errors.
Resources
For the most up-to-date API reference, always check the official Cartesia documentation.
