Zum Hauptinhalt springen
OrcaRouter stellt zwei Pfade für Text-zu-Sprache bereit, je nachdem, welches TTS-Modell des Anbieters du verwenden möchtest.

OpenAI-Form: /v1/audio/speech

Verwende dies mit der TTS-Modellfamilie von OpenAI — openai/tts-1, openai/tts-1-hd, openai/gpt-4o-mini-tts, und ähnliche:
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
Die Antwort ist binäres Audio. Der Content-Type-Header sagt dir, welches Format der Upstream zurückgegeben hat (audio/mpeg, audio/wav, audio/opus, oder audio/flac).

Gemini TTS: natives /v1beta/

Gemini-TTS-Preview-Modelle (z. B. google/gemini-2.5-flash-preview-tts) werden nicht auf /v1/audio/speech bedient — rufe sie stattdessen über die native Oberfläche von Gemini auf:
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"}}
      }
    }
  }'
Die Audio-Bytes kommen als Base64 im inlineData-Feld der Antwort zurück. Siehe Googles Gemini-TTS-Dokumentation für den vollständigen Satz von Stimmnamen und Konfigurationsoptionen.

Siehe auch