Body Required
model string Required
Any of: One of the available TTS models:
tts-1
ortts-1-hd
One of the available TTS models:
tts-1
ortts-1-hd
Values are
tts-1
ortts-1-hd
.-
The text to generate audio for. The maximum length is 4096 characters.
Maximum length is
4096
. -
The voice to use when generating the audio. Supported voices are
alloy
,echo
,fable
,onyx
,nova
, andshimmer
. Previews of the voices are available in the Text to speech guide.Values are
alloy
,echo
,fable
,onyx
,nova
, orshimmer
. -
response_format string
The format to audio in. Supported formats are
mp3
,opus
,aac
,flac
,wav
, andpcm
.Values are
mp3
,opus
,aac
,flac
,wav
, orpcm
. Default value ismp3
. -
speed number
The speed of the generated audio. Select a value from
0.25
to4.0
.1.0
is the default.Minimum value is
0.25
, maximum value is4.0
. Default value is1.0
.
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}'
{
"model": "string",
"input": "string",
"voice": "alloy",
"response_format": "mp3",
"speed": 1.0
}