# Smallest AI (/en/ai/platform/models/tts/smallest-ai)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

> Documentation: Conversational AI.
> Documentation version: Preview.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt).


Smallest AI provides low-latency streaming text-to-speech (TTS) through its Lightning model family, with voices across a broad set of languages.

## Sample configuration

The following example shows how to configure Smallest AI as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent).

Smallest AI supports BYOK only. It isn't available in managed mode. Store your Smallest AI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys).

**Python SDK**

```python
from agora_agent import Agent, SmallestAITTS, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(...)  # configure your ASR vendor
    .with_llm(...)  # configure your LLM vendor
    .with_tts(
        SmallestAITTS(
            api_key=secret_ref("support_prod", "smallestai"),
            url="https://api.smallest.ai/waves/v1/tts/live",
            model="lightning_v3.1_pro",
            voice_id="hazel",
            sample_rate=16000,
            speed=1.0,
            language="zh",
            number_pronunciation_language="zh",
            math_notation=True,
            pronunciation_dicts=[],
            session_id="session_001",
            request_id="request_001",
        )
    )
)
```

**TypeScript SDK**

```ts
import { Agent, SmallestAITTS, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your ASR vendor */)
  .withLlm(/* configure your LLM vendor */)
  .withTts(
    new SmallestAITTS({
      apiKey: secretRef('support_prod', 'smallestai'),
      url: 'https://api.smallest.ai/waves/v1/tts/live',
      model: 'lightning_v3.1_pro',
      voiceId: 'hazel',
      sampleRate: 16000,
      speed: 1.0,
      language: 'zh',
      numberPronunciationLanguage: 'zh',
      mathNotation: true,
      pronunciationDicts: [],
      sessionId: 'session_001',
      requestId: 'request_001',
    }),
  );
```

**Go SDK**

```go
sampleRate, speed, mathNotation := 16000, 1.0, true
// client is your configured Agora client
agent := agentkit.NewAgent(client).
	WithStt( /* configure your ASR vendor */ ).
	WithLlm( /* configure your LLM vendor */ ).
	WithTts(vendors.NewSmallestAITTS(vendors.SmallestAITTSOptions{
		APIKey:                      agentkit.SecretRef("support_prod", "smallestai"),
		URL:                         "https://api.smallest.ai/waves/v1/tts/live",
		Model:                       "lightning_v3.1_pro",
		VoiceID:                     "hazel",
		SampleRate:                  &sampleRate,
		Speed:                       &speed,
		Language:                    "zh",
		NumberPronunciationLanguage: "zh",
		MathNotation:                &mathNotation,
		PronunciationDicts:          []string{},
		SessionID:                   "session_001",
		RequestID:                   "request_001",
	}))
```

**REST API**

Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Smallest AI API key in a secret set. In the following example, the key is stored as `smallestai` in the `support_prod` set:

```json
"tts": {
  "credential": {
    "mode": "byok",
    "fields": {
      "api_key": "$secrets.support_prod.smallestai"
    }
  },
  "vendor": "smallestai",
  "url": "https://api.smallest.ai/waves/v1/tts/live",
  "params": {
    "model": "lightning_v3.1_pro",
    "voice_id": "hazel",
    "sample_rate": 16000,
    "speed": 1.0,
    "language": "zh",
    "number_pronunciation_language": "zh",
    "math_notation": true,
    "pronunciation_dicts": [],
    "session_id": "session_001",
    "request_id": "request_001"
  }
}
```

## Key parameters

The `tts` block takes the following fields. In the SDKs, the Smallest AI TTS class sets them from its options.

**tts**

**`vendor` (string) required**

Set to `smallestai`.

**`credential` (object) required**

Set `mode` to `byok` and `fields.api_key` to a `$secrets.<set>.<key>` reference to your Smallest AI API key.

**`url` (string) optional**

The Smallest AI streaming TTS endpoint, for example `https://api.smallest.ai/waves/v1/tts/live`.

**`params` (object) optional**

**`model` (string) optional**

The Smallest AI TTS model to use, such as `lightning_v3.1_pro` or `lightning_v3.1`. Voice identifiers are model-specific. Make sure `voice_id` belongs to the model you select.

**`voice_id` (string) optional**

The Smallest AI voice identifier to use, for example `hazel`.

**`sample_rate` (integer) optional**

Output audio sample rate in Hz, for example `16000`.

**`speed` (number) optional**

Speech rate multiplier, where `1.0` is the model's default pace.

**`language` (string) optional**

Language code used for speech synthesis, for example `zh`.

**`number_pronunciation_language` (string) optional**

Language code used when reading numbers aloud. Set this when numbers should be spoken in a different language from the surrounding text.

**`math_notation` (boolean) optional**

Whether to read mathematical notation as spoken mathematics rather than as literal symbols.

**`pronunciation_dicts` (array[string]) optional**

Identifiers of Smallest AI pronunciation dictionaries to apply, used to override how specific terms are spoken.

**`session_id` (string) optional**

Caller-supplied session identifier, passed through to Smallest AI for tracing.

**`request_id` (string) optional**

Caller-supplied request identifier, passed through to Smallest AI for tracing.

> **Caution**
>
> The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Smallest AI without validation. For a full list of supported options, refer to the [Smallest AI documentation](https://docs.smallest.ai/models/documentation/text-to-speech-lightning/overview).

This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads.
