> ## 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 speech-to-text plugin in a Zero Runtime pipeline. Setup, options, and usage in Python, JavaScript, and Go.

Sarvam AI is a **speech-to-text** plugin tuned for Indian languages. It transcribes the
caller's audio into text over Sarvam's streaming WebSocket API, with optional
speech-to-text translation.

## 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 SARVAMAI_API_KEY=<key>
```

<Note>
  The JavaScript and Go SDKs read the key from `SARVAM_API_KEY` instead of `SARVAMAI_API_KEY`.
  The Python SDK requires `scipy` for audio resampling (`pip install scipy`).
</Note>

## Usage

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

<CodeGroup>
  ```python Python theme={null}
  from zrt.plugins import SarvamAISTT

  stt = SarvamAISTT(
      model="saaras:v3",
      language="en-IN",
  )

  # Pipeline(stt=stt, ...)
  ```
</CodeGroup>

## Parameters

*Constructor parameters for the Python SDK (`SarvamAISTT`). The JavaScript and Go SDKs expose equivalent options where supported, in their idiomatic form (camelCase / `STTOptions` struct).*

| Parameter              | Type   | Default       | Description                                                                                                                       |
| ---------------------- | ------ | ------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `api_key`              | `str`  | `None`        | Sarvam AI API key. Falls back to the `SARVAM_API_KEY` environment variable when unset.                                            |
| `model`                | `str`  | `"saaras:v3"` | Sarvam speech-to-text model.                                                                                                      |
| `language`             | `str`  | `"en-IN"`     | Expected language (BCP-47 code) of the caller's speech.                                                                           |
| `input_sample_rate`    | `int`  | `48000`       | Sample rate (Hz) of the incoming audio.                                                                                           |
| `output_sample_rate`   | `int`  | `16000`       | Sample rate (Hz) the audio is resampled to before it is sent.                                                                     |
| `mode`                 | `str`  | `None`        | Recognition mode (`"transcribe"`, `"translate"`, `"verbatim"`, `"translit"`, `"codemix"`). Applies only to the `saaras:v3` model. |
| `high_vad_sensitivity` | `bool` | `None`        | Use higher voice-activity detection sensitivity.                                                                                  |
| `flush_signals`        | `bool` | `None`        | Emit flush signals to force transcript boundaries.                                                                                |
| `translation`          | `bool` | `False`       | Translate the audio to the target language instead of transcribing verbatim.                                                      |
| `prompt`               | `str`  | `None`        | Biasing prompt to guide recognition. Applies only when `translation` is enabled.                                                  |

## Import paths

| SDK        | Import                                | Constructor                                 |
| ---------- | ------------------------------------- | ------------------------------------------- |
| Python     | `from zrt.plugins import SarvamAISTT` | `SarvamAISTT(...)`                          |
| JavaScript | `from '@zrt/js-sdk/plugins/sarvamai'` | `SarvamAISTT({ ... })`                      |
| Go         | `.../zrt-golang-sdk/plugins/sarvamai` | `sarvamai.NewSTT(sarvamai.STTOptions{...})` |

Transcribed text passes to the [LLM](/plugins/llm/google) once
[turn detection](/plugins/turn-detection/namo) decides the caller has finished speaking.
