Create speech
POST
/audio/speechGenerates audio from the input text.
Returns the audio file content, or a stream of audio events.
The tts-1, tts-1-hd, gpt-4o-mini-tts, gpt-4o-mini-tts-2025-03-20, and
gpt-4o-mini-tts-2025-12-15 models are deprecated and scheduled to shut down
on January 6, 2027. These examples use the existing Speech API; for new
integrations, migrate to gpt-realtime-2.1-mini through the
Realtime API. See the
deprecation schedule for migration details.
Body ParametersJSON
Returns
file
Content type: application/octet-stream
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"
}'