⚡ New — Kimi K3 is live: bring your own Moonshot key →
Documentation

Add speech-to-text and text-to-speech

← Cookbook

One OpenAI-compatible audio API for transcription and voice — first-party India-resident ASR/TTS by default, ElevenLabs / Sarvam / OpenAI on BYOK, with failover across all of them.

/v1/audio/transcriptions + /v1/audio/speechAccessIntermediate10 min

Audio is a routed modality on BharatRouter: the OpenAI /v1/audio/* wire format, but with failover and residency underneath. The asr and tts aliases lead on first-party India-resident engines (Parakeet for speech-to-text, Kokoro for voice) and fail over to ElevenLabs, Sarvam or OpenAI when you bring a key.

You'll use: /v1/audio/transcriptions and /v1/audio/speech. Reference: Audio.

Speech → text

Post an audio file to /v1/audio/transcriptions. Use the asr alias for the first-party model, or name a specific one (e.g. whisper-large-v3) to pin it. Pass language to bias decoding for Indian languages.

from openai import OpenAI

client = OpenAI(base_url="https://api.bharatrouter.com/v1", api_key="br-...")

with open("call.mp3", "rb") as f:
    r = client.audio.transcriptions.create(
        model="asr",             # first-party Parakeet; fails over on BYOK
        file=f,
        language="hi",           # bias toward Hindi
    )
print(r.text)

Text → speech

Post text to /v1/audio/speech. The tts alias speaks on first-party Kokoro; describe the voice with language / gender / style and the gateway picks a matching voice on whichever engine serves it.

curl https://api.bharatrouter.com/v1/audio/speech \
  -H "Authorization: Bearer br-..." -H "Content-Type: application/json" \
  -o hello.mp3 \
  -d '{
    "model": "tts",
    "input": "Namaste! Aapka swagat hai.",
    "language": "hi",
    "gender": "female",
    "response_format": "mp3"
  }'

Which engine serves you

AliasFirst-party (default)BYOK failoverResidency
asrParakeet (multilingual)ElevenLabs · Groq Whisper · Sarvam · OpenAI🇮🇳 India lead
ttsKokoro (multilingual)ElevenLabs · Sarvam Bulbul · OpenAI🇮🇳 India lead
  • The alias fails over just like chat: a route that errors is skipped and the next engine tries in the same request. x-br-provider tells you who actually served it.
  • BYOK engines (ElevenLabs, Sarvam, OpenAI) need a saved key — add one under BYOK and they join the failover automatically.
  • For low-latency voice, add "stream": true to /v1/audio/speech, or open the bidirectional WebSocket at /v1/audio/speech/stream.

TTS input is capped at 4096 characters per request — chunk longer text on sentence boundaries and concatenate the clips.

More recipes in the Cookbook, or see the fullAPI reference.