Skip to main content

livekit-plugins-gnani

PyPI License

LiveKit Agents plugin for Gnani — high-accuracy Speech-to-Text (Prisma) and low-latency Text-to-Speech (Timbre) for Indian languages.

Gnani.ai featuring Prisma (STT) and Timbre (TTS) models, supporting 10+ Indian languages with real-time streaming, multilingual transcription, and code-switching capabilities.

Installation

pip install livekit-plugins-gnani

This will also install the websockets and livekit-agents packages as dependencies.

Prerequisites

You need a Gnani API key. Email speechstack@gnani.ai to get started — all new accounts receive free credits, no credit card required.

Authentication

All APIs require a single API key — no organization_id or user_id needed.

Option 1 — Environment variable (recommended):

export GNANI_API_KEY="your-api-key"

Option 2 — Constructor argument:

stt = STT(api_key="your-api-key", language="hi-IN")
tts = TTS(api_key="your-api-key")

Migration note: If upgrading from an earlier version, remove any organization_id and user_id parameters — they are no longer accepted.

Quick Start

Speech-to-Text (REST + Streaming)

from livekit.plugins.gnani import STT

stt = STT(language="hi-IN")

# REST STT (file-based transcription)
speech_event = await stt.recognize(audio_buffer)

# Streaming STT (real-time WebSocket)
speech_stream = stt.stream()

Text-to-Speech

from livekit.plugins.gnani import TTS

# REST (default) - single-request batch synthesis
tts_rest = TTS(voice="Karan")

# SSE - chunked synthesis via Server-Sent Events (lower latency)
tts_sse = TTS(voice="Karan", synthesize_method="sse")

# WebSocket - chunked synthesis over WS (lowest latency)
tts_ws = TTS(voice="Karan", synthesize_method="websocket")

All three 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.

Full Constructor Reference

STT — All parameters

from livekit.plugins.gnani import STT

stt = STT(
    language="en-IN",           # Default: "en-IN"
    sample_rate=16000,          # Default: 16000 (also: 8000)
    format="verbatim",          # Default: "verbatim" (also: "transcribe")
    preferred_language=None,    # Default: None
    itn_native_numerals=False,  # Default: False
    api_key=None,               # Default: None (reads GNANI_API_KEY env var)
    base_url="https://api.vachana.ai",  # Default
)

TTS — All parameters

from livekit.plugins.gnani import TTS

tts = TTS(
    voice="Karan",                    # Default: "Karan" (also: Simran, Nara, Riya, Viraj, Raju)
    model="vachana-voice-v3",         # Default: "vachana-voice-v3"
    sample_rate=16000,                # Default: 16000 (also: 8000, 22050, 44100)
    encoding="linear_pcm",           # Default: "linear_pcm" (also: "oggopus")
    container="wav",                  # Default: "wav" (also: "raw", "mp3", "mulaw", "ogg")
    num_channels=1,                   # Default: 1
    bitrate=None,                     # Default: None (also: "96k", "128k", "192k")
    synthesize_method="rest",         # Default: "rest" (also: "sse", "websocket")
    api_key=None,                     # Default: None (reads GNANI_API_KEY env var)
    base_url="https://api.vachana.ai",  # Default
)

Features

STT (Prisma)

  • REST recognition — REST API (POST /stt/v3) for file-based transcription
  • Real-time streaming — WebSocket API (wss://api.vachana.ai/stt/v3/stream) for live audio transcription with VAD
  • 10+ Indian languages — see supported language codes
  • Code-switching — supports multilingual and code-mixed audio
  • Sample rates — 8 kHz and 16 kHz
  • ITN support — Inverse Text Normalization via format="transcribe"

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 (Timbre)

  • REST synthesis — single-request batch audio generation (synthesize_method="rest")
  • SSE streaming — lower-latency chunked synthesis via Server-Sent Events (synthesize_method="sse")
  • WebSocket synthesis — lowest-latency synthesis via synthesize_method="websocket" or the stream() method
  • 6 voices — Karan, Simran, Nara, Riya, Viraj, Raju
  • Configurable output — sample rate (8000–44100), encoding (linear_pcm, oggopus), container (raw, mp3, wav, mulaw, ogg)
  • Runtime updates — change voice or model via update_options()

Supported Languages

STT Languages (Prisma)

Prisma uses BCP-47 locale codes (e.g. hi-IN). Supported:


TTS Languages (Timbre)

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

Available Voices

Voice ID Gender Description
Karan Karan Male Bold, Trustworthy
Simran Simran Female Confident, Bright
Nara Nara Female Gentle, Expressive
Riya Riya Female Cheerful, Energetic
Viraj Viraj Male Commanding, Dynamic
Raju Raju Male Grounded, Conversational

Architecture

This plugin directly implements the Gnani REST and WebSocket APIs using aiohttp (for REST STT/TTS) and websockets (for streaming STT/TTS), adapting them into LiveKit's stt.STT and tts.TTS base classes. It uses the Prisma model for speech-to-text and the Timbre model for text-to-speech. No external SDK is required — all connection logic, authentication, and audio format handling is self-contained. Authentication uses a single api_key passed via the X-API-Key-ID header.

Documentation

License

Apache 2.0 — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit_plugins_gnani-1.6.5.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livekit_plugins_gnani-1.6.5-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_gnani-1.6.5.tar.gz.

File metadata

  • Download URL: livekit_plugins_gnani-1.6.5.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for livekit_plugins_gnani-1.6.5.tar.gz
Algorithm Hash digest
SHA256 f24d9ac28e2d6d73b85ede60675ad28f00fa64cdf284afddef0fdc1af188be93
MD5 696b2050ded92f9b5b2c5a05bc2e7f40
BLAKE2b-256 0119467ccfebf9e19ac582f2472ae81e27e4b03239516215c63118961740408c

See more details on using hashes here.

Provenance

The following attestation bundles were made for livekit_plugins_gnani-1.6.5.tar.gz:

Publisher: publish.yml on livekit/agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file livekit_plugins_gnani-1.6.5-py3-none-any.whl.

File metadata

File hashes

Hashes for livekit_plugins_gnani-1.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c52dcaad95f901b669d9e1de6c268afcfb9678144b9ebc2baf4126954692f327
MD5 3fef0d261845bd26c2c51de4ae65dd89
BLAKE2b-256 b7da05bba7bb4e219513e992326f6e1449fc44343146e16572f18db5aaa0fd07

See more details on using hashes here.

Provenance

The following attestation bundles were made for livekit_plugins_gnani-1.6.5-py3-none-any.whl:

Publisher: publish.yml on livekit/agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.7.0

2 files

1.6.10

2 files

1.6.9

2 files

1.6.8

2 files

1.6.7

2 files

1.6.6

2 files

This release

1.6.5 This release

2 files

1.6.4

2 files

1.6.3

2 files

1.6.2

2 files

1.6.1

2 files

1.6.0

2 files

1.5.18

2 files

1.5.17

2 files

1.5.16

2 files

1.5.15

2 files

1.5.14

2 files

1.5.13

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.5

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page