API Notes
gemini_3_1_flash_tts_preview returns generated audio as an audio/wav file URL in the task result
gemini_3_1_flash_tts_preview usage is reported with input_text_tokens and output_audio_tokens when token usage is available
Authentication
authorization string required
All APIs require authentication via Bearer Token.
Get API Key:
Visit API Key Management Page to get your API Key.
Usage:
Add to request header:
Authorization: Bearer YOUR_API_KEY
Parameters
model string required
Model ID to use for the request
Value: gemini_3_1_flash_tts_preview
input array required
Input array for the unified generation request
params
objectrequiredText-to-speech parameters
text
stringrequiredText to convert to speech.
promptis also accepted as a compatibility alias, buttextis recommendedvoice_name
stringPrebuilt voice name for speech synthesis
Default:
Kore
Polling
Since audio generation takes time, you need to poll the task status after creation
The initial response returns the task ID and initial status. The actual generated audio URL must be obtained through the task status endpoint
Response Format
error object
Error information. Only present when status is failed
code
integerError code
error_message
stringDetailed error message
output array
Generation results. Only present when status is completed
content
arrayList of generated audio content
type
stringResource type, fixed as
audiomime_type
stringAudio MIME type, fixed as
audio/wavurl
stringGenerated audio file URL
usage object
Usage statistics. Only present when status is completed
extra_info
objectNormalized token usage details
input_text_tokens
integerNumber of input text tokens
output_audio_tokens
integerNumber of generated audio tokens
total_tokens
integerTotal token count
metadata object
Metadata information