Generate content (Gemini)
音訊
Gemini 原生格式
Gemini-native generateContent interface for text chat, multimodal media recognition (images, audio, video), speech synthesis, and image generation with structured parts. Use generationConfig to request specific response modalities such as speech (speechConfig) or images (imageConfig).
POST
Generate content (Gemini)
本頁使用與 生成內容(Gemini) 相同的
generateContent 操作,上方 playground 已預先填入純文字對話範例。以下說明可加入 generationConfig 的 Gemini 原生欄位,以便透過結構化 parts 請求音訊理解或音訊生成。
請將
generationConfig.responseModalities 設為 ["AUDIO"] 以要求音訊輸出,並設定 generationConfig.speechConfig.voiceConfig.prebuiltVoiceConfig.voiceName 來選擇生成語音時要使用的預建聲音。Gemini 原生請求欄位
範例:請求語音音訊
回應欄位
回應遵循標準generateContent 結構。當要求音訊輸出時,回傳的 parts 會包含內嵌音訊資料而非文字:
array
模型回傳的候選回應。
object
Token 計量資訊,包括
promptTokenCount、candidatesTokenCount 與 totalTokenCount。object
在適用情況下的 prompt 阻擋回饋資訊。
回應範例
200
授權
Your DGrid API key. All endpoints use Authorization: Bearer <DGRID_API_KEY>.
路徑參數
Target model ID, such as gemini-1.5-pro.
主體
application/json

