Skip to content

Sarvam

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 (STT), a conversational LLM, and text-to-speech (TTS), giving you full control over each stage.

VariableRequiredDefaultDescription
SARVAM_API_KEYyesmust be providedYour Sarvam API key.
TELER_API_KEYyesmust be providedYour Teler API key.
NGROK_AUTHTOKENyes (local)nonengrok auth token.
SERVER_DOMAINautononePublic URL exposed to Teler. Detected from ngrok.
SARVAM_STT_MODELnosaaras:v3-realtimeSpeech-to-text model identifier.
SARVAM_LLM_MODELnosarvam-105b-conversationsPrimary conversational LLM.
SARVAM_LLM_MODEL_FALLBACKnosarvam-105bSecondary LLM if primary is unavailable.
SARVAM_TTS_MODELnobulbul:v3Text-to-speech engine.
SARVAM_LANGUAGE_CODEnoen-INLanguage code (e.g. en-IN for English-India, hi-IN for Hindi).
SARVAM_SPEAKERnoshubhTTS voice identity.
STATIC_RESPONSE_TEXTnoDefault greetingGreeting played when the call connects.
Terminal window
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
Terminal window
curl -X POST https://your-domain/api/v1/calls/initiate-call \
-H "Content-Type: application/json" \
-d '{
"fromNumber": "+91XXXXXXXXXX",
"toNumber": "+91XXXXXXXXXX"
}'

The bridge opens independent WebSocket connections to each Sarvam service and orchestrates the pipeline:

  1. Caller audio in: raw audio frames from the Teler call are forwarded to Sarvam’s realtime STT endpoint, transcribed according to SARVAM_STT_MODEL.
  2. 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 to SARVAM_LLM_MODEL_FALLBACK.
  3. LLM response → TTS: the generated text is streamed to Sarvam’s realtime TTS endpoint, synthesized to speech using the configured SARVAM_TTS_MODEL and SARVAM_SPEAKER.
  4. Agent audio out: synthesized audio is forwarded back to the Teler call as binary frames.
  5. Barge-in: when the caller speaks over the agent, the bridge clears buffered audio to allow interruption.
  6. Greeting: a STATIC_RESPONSE_TEXT greeting is played when the call first connects.
SymptomLikely causeFix
401 from SarvamInvalid SARVAM_API_KEYRotate the key; check casing in .env
Agent misunderstands callerWrong language codeSet SARVAM_LANGUAGE_CODE to match the caller’s language (e.g. hi-IN for Hindi, en-IN for English-India)
No greeting on call connectMissing or empty STATIC_RESPONSE_TEXTSet a non-empty greeting in .env
Responses slow after first messagePrimary LLM overloadedThe bridge retries the fallback LLM automatically; check Sarvam status