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

Sarvam AI is an **LLM** plugin tuned for Indian languages. It takes the transcribed
conversation and generates the reply, with optional Wikipedia grounding.

<Note>
  Sarvam AI is also available as a [speech-to-text](/runtime-sdk/plugins/stt/sarvamai) plugin.
</Note>

## 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 runtime picks up `SARVAMAI_API_KEY` from the worker environment. If you pass the key directly to the constructor's `api_key` parameter and leave it unset, the SDK falls back to the `SARVAM_API_KEY` environment variable instead.
</Note>

## Usage

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

<CodeGroup>
  ```python Python theme={null}
  from zeroruntime.plugins import SarvamAILLM

  llm = SarvamAILLM(
      model="sarvam-105b",
      temperature=0.7,
  )

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

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

  const llm = SarvamAILLM({
    model: 'sarvam-105b',
    temperature: 0.7,
  });

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

## Configuration Options

*Constructor parameters for `SarvamAILLM`. 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` | `"sarvam-30b"` | Sarvam model used to generate replies. |
| `temperature` | `float` | `0.7` | Sampling randomness; lower is more deterministic. |
| `tool_choice` | `str` | `"auto"` | How the model decides when to call tools. |
| `max_completion_tokens` | `int` | `None` | Caps the length of each reply. |
| `reasoning_effort` | `str` | `None` | Reasoning depth: `"low"`, `"medium"`, or `"high"`. |
| `wiki_grounding` | `bool` | `False` | Enable Wikipedia search to ground responses. |
| `top_p` | `float` | `None` | Nucleus-sampling cutoff, as an alternative to `temperature`. |
| `frequency_penalty` | `float` | `None` | Penalizes frequent tokens (range -2.0 to 2.0). |
| `presence_penalty` | `float` | `None` | Penalizes tokens already present (range -2.0 to 2.0). |
| `stop` | `str` | `None` | Up to 4 sequences that halt generation. |

## Import paths

| SDK | Import | Constructor |
| - | - | - |
| Python | `from zeroruntime.plugins import SarvamAILLM` | `SarvamAILLM(...)` |
| Node JS | `import { SarvamAILLM } from '@zeroruntime/js-sdk/plugins'` | `SarvamAILLM({ ... })` |

The reply is streamed to the [text-to-speech](/runtime-sdk/plugins/tts/cartesia) plugin, which
synthesizes the agent's voice.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.