v39

latestOpenAPI 3.1.0raw.githubusercontent.com2025-11-2613102194.9 KB
v1
audio

Create Speech

Generate speech audio from text.

Generates audio from the input text using text-to-speech models. Supports multiple voices and output formats including mp3, opus, aac, flac, wav, and pcm.

Returns streaming audio data that can be saved to a file or streamed directly to users.

post/v1/audio/speech

Request body

modelstring required

One of the available TTS models: openai/tts-1, openai/tts-1-hd or openai/gpt-4o-mini-tts.

inputstring required

The text to generate audio for. The maximum length is 4096 characters.

voice'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'fable' | 'onyx' | 'nova' | 'sage' | 'shimmer' | 'verse' required

The voice to use when generating the audio. Supported voices are alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, and verse. Previews of the voices are available in the Text to speech guide.

instructionsstring nullable

Control the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd.

response_format'mp3' | 'opus' | 'aac' | 'flac' | 'wav' | 'pcm' nullable

The format to audio in. Supported formats are mp3, opus, aac, flac, wav, and pcm.

speednumber nullable

The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.

stream_format'sse' | 'audio' nullable

The format to stream the audio in. Supported formats are sse and audio. sse is not supported for tts-1 or tts-1-hd.

Example request

{
  "model": "openai/tts-1",
  "input": "Hello, how are you today?",
  "voice": "alloy",
  "response_format": "mp3",
  "speed": 1,
  "stream_format": "sse"
}

Response

Audio file stream