◉ Pulse
mithun50 avatar
#22 today

mithun50/Sarvam-S2S

Python AI

Real-time Speech-to-Speech SDK for Indian languages powered by Sarvam AI

Created Jul 25, 2026
Stars
7
Today
+7
Forks
0
Quality
90/100
Momentum
19

README

Fetched from GitHub on Oct 30, 2026, 10:17 PM UTC · README.md

View original on GitHub

Third-party content — Open Source Pulse is not the owner of this repository.

This README belongs to mithun50/Sarvam-S2S and its contributors. We fetch it directly from the project’s public GitHub repository and display it for reference only. All text, code, images and trademarks remain the property of their respective authors. See the repository for its license terms. Copyright / takedown policy.

Sarvam S2S - Speech-to-Speech SDK

PyPI version Python 3.10+ License: MIT GitHub stars GitHub issues Documentation

Real-time conversational AI SDK for Indian languages, powered by Sarvam AI.

Build voice AI assistants with Sarvam's STT + LLM + TTS stack, optimized for 11 Indian languages with sub-second latency.

Features

  • Real-time streaming - Audio in, audio out with ~500-1000ms latency
  • 11 Indian languages - Hindi, Tamil, Telugu, Kannada, Bengali, and more
  • Barge-in support - Interrupt the AI mid-sentence naturally
  • LLM-agnostic - Sarvam-105B/30B, OpenAI, Groq, or any compatible endpoint
  • Context management - RAG, few-shot examples, conversation memory
  • 16+ voices - Natural speech with Bulbul v3 (aditya, priya, kavitha, anushka, rahul, neha, and more)
  • Simple SDK - 5 lines to start a conversation

Quick Start

pip install sarvam-s2s
import asyncio
from sarvam_s2s import SarvamS2S, SarvamS2SConfig

async def main():
    config = SarvamS2SConfig(
        api_key="your-sarvam-api-key",
        stt_language="hi-IN",
        tts_speaker="aditya",
        llm_system_prompt="You are a friendly Hindi assistant.",
    )

    async with SarvamS2S(config) as s2s:
        s2s.on_transcript(lambda t: print(f"You: {t}"))
        s2s.on_response(lambda r: print(f"AI: {r}"))
        await s2s.start()
        await s2s.wait_until_done()

asyncio.run(main())

Setup

  1. Get an API key from dashboard.sarvam.ai
  2. Copy .env.example to .env and add your key:
    cp .env.example .env
    # Edit .env and add your SARVAM_API_KEY
  3. Install dependencies:
    pip install -e .

Web Demo

Try the SDK in your browser with real-time streaming and interrupt support:

pip install fastapi uvicorn python-dotenv httpx
python run_web_demo.py
# Open http://localhost:8000

The web demo supports:

  • Real-time LLM streaming (token-by-token)
  • Sentence-level TTS (audio plays as sentences complete)
  • Interrupt support (send a new message to cancel current response)
  • Multiple speakers and languages

Architecture

Mic -> [STT WebSocket] -> Transcript -> [LLM Stream] -> Text -> [TTS Stream] -> Speaker
         (Saaras v3)                    (Sarvam-105B)           (Bulbul v3)

All three stages stream simultaneously. See Architecture Docs for details.

Models & Endpoints

Component Model Endpoint
STT Saaras v3 wss://api.sarvam.ai/speech-to-text/ws
LLM Sarvam-105B (default) POST https://api.sarvam.ai/v1/chat/completions
TTS Bulbul v3 wss://api.sarvam.ai/text-to-speech/ws
TTS (HTTP) Bulbul v3 POST https://api.sarvam.ai/text-to-speech/stream

Available TTS Speakers

aditya, priya, rahul, neha, anushka, kavitha, karun, hitesh, ritu, rohan, simran, kavya, amit, dev, ishita, shreya

Using Other LLMs

# OpenAI
config = SarvamS2SConfig(
    api_key="sarvam-key",
    llm_provider="openai",
    llm_api_key="sk-...",
    llm_model="gpt-4o-mini",
)

# Groq / Together / Local
config = SarvamS2SConfig(
    api_key="sarvam-key",
    llm_provider="custom",
    llm_base_url="https://api.groq.com/openai/v1",
    llm_api_key="gsk_...",
    llm_model="llama-3.1-70b-versatile",
)

