Overview
Sarvam AI provides a modular speech and language platform with deep support for Indian languages and code-mixed speech. Unlike bundled voice-agent APIs, the Teler bridge orchestrates three independent Sarvam services — speech-to-text, a conversational LLM, and text-to-speech — giving you full control over each stage rather than a single opaque pipeline.
Each stage is independently configurable: choose the STT model, LLM, TTS model, language, and speaker separately. If the primary LLM becomes unavailable, the bridge automatically falls back to a secondary model, so a single provider hiccup doesn’t take the whole call down.
Key Features
- Independent pipeline stages — STT, LLM, and TTS are three separate, independently configurable services, not one bundled black box — swap any one stage without touching the others.
- Automatic LLM fallback — If the primary conversational model becomes unavailable mid-call, the bridge automatically retries against a secondary model, rather than dropping the response entirely.
- Built for Indian languages and code-mixed speech — Language and speaker are both configurable per deployment, with native support for code-mixed input (e.g., Hindi-English) rather than treating it as an edge case.
- Barge-in support out of the box — When the caller speaks over the agent, the bridge clears buffered audio so the caller can interrupt naturally.
How to Integrate
Prerequisites
- A Sarvam account with an API key
- A Teler account with an active API key
- One Teler phone number on your account
- An ngrok auth token (for local development)
- Docker and Docker Compose
Configuration
| Variable | Required | Description |
|---|---|---|
SARVAM_API_KEY | Yes | Your Sarvam API key. |
TELER_API_KEY | Yes | Your Teler API key. |
NGROK_AUTHTOKEN | Yes (local) | ngrok auth token. |
The STT model, LLM (plus fallback), TTS model, language, speaker, and greeting are all configurable too, each with a sensible default — see the repo’s .env.example for the full list.
Step 1: 5-minute setup
git clone https://github.com/frejun-tech/teler-sarvam-node-bridge
cd teler-sarvam-node-bridge
cp .env.example .env
docker compose up -d --build Fill in your .env with the required variables above before starting the containers.
Step 2: Initiate a call
curl -X POST https://your-domain/api/v1/calls/initiate-call \
-H "Content-Type: application/json" \
-d '{
"fromNumber": "+91XXXXXXXXXX",
"toNumber": "+91XXXXXXXXXX"
}' How the pipeline works, end to end
- Caller audio in — Raw audio frames from the Teler call are forwarded to Sarvam’s realtime STT endpoint, transcribed according to
SARVAM_STT_MODEL. - Transcription → LLM — The transcribed text is sent to Sarvam’s chat-completions API, which generates a response using the primary LLM (
SARVAM_LLM_MODEL). If that model is unavailable, the bridge falls back toSARVAM_LLM_MODEL_FALLBACK. - LLM response → TTS — The generated text is streamed to Sarvam’s realtime TTS endpoint, synthesized to speech using the configured
SARVAM_TTS_MODELandSARVAM_SPEAKER. - Agent audio out — Synthesized audio is forwarded back to the Teler call as binary frames.
- Barge-in — When the caller speaks over the agent, the bridge clears buffered audio to allow interruption.
- Greeting — A
STATIC_RESPONSE_TEXTgreeting is played when the call first connects.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
401 from Sarvam | Invalid SARVAM_API_KEY | Rotate the key; check casing in .env. |
| Agent misunderstands caller | Wrong language code | Set SARVAM_LANGUAGE_CODE to match the caller’s language (e.g. hi-IN for Hindi, en-IN for English-India). |
| No greeting on call connect | Missing or empty STATIC_RESPONSE_TEXT | Set a non-empty greeting in .env. |
| Responses slow after first message | Primary LLM overloaded | The bridge retries the fallback LLM automatically; check Sarvam status. |
Integration at a Glance
| Requirements | A Sarvam account with an API key, a Teler account with an active API key and one phone number, Docker and Docker Compose, and an ngrok auth token for local development |
| Setup type | Self-hosted bridge — clone the repo, configure .env, and run via Docker Compose; not dashboard-configured |
| Support | support@frejun.com |