Skip to main content

Gnani TTS plugin guide

How to use the Gnani TTS plugin for LiveKit Agents.

Available inPython

Overview

This plugin allows you to use Gnani  Vachana as a TTS provider for your voice agents. Gnani provides low-latency, natural-sounding speech synthesis for Indian languages, with batch and streaming synthesis over REST, Server-Sent Events (SSE), and WebSocket.

Installation

Install the plugin from PyPI:

uv add "livekit-agents[gnani]~=1.5"

Authentication

The Gnani plugin requires a Gnani Vachana API key .

Set GNANI_API_KEY in your .env file:

GNANI_API_KEY=<your-gnani-api-key>

Usage

Use Gnani TTS within an AgentSession or as a standalone speech generator. For example, you can use this TTS in the Voice AI quickstart.

from livekit.agents import AgentSession
from livekit.plugins import gnani
session = AgentSession(
tts=gnani.TTS(
voice="Karan",
language="hi",
model="vachana-voice-v3",
sample_rate=16000,
),
# ... llm, stt, etc.
)

Parameters

This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.

voicestringDefault: Karan

Voice to use for synthesis. Supported voices: Karan, Simran, Nara, Riya, Viraj, Raju.

modelstringDefault: vachana-voice-v3

The Gnani TTS model to use.

languagestringDefault: hi

Language code for the generated speech. Defaults to Hindi (hi).

sample_rateintegerDefault: 16000

Output sample rate in Hz. Supported values: 8000, 16000, 22050, 44100.

encodingstringDefault: linear_pcm

Output audio encoding. Supported values: linear_pcm, oggopus.

containerstringDefault: wav

Output audio container. Supported values: raw, mp3, wav, mulaw, ogg.

num_channelsintegerDefault: 1

Number of audio channels in the output.

synthesize_methodstringDefault: rest

Transport used for batch synthesis through synthesize(). One of rest (single-request HTTP), sse (chunked Server-Sent Events for lower latency), or websocket (lowest latency). Realtime streaming through stream() always uses WebSocket, regardless of this setting.

Additional resources

The following resources provide more information about using Gnani with LiveKit Agents.