跳轉到主要內容
OrcaRouter 暴露兩條文本轉語音路徑,取決于你要使用哪家服務商的 TTS 模型。

OpenAI 形態:/v1/audio/speech

用于 OpenAI 的 TTS 模型家族——openai/tts-1openai/tts-1-hdopenai/gpt-4o-mini-tts 等:
curl https://api.orcarouter.ai/v1/audio/speech \
  -H "Authorization: Bearer sk-orca-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/tts-1",
    "input": "Hello, world!",
    "voice": "alloy"
  }' \
  --output speech.mp3
響應是二進制音頻。Content-Type 頭會告訴你上游返回的具體格式 (audio/mpegaudio/wavaudio/opusaudio/flac)。

Gemini TTS:原生 /v1beta/

Gemini TTS 預覽模型(如 google/gemini-2.5-flash-preview-tts不會/v1/audio/speech 上提供——請改用 Gemini 原生接口:
curl "https://api.orcarouter.ai/v1beta/models/google/gemini-2.5-flash-preview-tts:generateContent" \
  -H "Authorization: Bearer sk-orca-..." \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"parts": [{"text": "Hello, world!"}]}],
    "generationConfig": {
      "responseModalities": ["AUDIO"],
      "speechConfig": {
        "voiceConfig": {"prebuiltVoiceConfig": {"voiceName": "Kore"}}
      }
    }
  }'
音頻字節會以 base64 形式出現在響應的 inlineData 字段。完整的語音 名稱與配置項請查閱 Google Gemini TTS 文檔。

另見