Context Management

# Static context (knowledge base, persona)
config = SarvamS2SConfig(
    api_key="your-key",
    llm_context="Menu: Dosa Rs.80, Coffee Rs.30, Idli Rs.50",
    llm_system_prompt="You are a restaurant assistant.",
    llm_max_history_turns=10,
)

# RAG retriever
def my_retriever(query: str) -> str:
    # Your vector search here
    return relevant_context

config = SarvamS2SConfig(
    api_key="your-key",
    llm_context_retriever=my_retriever,
)

Demos

Demo Description Command
Web Demo Browser-based streaming chat python run_web_demo.py
Basic Hindi Microphone conversation python -m demos.basic_hindi
Multilingual 6 language options python -m demos.multilingual
Custom LLM OpenAI/Groq/Sarvam choice python -m demos.custom_llm
With Context Restaurant bot, RAG, tutor python -m demos.with_context
Simulate Text mode (no mic needed) python -m demos.simulate_conversation

Supported Languages

Hindi, English (Indian), Bengali, Tamil, Telugu, Kannada, Malayalam, Marathi, Gujarati, Punjabi, Odia

Latency

Target: ~500-1000ms from user silence to first audio byte. See Latency Guide for optimization techniques.

Pricing

~₹4.50 per 5-minute conversation (STT ₹30/hr + TTS ₹30/10K chars + LLM ~₹0.50)

Project Structure

sarvam-s2s/
├── src/sarvam_s2s/
│   ├── config.py            # Configuration (defaults: sarvam-105b, aditya)
│   ├── session.py           # Main orchestrator
│   ├── engines/
│   │   ├── stt.py           # Sarvam STT WebSocket
│   │   ├── tts.py           # Sarvam TTS (WebSocket + HTTP streaming)
│   │   └── llm.py           # LLM streaming + context management
│   └── audio/
│       ├── capture.py       # Microphone input
│       └── player.py        # Speaker output
├── demos/
│   ├── web_demo/            # Browser-based demo
│   ├── basic_hindi.py
│   ├── multilingual.py
│   ├── custom_llm.py
│   ├── with_context.py
│   └── simulate_conversation.py
├── run_web_demo.py          # Quick-start web demo
├── .env.example             # Environment template
└── docs/
    ├── ARCHITECTURE.md      # System architecture
    └── LATENCY.md           # Latency optimization guide

Development

git clone https://github.com/mithun50/Sarvam-S2S
cd sarvam-s2s
pip install -e ".[dev]"
pytest

License

MIT

Rendered by GitHub from the repository’s README. Scroll to read the full file.
First trending

Jul 26, 2026

first spotted on the list

Best rank

#22

highest position reached

Appearances

1

times on the trending list

Quality score

90

out of 100

Momentum

19

trend strength indicator

Star velocity

0.07

stars per day since creation

Activity — last 60 days

daily counts, collected every 6 hours
  • Stars
  • Forks
  • Merged PRs
  • Issues
  • Closed issues

Collecting activity data since launch — check back in a few days.

Star history

total stars per snapshot

Not enough snapshots yet — check back soon.

Rank history

position on trending · lower is better

Not enough snapshots yet — check back soon.

3D card for your website

Live HTML card with a glass surface and pointer tilt. Paste the iframe on any website.

<iframe src="https://www.notionpulse.cc/embed/mithun50/Sarvam-S2S" width="420" height="240" style="border:0;max-width:100%;background:transparent" loading="lazy" title="mithun50/Sarvam-S2S — trending on Open Source Pulse"></iframe>

Stars badge

Show current stars in your README or profile. Auto-updates every 6 hours.

mithun50/Sarvam-S2S stars badge
Markdown
[![mithun50/Sarvam-S2S](https://www.notionpulse.cc/api/badge/mithun50/Sarvam-S2S.svg)](https://www.notionpulse.cc/repo/mithun50/Sarvam-S2S)
HTML
<a href="https://www.notionpulse.cc/repo/mithun50/Sarvam-S2S"><img src="https://www.notionpulse.cc/api/badge/mithun50/Sarvam-S2S.svg" alt="mithun50/Sarvam-S2S stars badge" /></a>

Repository of the Day

#22 Repository of the Day

Repository of the Week

#22 Repository of the Week

Repository of the Month

#22 Repository of the Month