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
The model to use for generation. Use
"sonic" for latest features.Options: "sonic", "sonic-2", "sonic-turbo"Transcript
The text to convert to speech. Supports SSML tags for advanced control.
Voice
Voice configuration object
Output Format
Audio output configuration
Experimental Voice Controls
Control emotions and speech characteristics
Voice Emotions
Available emotional controls:| Emotion | Levels |
|---|---|
| Positivity | lowest, low, high, highest |
| Anger | Use tag directly |
| Sadness | Use tag directly |
| Surprise | Use tag directly |
| Curiosity | Use tag directly |
Response Format
Bytes Response
Stream Response (SSE)
WebSocket Messages
Voice Management
List Voices
Get Voice
Clone Voice
Rate Limits
| Plan | Requests/min | Concurrent Streams |
|---|---|---|
| Free | 20 | 2 |
| Pro | 100 | 10 |
| Enterprise | Custom | Custom |
Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 429 | Rate Limit Exceeded |
| 500 | Server Error |
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.
