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

# Sarvam AI

> Use the Sarvam AI text-to-speech plugin in a Zero Runtime pipeline. Setup, options, and usage.

Sarvam AI is a **text-to-speech** plugin that synthesizes the LLM's reply into the agent's
voice across 11 Indic languages using the bulbul model family. It occupies the pipeline's
`tts` slot.

## Setup

Set your Sarvam AI API key in the worker environment. Generate a key from the [Sarvam AI dashboard](https://dashboard.sarvam.ai/key-management):

```bash theme={null}
export SARVAM_API_KEY=<key>
```

## Usage

Import the plugin and pass it to the pipeline's `tts` slot.

```python Python theme={null}
from zrt.plugins import SarvamAITTS

tts = SarvamAITTS(
    model="bulbul:v3",
    speaker="shubh",
    language="en-IN",
)

# Pipeline(tts=tts, ...)
```

## Parameters

*Constructor parameters for the Python SDK (`SarvamAITTS`).*

| Parameter            | Type                      | Default       | Description                                                                                                                                               |
| -------------------- | ------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `api_key`            | `str \| None`             | `None`        | Sarvam AI API key. Falls back to the `SARVAM_API_KEY` environment variable when unset.                                                                    |
| `model`              | `SarvamAITTSModel \| str` | `"bulbul:v3"` | TTS model: `"bulbul:v3"` (latest, 43+ voices, temperature control) or `"bulbul:v2"` (legacy, pitch/loudness controls).                                    |
| `language`           | `str`                     | `"en-IN"`     | BCP-47 language code. Supported: `"bn-IN"`, `"en-IN"`, `"gu-IN"`, `"hi-IN"`, `"kn-IN"`, `"ml-IN"`, `"mr-IN"`, `"od-IN"`, `"pa-IN"`, `"ta-IN"`, `"te-IN"`. |
| `speaker`            | `str`                     | `"shubh"`     | Speaker/voice name, e.g. `"aditya"`, `"ritu"`, `"priya"`, `"neha"`, `"rahul"`.                                                                            |
| `streaming`          | `bool`                    | `True`        | Stream audio back in chunks. Set to `False` for a single-response download.                                                                               |
| `sample_rate`        | `int`                     | `24000`       | Output sample rate in Hz. Supported: `8000`, `16000`, `22050`, `24000`; `bulbul:v3` also supports `32000`, `44100`, `48000` via the REST API.             |
| `output_audio_codec` | `str`                     | `"linear16"`  | Audio encoding: `"linear16"`, `"mp3"`, `"mulaw"`, `"alaw"`, `"opus"`, `"flac"`, `"aac"`, `"wav"`.                                                         |
| `pitch`              | `float \| None`           | `0.0`         | Pitch adjustment (`bulbul:v2` only). Range `-0.75` to `0.75`. No effect on `bulbul:v3`.                                                                   |
| `pace`               | `float \| None`           | `1.0`         | Speaking rate multiplier. `bulbul:v3` range: `0.5`–`2.0`; `bulbul:v2` range: `0.3`–`3.0`.                                                                 |
| `loudness`           | `float \| None`           | `1.0`         | Volume multiplier (`bulbul:v2` only). Range `0.3`–`3.0`. No effect on `bulbul:v3`.                                                                        |
| `temperature`        | `float \| None`           | `0.6`         | Expressiveness/variability control (`bulbul:v3` only). Range `0.01`–`2.0`.                                                                                |
| `bitrate`            | `str`                     | `"128k"`      | MP3 bitrate when `output_audio_codec="mp3"`.                                                                                                              |
| `min_buffer_size`    | `int`                     | `50`          | Minimum characters to accumulate before sending a synthesis request in streaming mode.                                                                    |
| `max_chunk_length`   | `int`                     | `150`         | Maximum characters per synthesis chunk.                                                                                                                   |
| `preprocessing`      | `bool`                    | `False`       | Enable server-side text pre-processing (number normalization, acronym expansion) before synthesis.                                                        |

The synthesized audio is streamed back to the caller as the final stage of the
[pipeline](/concepts/pipeline).
