Skip to main content

Overview

GnaniHttpTTSService, GnaniSSETTSService, and GnaniTTSService synthesize speech using Gnani Vachana, a production speech AI platform for 10+ Indian languages with real-time streaming and low-latency synthesis. Use the REST service for simple request/response synthesis, the SSE service for streaming with lower latency than REST, or the WebSocket GnaniTTSService for lowest latency with interruption support via InterruptibleTTSService.

Source Repository

Source code, examples, and issues for the Gnani integration

PyPI Package

The pipecat-gnani package on PyPI

Gnani Website

Learn about Gnani’s speech AI platform

Gnani API Docs

TTS REST, SSE, and WebSocket API reference

Demo Video

Gnani × Pipecat integration — STT/TTS pipeline and interruption handling

gnani-vachana SDK

Core Gnani Vachana Python SDK (>= 0.7.9) installed as a dependency

Installation

Install the community package directly:
This also installs the gnani-vachana (>= 0.7.9) core SDK. The Python import package name remains gnani.

Prerequisites

Gnani Account Setup

Before using the Gnani TTS services, you need:
  1. Gnani API key: Get one from Gnani APIs.
  2. Set credentials: Export GNANI_API_KEY as an environment variable.

Required Environment Variables

  • GNANI_API_KEY: Your Gnani Vachana API key for authentication

Configuration

All three services share the same audio-format settings via their Settings dataclasses. The key difference is transport: REST for single-request synthesis, SSE for chunked streaming, and WebSocket for interruptible real-time synthesis.

Shared constructor parameters

str
required
Gnani Vachana API key for authentication.
str
default:"Pranav"
Voice name for synthesis. For timbre-v2.0: Pranav, Kaveri, Shubhra, Deepak. For timbre-v2.5: 42 voices across 11 language groups — see Available voices below.
str
default:"timbre-v2.0"
TTS model identifier. One of timbre-v2.0 or timbre-v2.5.
int
default:"None"
Output sample rate in Hz. One of 8000, 16000, 22050, 24000, 44100, or 48000. When omitted, negotiated from StartFrame.
Settings
default:"None"
Runtime-updatable TTS settings. See Settings below.

GnaniHttpTTSService and GnaniSSETTSService (HTTP)

aiohttp.ClientSession
required
Shared aiohttp session for HTTP requests.

Settings

Runtime-configurable settings passed via the settings constructor argument using GnaniHttpTTSService.Settings(...), GnaniSSETTSService.Settings(...), or GnaniTTSService.Settings(...).
For timbre-v2.0, voice selection determines synthesis language — no language parameter is sent. For timbre-v2.5, set language explicitly to control the synthesis language (e.g. Language.HI_IN for Hindi).When using encoding="oggopus", set container="raw" (the API rejects oggopus with container="ogg"). For telephony A-law output, use container="alaw" with sample_rate=8000.
Voice, model, and audio-format settings take effect on the next synthesis request. See the source repository and Gnani TTS docs for the authoritative, up-to-date voice and language lists.

Available voices

timbre-v2.0 (4 voices)

Pranav, Kaveri, Shubhra, Deepak

timbre-v2.5 (42 voices)

timbre-v2.5 requires a language parameter (BCP-47 code, e.g. hi-IN) when using multilingual voices. Some voices (like Pranav, Kaveri, Deepak) appear in both models — select the model to pick the voice variant.

Usage

Streaming with interruption (WebSocket)

Using timbre-v2.5 with language

SSE streaming

REST (non-streaming)

Minimal pipeline example

Compatibility

Tested with the latest Pipecat main branch (v1.5.0+) using both pipecat-gnani. Requires gnani-vachana >= 0.7.9. Check the source repository for the latest tested version and changelog.