Skip to main content

Overview

livekit-plugins-gnani is a LiveKit Agents plugin that wraps the Gnani STT and TTS APIs into LiveKit’s standard stt.STT and tts.TTS base classes. Drop it into any LiveKit voice agent pipeline and get high-accuracy Indian-language speech recognition and low-latency synthesis without managing WebSocket connections yourself.
This plugin implements the Gnani REST and WebSocket APIs directly using aiohttp (REST STT/TTS) and websockets (streaming STT/TTS). No external SDK is required — connection logic, authentication, and audio format handling are self-contained. Authentication uses a single api_key passed via the X-API-Key-ID header. This integration is maintained by Gnani.ai.

Installation

This also installs websockets and livekit-agents as dependencies. Requirements: Python 3.10+

Prerequisites

You need a Gnani API key. Gnani APIs All APIs require a single API key — no organization_id or user_id needed.
Or pass the key in the constructor:
If upgrading from an earlier version, remove any organization_id and user_id parameters — they are no longer accepted.

Services

This plugin provides STT and TTS classes with multiple transports. Choose based on your use case:

Quick Start

Speech-to-Text (REST + Streaming)

Text-to-Speech (REST)

Text-to-Speech (SSE Streaming)

Text-to-Speech (WebSocket Streaming)

All three TTS modes work with the standard LiveKit voice agent pipeline. The synthesize_method controls which transport synthesize() uses (REST, SSE, or WebSocket). The stream() method always uses WebSocket regardless of this setting.

STT — Speech-to-Text (REST)

File-based transcription via REST.
  • Calls POST /stt/v3
  • Suitable for pre-recorded audio and file-based pipelines
  • Invoked through stt.recognize(audio_buffer)

Settings


STT — Speech-to-Text (WebSocket)

Real-time streaming speech-to-text via WebSocket with VAD.
  • Connects to wss://api.vachana.ai/stt/v3/stream
  • Sends raw PCM audio in 1,024-byte frames
  • Supports 8 kHz and 16 kHz sample rates
  • Invoked through stt.stream()

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 — Text-to-Speech (REST)

REST-based text-to-speech for non-streaming use cases. Returns the complete audio in a single response.
  • Single-request batch synthesis via synthesize_method="rest" (default)
  • Suitable for batch synthesis or pipelines where streaming is not needed

Settings


TTS — Text-to-Speech (SSE)

Streaming text-to-speech via Server-Sent Events. Lower latency than REST.
  • Chunked synthesis via synthesize_method="sse"
  • Streams audio chunks as synthesis progresses

Settings


Streaming text-to-speech via WebSocket. Lowest latency for live conversational agents.
  • Use synthesize_method="websocket" for synthesize(), or call stream() (always WebSocket)
  • Ideal for live agents where latency matters
  • Change voice or model at runtime via update_options()

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 and STT Realtime — Supported Languages.

TTS Languages (Text-to-Speech)

For the full list of supported languages, see TTS — Supported Languages.

Further Reading