Generate audio (text-to-speech)
Request audio output by settingmodalities 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.
output_audio item with the base64-encoded audio and a transcript of what was spoken:
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.