/v1beta/models/{model}:generateContenthttps://api.linkinfra.aiAuthorization
Bearer TokenAuthorizationBearer <token>Authenticate requests with your API key in the request header:
Authorization: Bearer sk-your-api-keyNeed a key? Create one in the console
Choose a speech-capable model, such as gemini-2.5-flash-preview-tts. inlineData.data contains Base64 audio. Decode according to mimeType; raw PCM cannot be played as an MP3 file.
modelstringrequiredGemini model ID without the models/ prefix.
Request body
application/jsoncontentsarray<object>requiredConversation content in the native Gemini format.
Show child properties2
rolestringContent role: user or model.
partsarray<object>requiredText, image, or audio content parts.
Show child properties2
textstringText content.
inlineDataobjectInline media with mimeType and Base64-encoded data.
generationConfigobjectrequiredSpeech generation settings.
Show child properties2
responseModalitiesarray<string>requiredUse ["AUDIO"] to request audio output.
speechConfigobjectrequiredVoice settings.
Show child properties1
voiceConfigobjectrequiredSet prebuiltVoiceConfig.voiceName, for example Kore.
Response
application/json200Successful responsecandidatesarray<object>Generated candidates. Content is in content.parts.
usageMetadataobjectInput, output, and total token usage.