Skip to main content

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

model_id
string
required
The model to use for generation. Use "sonic" for latest features.Options: "sonic", "sonic-2", "sonic-turbo"

Transcript

transcript
string
required
The text to convert to speech. Supports SSML tags for advanced control.

Voice

voice
object
required
Voice configuration object

Output Format

output_format
object
required
Audio output configuration

Experimental Voice Controls

_experimental_voice_controls
object
Control emotions and speech characteristics

Voice Emotions

Available emotional controls:
EmotionLevels
Positivitylowest, low, high, highest
AngerUse tag directly
SadnessUse tag directly
SurpriseUse tag directly
CuriosityUse tag directly
Example:

Response Format

Bytes Response

Stream Response (SSE)

WebSocket Messages

Voice Management

List Voices

Get Voice

Clone Voice

Rate Limits

PlanRequests/minConcurrent Streams
Free202
Pro10010
EnterpriseCustomCustom

Error Codes

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid API key
429Rate Limit Exceeded
500Server Error
Example error response:

SDK Methods

Best Practices

  • Bytes: For pre-generated audio files
  • SSE: For streaming in web applications
  • WebSocket: For lowest latency in real-time apps
  • 16000 Hz: Voice applications (lowest bandwidth)
  • 22050 Hz: Balanced quality/size
  • 44100 Hz: High quality music/effects
Maintain context_id across related requests for better latency and coherence.
Implement exponential backoff and retry logic for 429 errors.

Resources

For the most up-to-date API reference, always check the official Cartesia documentation.