把音频 URL 作为 user 消息传给 Gemini, 可做转写 / 摘要 / 翻译 / 问答
POST /v1/chat/completions
Auth: {'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"
}}
]
}
]
}'