Generate audio (text-to-speech)
Request audio output by settingmodalities to ["text", "audio"]. The response includes the text reply and a base64-encoded recording of it.
Audio configuration
Audio output is always a WAV file: 24 kHz, 16-bit mono. The voice follows the language of the reply, which the API detects from the text (see Supported languages). The request’saudio object (voice and format) is accepted but has no effect, so the examples omit it.
output_audio item with the base64-encoded audio and a transcript of what was spoken:
data field contains the complete WAV file. The transcript field contains the text that was spoken, which is the reply’s output text. If speech synthesis fails, the response still completes, without an output_audio item.