Create speech
post https://api.openai.com/v1/audio/speech
Generates audio from the input text.
Request body
One of the available TTS models: tts-1
or tts-1-hd
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.
The format to audio in. Supported formats are mp3
, opus
, aac
, flac
, wav
, and pcm
.
Returns
The audio file content.
Example request
1
2
3
4
5
6
7
8
9
curl https://api.openai.com/v1/audio/speech \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy"
}' \
--output speech.mp3