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.
All connection logic, authentication, and audio format handling live in the core SDK. The plugin is purely an adapter layer. This integration is maintained by Gnani.ai. Tested with Pipecat v1.5.0.

Installation

Or with uv:
This also installs gnani-vachana (>= 0.7.3) as a dependency. The Python import package name remains gnani. Requirements: Python 3.10+

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)


STT — GnaniHttpSTTService (REST)

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

Settings


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 and 16 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


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

To see the available voices, click here.

Supported Languages

STT Languages (Speech-to-Text)

STT uses BCP-47 locale codes (e.g. hi-IN, bn-IN). Note: STT uses the -IN suffix (unlike TTS). For the full list, see STT — Supported Languages.

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, see TTS — Supported Languages.
Use the Language enum from pipecat.transcriptions.language for STT services (GnaniSTTService, GnaniHttpSTTService). TTS voice selection primarily drives language for synthesis.

Further Reading