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

# Smallest AI

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

Smallest AI is a **text-to-speech** plugin built for very low latency. It synthesizes the
LLM's reply into the agent's voice using the Lightning model family. It occupies the
pipeline's `tts` slot.

## Setup

Set your Smallest AI API key in the worker environment. Generate a key from the [Smallest AI console](https://console.smallest.ai/apikeys):

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

## Usage

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

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

  tts = SmallestAITTS(
      model="lightning_v3.1",
      voice="magnus",
  )

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

<Note>
  The default model is `lightning_v3.1` in the Python SDK and `lightning` in the JavaScript
  and Go SDKs.
</Note>

## Parameters

*Constructor parameters for the Python SDK (`SmallestAITTS`). The JavaScript and Go SDKs expose `voice_id`/`voiceId`/`VoiceID` and `model` in their idiomatic form.*

| Parameter     | Type    | Default            | Description                                                                                                                 |
| ------------- | ------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------- |
| `api_key`     | `str`   | `None`             | Smallest AI API key. Falls back to the `SMALLESTAI_API_KEY` environment variable when unset.                                |
| `voice`       | `str`   | `"magnus"`         | Voice name (e.g. `"magnus"`, `"lauren"`, `"meher"`, `"devansh"`). Takes precedence over `voice_id`.                         |
| `voice_id`    | `str`   | `None`             | Alias for `voice`; ignored when `voice` is also set.                                                                        |
| `model`       | `str`   | `"lightning_v3.1"` | Model: `"lightning_v3.1"`, `"lightning_v3.1_pro"`, or `"lightning"`.                                                        |
| `sample_rate` | `int`   | `24000`            | Output sample rate: one of `8000`, `16000`, `24000`, `44100`.                                                               |
| `language`    | `str`   | `"en"`             | ISO 639-1 language code: `"en"`, `"hi"`, `"mr"`, `"kn"`, `"ta"`, `"bn"`, `"gu"`, `"te"`, `"ml"`, `"pa"`, `"or"`, or `"es"`. |
| `speed`       | `float` | `None`             | Speaking rate multiplier relative to the voice default; `None` uses the model default.                                      |
| `stream`      | `bool`  | `True`             | When `True`, audio is returned as a stream of chunks for lower latency; `False` returns a single synchronous response.      |

## Import paths

| SDK        | Import                                  | Constructor                                     |
| ---------- | --------------------------------------- | ----------------------------------------------- |
| Python     | `from zrt.plugins import SmallestAITTS` | `SmallestAITTS(...)`                            |
| JavaScript | `from '@zrt/js-sdk/plugins/smallestai'` | `SmallestAITTS({ ... })`                        |
| Go         | `.../zrt-golang-sdk/plugins/smallestai` | `smallestai.NewTTS(smallestai.TTSOptions{...})` |

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