Gemini 音訊理解

把音訊 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: 支援即時多模態 **典型用法**: 會議轉寫 + 摘要、客服錄音質檢、語言翻譯、情感分析。

请求体

modelstringrequired支援音訊的 Gemini 模型, 如 `gemini-2.5-pro` / `gemini-2.5-flash` / `gemini-2.5-flash-lite`
messagesarrayrequired
    rolestringrequired
    contentarray內容塊陣列, 含文本提示 + 音訊
        typestring
        textstring(type=text) 提示文本
        input_audioobject(type=input_audio) 音訊資料
            datastring音訊 URL 或 base64 資料
            formatstring
temperaturenumber
max_tokensinteger
streamboolean

响应

调用示例

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"
          }}
        ]
      }
    ]
  }'

API 文件