Skip to main content

Overview

pipecat-gnani is a Pipecat service integration that wraps the Gnani STT and TTS APIs into Pipecat’s standard SegmentedSTTService, STTService, TTSService, and InterruptibleTTSService base classes. Drop the services into any Pipecat pipeline and get high-accuracy Indian-language transcription and low-latency synthesis without managing WebSocket connections yourself.
The core SDK supplies the model catalog, voices, languages, and validation rules; the plugin makes the API calls and adapts them to Pipecat. This integration is maintained by Gnani.ai. Works with Pipecat 1.5 and newer 1.x releases (pipecat-ai>=1.5.0,<2.0); tested on 1.5.0 and 1.15.0.

Installation

Or with uv:
This also installs gnani-vachana (>= 0.9.0) as a dependency. The Python import package name remains gnani. Requirements: Python 3.11+ and Pipecat 1.5 or newer (1.x)

Prerequisites

You need a Gnani API key. Gnani APIs

Services

This plugin provides five service classes. Choose based on your use case:

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.
Swap service classes in agent.py for REST or SSE variants — WebSocket STT + TTS is the default for lowest latency and interruption support.

Speech-to-Text (REST)

Speech-to-Text (Streaming WebSocket)

Text-to-Speech (REST)

Text-to-Speech (SSE Streaming)

Text-to-Speech (WebSocket Streaming)


Models

timbre-v2.0 is retired and is rejected. Invalid settings raise ValueError when the service is created or updated, before any request is sent.

STT — GnaniHttpSTTService (REST)

File-based transcription via REST. Extends Pipecat’s SegmentedSTTService.
  • Calls POST /stt/v3
  • Requires VAD in the pipeline to segment audio
  • Audio is limited to 30 s per request
  • Requires an active aiohttp.ClientSession passed at construction time

Settings

Each TranscriptionFrame.language carries the language the API detected, falling back to the configured language.

STT — GnaniSTTService (WebSocket)

Real-time streaming speech-to-text via WebSocket with VAD events. Extends Pipecat’s STTService.
  • Connects to wss://api.vachana.ai/stt/v3/stream
  • Sends raw PCM audio in 1,024-byte frames
  • Emits TranscriptionFrame (final) and InterimTranscriptionFrame when the API sets is_final: false (today Gnani sends final transcripts only)
  • Supports 8 kHz, 16 kHz, 44.1 kHz and 48 kHz sample rates

Streaming PCM Specification

All streaming audio must be sent as raw PCM binary frames — no container format (WAV, MP3) mid-stream. Frames must be sent at real-time cadence. See STT Realtime — PCM Specification for full details.

Settings

Automatic language detection

Pass language_candidates when you use "indic-auto". Bare "indic-auto" can mis-detect the language on utterances that end in silence (for example English audio reported as Telugu on the REST endpoint). Candidates, or a fixed language, are more reliable.

TTS — GnaniHttpTTSService (REST)

REST-based text-to-speech for non-streaming use cases. Returns the complete audio in a single response.
  • Calls POST /api/v1/tts/inference
  • Requires an active aiohttp.ClientSession passed at construction time
  • Suitable for batch synthesis or pipelines where streaming is not needed

Settings


TTS — GnaniSSETTSService (SSE)

Streaming text-to-speech via Server-Sent Events. Lower latency than REST.
  • Calls POST /api/v1/tts/sse
  • Requires an active aiohttp.ClientSession passed at construction time
  • Streams audio chunks as synthesis progresses

Settings


Streaming text-to-speech via WebSocket. Extends Pipecat’s InterruptibleTTSService, giving your agent built-in interruption (barge-in) support — when the user speaks over the agent, synthesis stops cleanly.
  • Connects to wss://api.vachana.ai/api/v1/tts
  • Streams audio chunks in real-time as synthesis progresses
  • Ideal for live conversational agents where latency and barge-in handling matter
  • TTSTextFrames are emitted by the Pipecat base class after each synthesis request

Settings


Available Voices

The full catalog is in the voice list. Every voice belongs to one model:
  • timbre-v2.5: 42 voices, for example Pranav (default), Kaveri, Nalini, Asmita, Deepak.
  • timbre-v3.0: 13 voices: Avinash, Chetana, Devansh, Harshad, Kalpana, Lakshmi, Prakash, Riyaa, Shivani, Shubham, Tarika, Vasudha, Yashraj.
The lists are also available in code as pipecat_gnani.TIMBRE_V25_VOICES and pipecat_gnani.TIMBRE_V30_VOICES.

Audio format

TTS output is always 16-bit PCM, which is what Pipecat plays. Only linear_pcm with a wav or raw container is accepted; mp3, ogg, mulaw and alaw raise ValueError. Telephony transports convert to mulaw or alaw themselves.
The sample_width and bitrate TTS settings are deprecated and ignored, and will be removed in a future release.

Supported Languages

STT Languages (Speech-to-Text)

STT uses BCP-47 locale codes with the -IN suffix: bn-IN, en-IN, gu-IN, hi-IN, kn-IN, ml-IN, mr-IN, pa-IN, ta-IN, te-IN. "indic-auto" (prisma-v3.0) detects the language automatically. For the full list, see STT — Supported Languages.

TTS Languages (Text-to-Speech)

TTS uses the same BCP-47 -IN codes as STT, plus auto. Pipecat Language values are converted for you; a language Gnani TTS does not support (for example or-IN) raises ValueError. See TTS REST — Request Parameters and the Voice Catalog.
Use the Language enum from pipecat.transcriptions.language for language settings on both STT and TTS services. For TTS, the voice and the optional language setting together decide how text is spoken.

Further Reading