v1

latestOpenAPI 3.0.32026-07-132681171.6 KB

Create speech

Synthesizes audio from input text using a text-to-speech model. By default the response is a binary audio stream in the requested format. When stream_format is sse, the response is a Server-Sent Events stream of speech.audio.delta and speech.audio.done events with base64-encoded audio chunks.

post/v1/audio/speech

Request body

modelstring required

The text-to-speech model to use, prefixed with the provider slug. Currently only OpenAI models are supported.

inputstring required

The text to synthesize into speech. 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.

instructionsstring

Additional steering for the voice (tone, accent, pacing). Supported by openai/gpt-4o-mini-tts only. Ignored by openai/tts-1 and openai/tts-1-hd.

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

The audio container format for the synthesized output.

speednumber float

Playback speed of the generated audio. 1.0 is normal speed.

stream_formatstring

Optional and not recommended for most clients. Omit this field to get the default response shape: raw audio bytes in the requested response_format. Set to sse only with openai/gpt-4o-mini-tts to receive a Server-Sent Events stream of speech.audio.delta and speech.audio.done events with base64-encoded audio chunks. The router rejects sse with openai/tts-1 or openai/tts-1-hd, and rejects audio with openai/gpt-4o-mini-tts.

Example request

{
  "model": "openai/gpt-4o-mini-tts",
  "input": "The quick brown fox jumped over the lazy dog.",
  "voice": "alloy",
  "instructions": "Speak in a warm, friendly tone.",
  "response_format": "mp3",
  "speed": 1
}

Response

Audio bytes stream (when stream_format is audio) or Server-Sent Events stream (when stream_format is sse).