Pipecat service integration for Gnani speech AI — STT & TTS for Indian languages
Project description
pipecat-gnani
Pipecat service integration for Gnani — high-accuracy Speech-to-Text and low-latency Text-to-Speech for Indian languages.
Gnani is a production-ready speech AI platform supporting 10+ Indian languages, real-time streaming, multilingual transcription, and code-switching capabilities.
This integration is maintained by Gnani.ai.
Installation
pip install pipecat-gnani
Or with uv:
uv add pipecat-gnani
This will also install the gnani-vachana (>= 0.7.3) core SDK as a dependency. The Python import package name remains gnani.
The WebRTC quickstart below needs the example extra (Pipecat runner, Silero VAD, WebRTC stack, and Groq LLM):
pip install "pipecat-gnani[example]"
# or: uv add "pipecat-gnani[example]"
From source:
git clone https://github.com/Gnani-AI-Mintlify/pipecat-gnani.git
cd pipecat-gnani
uv pip install -e ".[example]"
Prerequisites
You need a Gnani API key. Email speechstack@gnani.ai to get started — all new accounts receive free credits, no credit card required.
Quickstart example
The example lives in this repository's examples/foundational/ directory (not in the PyPI wheel). Clone the repo, then run a small WebRTC bot: Gnani WebSocket STT/TTS, OpenAI LLM, and the Pipecat runner CLI.
- Copy
examples/foundational/env.exampletoexamples/foundational/.envand setGNANI_API_KEYandGROQ_API_KEY. - With the
exampleextra installed (see Install), from the clone root:
cd examples/foundational
python agent.py -t webrtc
If you use uv in a git checkout, from the repository root:
uv sync --extra example
cd examples/foundational
uv run --extra example python agent.py -t webrtc
- Open the Pipecat playground at http://localhost:7860/client, connect, and speak.
Environment variables
| Variable | Purpose |
|---|---|
GNANI_API_KEY |
API key for Gnani Vachana STT and TTS |
GROQ_API_KEY |
API key for the Groq LLM in the foundational example |
Quick Start — Pipeline snippet
The snippet below shows the core Pipeline([...]) wiring used in the foundational example. See examples/foundational/agent.py for the full runnable version.
import os
from pipecat.audio.vad.silero import SileroVADAnalyzer
from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.task import PipelineParams, PipelineTask
from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.llm_response_universal import (
LLMContextAggregatorPair,
LLMUserAggregatorParams,
)
from pipecat.services.groq.llm import GroqLLMService
from pipecat.transcriptions.language import Language
from pipecat_gnani import GnaniSTTService, GnaniTTSService
# transport = ... # WebRTC — see examples/foundational/agent.py
stt = GnaniSTTService(
api_key=os.environ["GNANI_API_KEY"],
settings=GnaniSTTService.Settings(language=Language.HI_IN),
)
tts = GnaniTTSService(
api_key=os.environ["GNANI_API_KEY"],
settings=GnaniTTSService.Settings(voice="Pranav"),
)
llm = GroqLLMService(
api_key=os.environ["GROQ_API_KEY"],
settings=GroqLLMService.Settings(
model="llama-3.1-8b-instant",
),
)
context = LLMContext()
aggregators = LLMContextAggregatorPair(
context,
user_params=LLMUserAggregatorParams(vad_analyzer=SileroVADAnalyzer()),
)
pipeline = Pipeline(
[
transport.input(),
stt,
aggregators.user(),
llm,
tts,
transport.output(),
aggregators.assistant(),
]
)
task = PipelineTask(
pipeline,
params=PipelineParams(enable_metrics=True),
)
Swap service classes in agent.py for REST or SSE variants — see the file for options (WebSocket STT + TTS is the default for lowest latency and interruption support).
Service Construction
Speech-to-Text (REST)
from pipecat_gnani import GnaniHttpSTTService
from pipecat.transcriptions.language import Language
stt = GnaniHttpSTTService(
api_key="your-api-key",
aiohttp_session=session,
settings=GnaniHttpSTTService.Settings(
language=Language.HI_IN,
),
)
Speech-to-Text (Streaming WebSocket)
from pipecat_gnani import GnaniSTTService
from pipecat.transcriptions.language import Language
stt = GnaniSTTService(
api_key="your-api-key",
settings=GnaniSTTService.Settings(
language=Language.HI_IN,
),
)
Text-to-Speech (REST)
from pipecat_gnani import GnaniHttpTTSService
tts = GnaniHttpTTSService(
api_key="your-api-key",
aiohttp_session=session,
settings=GnaniHttpTTSService.Settings(
voice="Pranav",
),
)
Text-to-Speech (SSE Streaming)
from pipecat_gnani import GnaniSSETTSService
tts = GnaniSSETTSService(
api_key="your-api-key",
aiohttp_session=session,
settings=GnaniSSETTSService.Settings(
voice="Pranav",
),
)
Text-to-Speech (WebSocket Streaming)
from pipecat_gnani import GnaniTTSService
tts = GnaniTTSService(
api_key="your-api-key",
settings=GnaniTTSService.Settings(
voice="Pranav",
),
)
Services
STT Services
| Service | Transport | Base Class | Description |
|---|---|---|---|
GnaniHttpSTTService |
REST POST | SegmentedSTTService |
File-based transcription via POST /stt/v3. Requires VAD in pipeline. |
GnaniSTTService |
WebSocket | STTService |
Real-time streaming via wss://api.vachana.ai/stt/v3/stream with VAD events. Emits TranscriptionFrame (final) and InterimTranscriptionFrame when the API sets is_final: false (today Gnani sends final transcripts only). |
Streaming PCM Specification
All streaming audio must be sent as raw PCM binary frames — no container format (WAV, MP3) mid-stream.
| Property | 16 kHz | 8 kHz |
|---|---|---|
| Encoding | PCM signed 16-bit little-endian | PCM signed 16-bit little-endian |
| Sample Rate | 16,000 Hz | 8,000 Hz |
| Channels | 1 (mono) | 1 (mono) |
| Samples per chunk | 512 | 512 |
| Bytes per frame | 1,024 bytes (512 samples × 2 bytes) | 1,024 bytes (512 samples × 2 bytes) |
| Frame duration | 32 ms | 64 ms |
Frames must be sent at real-time cadence. See STT Realtime — PCM Specification for full details.
TTS Services
| Service | Transport | Base Class | Description |
|---|---|---|---|
GnaniHttpTTSService |
REST POST | TTSService |
Single-request synthesis via POST /api/v1/tts/inference. |
GnaniSSETTSService |
SSE | TTSService |
Streaming synthesis via POST /api/v1/tts/sse. Lower latency than REST. |
GnaniTTSService |
WebSocket | InterruptibleTTSService |
Streaming via wss://api.vachana.ai/api/v1/tts. Lowest latency, interruption support. TTSTextFrames are emitted by the Pipecat base class after each synthesis request. |
Supported Languages
STT Languages (Speech-to-Text)
STT uses BCP-47 locale codes (e.g. hi-IN).
| Language | Code |
|---|---|
| Assamese | as-IN |
| Bengali | bn-IN |
| English (India) | en-IN |
| Gujarati | gu-IN |
| Hindi | hi-IN |
| Kannada | kn-IN |
| Malayalam | ml-IN |
| Marathi | mr-IN |
| Odia | or-IN |
| Punjabi | pa-IN |
| Tamil | ta-IN |
| Telugu | te-IN |
TTS Languages (Text-to-Speech)
TTS uses ISO 639 language codes (e.g. hi, bn). Note: TTS does not use the -IN suffix.
For the full list of supported languages, see TTS — Supported Languages.
Available Voices
See the official voice list for the latest supported voices.
| Voice | Gender | Description |
|---|---|---|
| Pranav | Male | Bold, Trustworthy |
| Kaveri | Female | Confident, Bright |
| Shubhra | Female | Gentle, Expressive |
| Deepak | Male | Grounded, Conversational |
Architecture
gnani-vachana (>=0.7.3) ← Core SDK on PyPI (import as `gnani`)
↑
pipecat-gnani ← This package (Pipecat service adapters)
├── STT: REST + WebSocket
└── TTS: REST + SSE + WebSocket
This package wraps the gnani SDK into Pipecat's SegmentedSTTService, STTService, TTSService, and InterruptibleTTSService base classes.
Documentation
- Gnani API Docs
- Pipecat Docs
- gnani-vachana SDK on PyPI
- STT REST API
- STT Realtime WebSocket
- TTS REST API
- TTS Streaming (SSE)
- TTS Realtime WebSocket
Pipecat Compatibility
Tested with Pipecat v1.5.0.
License
BSD 2-Clause — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pipecat_gnani-0.5.3.tar.gz.
File metadata
- Download URL: pipecat_gnani-0.5.3.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aca5db5f149ec8cb461a801ff70af07219482ca962ac8b8f0db2d24d93ffb0bf
|
|
| MD5 |
6797a86e97b60024e677fcb80e446db2
|
|
| BLAKE2b-256 |
3565700bcbb3ed03dad93815376a01bad8a06ae0bc979faab2ce39c955c70b36
|
Provenance
The following attestation bundles were made for pipecat_gnani-0.5.3.tar.gz:
Publisher:
workflow.yml on Gnani-AI-Mintlify/pipecat-gnani
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipecat_gnani-0.5.3.tar.gz -
Subject digest:
aca5db5f149ec8cb461a801ff70af07219482ca962ac8b8f0db2d24d93ffb0bf - Sigstore transparency entry: 2166964770
- Sigstore integration time:
-
Permalink:
Gnani-AI-Mintlify/pipecat-gnani@a273d38fc11d6b38bb4e74b5b6a13b22d7ba5071 -
Branch / Tag:
refs/tags/v0.5.3 - Owner: https://github.com/Gnani-AI-Mintlify
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a273d38fc11d6b38bb4e74b5b6a13b22d7ba5071 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pipecat_gnani-0.5.3-py3-none-any.whl.
File metadata
- Download URL: pipecat_gnani-0.5.3-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e8427518c907a135cdc507e18ec5e5f221c08c3a054ebadaa98be8fefc32390
|
|
| MD5 |
91ac15dc0ca24a61222b78d4f3b51887
|
|
| BLAKE2b-256 |
5cfd8a83442eb1c5a9896b943b5139344a9ffad1f3638832be1faa637f3394ce
|
Provenance
The following attestation bundles were made for pipecat_gnani-0.5.3-py3-none-any.whl:
Publisher:
workflow.yml on Gnani-AI-Mintlify/pipecat-gnani
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pipecat_gnani-0.5.3-py3-none-any.whl -
Subject digest:
5e8427518c907a135cdc507e18ec5e5f221c08c3a054ebadaa98be8fefc32390 - Sigstore transparency entry: 2166964793
- Sigstore integration time:
-
Permalink:
Gnani-AI-Mintlify/pipecat-gnani@a273d38fc11d6b38bb4e74b5b6a13b22d7ba5071 -
Branch / Tag:
refs/tags/v0.5.3 - Owner: https://github.com/Gnani-AI-Mintlify
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a273d38fc11d6b38bb4e74b5b6a13b22d7ba5071 -
Trigger Event:
push
-
Statement type: