跳轉到主要內容
音頻輸入受 Gemini 多模態模型支持,有兩條路徑可選。

路徑 1:/v1/chat/completions 上的 OpenAI 形態 input_audio

網關會自動把 OpenAI 的 input_audio 內容片段翻譯為 Gemini 的 inline_dataformat 字段會映射到正確的 MIME 類型(mp3audio/mp3wavaudio/wav 等等)。
curl https://api.orcarouter.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-orca-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-2.5-flash",
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "What is happening in this audio clip?"},
        {"type": "input_audio", "input_audio": {"data": "<base64>", "format": "mp3"}}
      ]
    }]
  }'

路徑 2:原生 /v1beta/ + inline_data

如果你已經在用 Gemini 原生協議,直接傳 inline_data——無需任何 翻譯。
curl "https://api.orcarouter.ai/v1beta/models/google/gemini-2.5-flash:generateContent" \
  -H "Authorization: Bearer sk-orca-..." \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [
        {"text": "What is happening in this audio clip?"},
        {"inline_data": {"mime_type": "audio/mp3", "data": "<base64>"}}
      ]
    }]
  }'

支持的模型家族

Gemini 多模態模型支持內聯音頻——例如 google/gemini-2.5-flash 及 Gemini 3.x 系列。行為完全與 Google 公布的 Gemini API 一致。

限制

內聯音頻載荷的大小受上游服務商限制。對于較長的文件,常見做法是直接 使用上游的 File API(繞開 OrcaRouter,由你自己的應用直接上傳到服務商)。 當前的尺寸與時長限制請查閱 Google Gemini API 文檔。

另見