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

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

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

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

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

  const tts = SmallestAITTS({
    model: 'lightning-v3.1',
    voice_id: 'magnus',
  });

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

<Note>
  The default model is `lightning_v3.1`.
</Note>

## Parameters

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

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

The synthesized audio is streamed back to the caller as the final stage of the
[pipeline](/runtime-sdk/build/configure-a-pipeline).


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