跳转到主要内容
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 文档。

另见