> ## 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 and JavaScript.

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 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 zeroruntime.plugins import SarvamAISTT

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

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

  ```typescript Node JS theme={null}
  import { SarvamAISTT } from '@zeroruntime/js-sdk/plugins';

  const stt = SarvamAISTT({
    model: 'saaras:v3',
    language: 'en-IN',
  });

  // Pipeline({ stt, ... })
  ```
</CodeGroup>

## Parameters

*Constructor parameters for `SarvamAISTT`. The Python and Node JS SDKs share these field names.*

| 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 zeroruntime.plugins import SarvamAISTT`               | `SarvamAISTT(...)`     |
| Node JS | `import { SarvamAISTT } from '@zeroruntime/js-sdk/plugins'` | `SarvamAISTT({ ... })` |

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