Create speech

POST /audio/speech

Generates audio from the input text.

application/json

Body Required

  • model string Required

    Any of:

    One of the available TTS models: tts-1 or tts-1-hd

    One of the available TTS models: tts-1 or tts-1-hd

    Values are tts-1 or tts-1-hd.

  • input string Required

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

    Maximum length is 4096.

  • voice string Required

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

    Values are alloy, echo, fable, onyx, nova, or shimmer.

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

    Values are mp3, opus, aac, flac, wav, or pcm. Default value is mp3.

  • speed number

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

    Minimum value is 0.25, maximum value is 4.0. Default value is 1.0.

Responses

POST /audio/speech
curl \
 -X POST https://api.openai.com/v1/audio/speech \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"model":"string","input":"string","voice":"alloy","response_format":"mp3","speed":1.0}'
Request example
{
  "model": "string",
  "input": "string",
  "voice": "alloy",
  "response_format": "mp3",
  "speed": 1.0
}