Body
Required
-
The text to generate audio for. The maximum length is 4096 characters.
Maximum length is
4096
. -
Control the voice of your generated audio with additional instructions. Does not work with
tts-1
ortts-1-hd
.Maximum length is
4096
. voice
string Required The voice to use when generating the audio. Supported voices are
alloy
,ash
,ballad
,coral
,echo
,fable
,onyx
,nova
,sage
,shimmer
, andverse
. Previews of the voices are available in the Text to speech guide.-
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
. -
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
. Default value is1
.
POST
/audio/speech
curl \
--request POST 'https://api.openai.com/v1/audio/speech' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"model":"string","input":"string","instructions":"string","voice":"ash","response_format":"mp3","speed":1}'
Request examples
{
"model": "string",
"input": "string",
"instructions": "string",
"voice": "ash",
"response_format": "mp3",
"speed": 1
}