Skip to main content
Use this guide for spoken output from a Response. To synthesize supplied text directly, see Text to speech. The OpenAI examples use its custom-request method for MKA1 extensions that are not part of the OpenAI Responses types.

Generate audio (text-to-speech)

Request audio output by setting modalities to ["text", "audio"] and specifying a voice and format in the audio parameter. The response includes both the text transcript and base64-encoded audio data.

Audio configuration

Audio is synthesized at 24 kHz, 16-bit mono.
The response contains an output_audio item with the base64-encoded audio and a transcript of what was spoken:
The data field contains the full audio file (268 KB in this example). The transcript field contains the text the model chose to speak — which may differ slightly from the text output.

Save audio to a file

Supported languages

Audio output supports automatic language detection and 20+ languages including English, Chinese, Hindi, Spanish, Arabic, Bengali, Portuguese, Russian, Japanese, Punjabi, German, Korean, French, Turkish, Italian, Thai, Polish, Dutch, Indonesian, Vietnamese, and Urdu. For dedicated speech synthesis, see Text to speech.