Skip to main content
POST
Audio speech
Generate audio from a text input. Returns an audio file stream.

Authenticate

Use an API key in the Authorization header.

Request body

string
required
TTS model ID to use. See available speech models for the full list.Examples: gpt-4o-mini-tts, elevenlabs-tts-multilingual-v2
string
required
The text to synthesize. Maximum length is 4096 characters.
string
Voice to use for synthesis. Leave it out to use the provider’s default voice. OpenAI voices: alloy, echo, fable, onyx, nova, shimmer. ElevenLabs voices map automatically from these names or accept raw voice IDs.
string
default:"mp3"
Audio format for the output. Options: mp3, opus, aac, flac, pcm, wav.
number
default:"1.0"
Playback speed of the generated audio. Range: 0.25 to 4.0.

Response

Returns the audio file as a binary stream with Content-Type: audio/mpeg (or the appropriate MIME type for the requested format).

Examples