把音訊 URL 作為 user 訊息傳給 Gemini, 可做轉寫 / 摘要 / 翻譯 / 問答
POST /v1/chat/completions
鉴权: {'type': 'bearer', 'prefix': 'sk-', 'description': 'API Key, 使用 `Authorization: Bearer sk-xxx` 鉴权'}
Gemini 原生支援音訊輸入, 通過 `content` 陣列的 `input_audio` 類型傳入。 **支援格式**: mp3 / wav / m4a / aac / flac / opus / aiff **音訊上限**: - 2.5 Pro: 最長約 9.5 小時 (單請求) - 2.5 Flash / Lite: 最長約 9.5 小時 - 3.1 Flash Lite Preview: 支援即時多模態 **典型用法**: 會議轉寫 + 摘要、客服錄音質檢、語言翻譯、情感分析。
model | string | required | 支援音訊的 Gemini 模型, 如 `gemini-2.5-pro` / `gemini-2.5-flash` / `gemini-2.5-flash-lite` |
messages | array | required | |
role | string | required | |
content | array | 內容塊陣列, 含文本提示 + 音訊 | |
type | string | ||
text | string | (type=text) 提示文本 | |
input_audio | object | (type=input_audio) 音訊資料 | |
data | string | 音訊 URL 或 base64 資料 | |
format | string | ||
temperature | number | ||
max_tokens | integer | ||
stream | boolean |
200 — 返回對音訊的理解結果curl https://api.router.ai/v1/chat/completions \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-flash",
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "帮我转写并总结这段会议录音, 按议程分段"},
{"type": "input_audio", "input_audio": {
"data": "https://example.com/meeting.mp3",
"format": "mp3"
}}
]
}
]
}'