> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gnani.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LiveKit Plugin

> Use Gnani Prisma v2.5 (STT) and Gnani Timbre v2.0 (TTS) inside LiveKit Agents voice pipelines for Indian languages.

## Overview

`livekit-plugins-gnani` is a thin LiveKit Agents adapter 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.

```text theme={null}
gnani-vachana              ← Core SDK (REST, WebSocket, SSE clients)
    ↑
livekit-plugins-gnani      ← This package (LiveKit Agents adapter)
    ↑
Your LiveKit voice agent
```

All connection logic, authentication, and audio format handling live in the core SDK. The plugin is purely an adapter layer.

***

## Installation

```bash theme={null}
pip install livekit-plugins-gnani
```

This also installs `gnani-vachana` (the core SDK) as a dependency.

**Requirements:** Python 3.10+

***

## Prerequisites

You need a Gnani API key. [Gnani APIs](https://app.gnani.ai/voice)

Set your credentials as environment variables:

```bash theme={null}
export GNANI_API_KEY="your-api-key"

# For REST STT only (optional — streaming STT and TTS need only GNANI_API_KEY):
export GNANI_ORGANIZATION_ID="your-org-id"
export GNANI_USER_ID="your-user-id"
```

***

## Quick Start

### Speech-to-Text: Gnani Prisma v2.5

```python theme={null}
from livekit.plugins.gnani import STT

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

# Pass to your LiveKit voice agent pipeline
```

### Text-to-Speech: Gnani Timbre v2.0

```python theme={null}
from livekit.plugins.gnani import TTS

tts = TTS(voice="sia")

# Pass to your LiveKit voice agent pipeline
```

***

## STT — Speech-to-Text (Gnani Prisma v2.5)

The plugin exposes two STT modes matching the underlying Gnani Prisma v2.5 API:

| Mode                  | Method             | Best for                                 |
| --------------------- | ------------------ | ---------------------------------------- |
| Streaming (WebSocket) | Default            | Live conversations, real-time agents     |
| Batch (REST)          | `STT(mode="rest")` | Pre-recorded audio, file-based pipelines |

### Streaming (default)

Real-time transcription via WebSocket with Voice Activity Detection. This is the recommended mode for live voice agents.

```python theme={null}
from livekit.plugins.gnani import STT

stt = STT(
    language="hi-IN",         # BCP-47 language code
    sample_rate=16000,        # 8000 or 16000 Hz
)
```

### Batch (REST)

File-based transcription in a single synchronous request. Audio clips up to 60 seconds.

```python theme={null}
from livekit.plugins.gnani import STT

stt = STT(
    language="hi-IN",
    mode="rest",
)
```

### Code-switching (multilingual)

For audio that mixes Hindi and English, use the experimental Hinglish codes:

```python theme={null}
# Code-mixed: Latin + Devanagari output
stt = STT(language="en-hi-in-cm")

# Hinglish in Latin script only
stt = STT(language="en-hi-IN-latn")
```

***

## TTS — Text-to-Speech (Gnani Timbre v2.0)

The plugin exposes Gnani Timbre v2.0 TTS synthesis with 8 Indian voices.

```python theme={null}
from livekit.plugins.gnani import TTS

tts = TTS(
    voice="sia",              # Voice ID — see Available Voices below
    sample_rate=16000,        # Output sample rate: 8000–44100 Hz
    encoding="linear_pcm",   # linear_pcm or oggopus
)
```

### Available Voices

| Voice  | ID       |
| ------ | -------- |
| Sia    | `sia`    |
| Raju   | `raju`   |
| Kanika | `kanika` |
| Nikita | `nikita` |
| Ravan  | `ravan`  |
| Simran | `simran` |
| Karan  | `karan`  |
| Neha   | `neha`   |

***

## Supported Languages

| Language                        | Code            |
| ------------------------------- | --------------- |
| Bengali                         | `bn-IN`         |
| English (India)                 | `en-IN`         |
| Gujarati                        | `gu-IN`         |
| Hindi                           | `hi-IN`         |
| Kannada                         | `kn-IN`         |
| Malayalam                       | `ml-IN`         |
| Marathi                         | `mr-IN`         |
| Punjabi                         | `pa-IN`         |
| Tamil                           | `ta-IN`         |
| Telugu                          | `te-IN`         |
| Hinglish *(experimental)*       | `en-hi-in-cm`   |
| Hinglish Latin *(experimental)* | `en-hi-IN-latn` |

***

## Further Reading

* [STT REST API](/vachana/STT/speech-to-text) — file-based transcription reference
* [STT Realtime API](/vachana/STT/stt-websocket) — WebSocket protocol reference
* [TTS REST API](/vachana/TTS/tts-inference) — synchronous synthesis reference
* [TTS Realtime API](/vachana/TTS/tts-websocket) — WebSocket TTS reference
* [`gnani-vachana` on PyPI](https://pypi.org/project/gnani-vachana/) — core SDK
* [`livekit-plugins-gnani` on PyPI](https://pypi.org/project/livekit-plugins-gnani/) — this plugin
* [LiveKit Agents Docs](https://docs.livekit.io/agents/) — LiveKit framework reference
