Create speech
POST/audio/speech
Generates audio from the input text.
Body ParametersJSON
input: string
The text to generate audio for. The maximum length is 4096 characters.
maxLength4096
instructions: optional string
Control the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd.
maxLength4096
speed: optional number
The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.
minimum0.25
maximum4
Create speech
curl https://api.openai.com/v1/audio/speech \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy"
}' \
--output speech.mp3
Create speech
curl https://api.openai.com/v1/audio/speech \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy",
"stream_format": "sse"
}'