Skip to main content
Generate speech from text using the Voice.ai TTS API.
Prerequisites: API key

Available TTS models

Pass the hosted model ID in the model field of any TTS request. If you omit model, English defaults to the standard hosted model. Use the latest IDs for most applications. Use a pinned dated ID when you need the same model snapshot across deploys. You can also fetch current public IDs from List Supported Models.
Hosted Lite: Set model to voiceai-tts-lite-v1-latest and keep language as en. Lite does not support auto or non-English languages.
1

Get a Voice ID (Optional)

Optionally get a voice_id from your dashboard or clone a voice. Skip this to use the default voice.
2

Generate Speech

Generate speech from text. Include voice_id if you have one, or omit it to use the default voice. See the Generate Speech endpoint for details.

Streaming

For lowest latency: Use the WebSocket endpoint for conversational AI or multiple sequential requests.

HTTP Streaming (Simple)

For simple request/response streaming, use the HTTP streaming endpoint:

WebSocket Streaming (Optimal for Conversational AI)

For lowest latency in multi-turn conversations, use the Multi-Context WebSocket (/multi-stream):
WebSocket Close Codes: Errors are communicated via close codes. 1000 = normal, 1007 = invalid data (including validation errors like extra fields on text-only messages), 1008 = auth/credits/policy issue, 1011 = server error. See the Streaming Guide for full error handling documentation.
delivery_mode: Set "delivery_mode": "paced" for paced chunk emission on PCM-based outputs (pcm, pcm_*, ulaw_8000, alaw_8000). Other formats automatically fall back to "raw". Default is "raw" for lowest latency (emits chunks immediately as generated). See the Streaming Guide for all WebSocket options.

Supported Languages

The TTS API supports multiple languages. Specify the language parameter using ISO 639-1 language codes. If not provided, the API defaults to English (en).
Model Selection: The API automatically selects the appropriate model based on the language. English uses voiceai-tts-v1-latest, while all other languages use voiceai-tts-multilingual-v1-latest. For Lite, explicitly set voiceai-tts-lite-v1-latest and language: "en". See the Model ID list for all supported model IDs.

Audio Output

The TTS API supports multiple audio formats with various sample rates and bitrates. Basic formats (mp3, wav, pcm) output at 32kHz sample rate. Format-specific options allow you to control sample rate and bitrate.

32kHz Formats

MP3 Formats (with sample rate and bitrate)

Opus Formats (with sample rate and bitrate)

PCM Formats (with sample rate)

All pcm_* formats use 16-bit signed little-endian mono at the specified sample rate.

WAV Formats (with sample rate)

Telephony Formats

Voice Cloning

Create custom voices from audio samples

Streaming

HTTP & WebSocket streaming (WebSocket for lowest latency)

API Reference

Complete endpoint documentation