Audio

Generate speech from text

Changed on

POST /v1/audio/speech

post/api/v1/audio/speech

Request

  • Base URL: / (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /api/v1/audio/speech
  • Auth: HTTP bearer

Request body

inputstring required

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

instructionsstring nullable

Control the voice with additional instructions. Does not work with tts-1 or tts-1-hd.

modelstring required

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

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

Audio output format for text-to-speech.

speednumber float nullable

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

stream_format'sse' | 'audio'

Stream format for text-to-speech streaming.

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

Voice options for text-to-speech.

Response

Audio generated successfully

Changes