Overview
Smallest AI provides real-time text-to-speech synthesis through a WebSocket-based integration with their Waves API. The service supports configurable voice parameters, multiple languages, and handles interruptions by reconnecting the WebSocket.Smallest AI TTS API Reference
Complete API reference for all parameters and methods
Example Implementation
Complete example with WebSocket streaming
Installation
Prerequisites
- Smallest AI Account: Sign up at Smallest AI
- API Key: Generate an API key from your account dashboard
Configuration
Smallest AI API key for authentication.
Base WebSocket URL for the Smallest API. Override for custom or proxied
deployments.
Output audio sample rate in Hz. When
None, uses the pipeline’s configured
sample rate.Runtime-configurable settings. See Settings below.
Settings
Runtime-configurable settings passed via thesettings constructor argument using SmallestTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.
| Parameter | Type | Default | Description |
|---|---|---|---|
model | str | lightning-v3.1 | Model identifier: lightning-v2 or lightning-v3.1. Model changes require WebSocket reconnection. (Init-only setting) |
voice | str | sophia | Voice identifier. |
language | Language | str | Language.EN | Language code for synthesis. |
speed | float | None | Speech speed multiplier. When None, uses API defaults. |
consistency | float | None | Consistency level for voice generation (0-1). Only supported by lightning-v2. When None, uses API defaults. |
similarity | float | None | Similarity level for voice generation (0-1). Only supported by lightning-v2. When None, uses API defaults. |
enhancement | int | None | Enhancement level for voice generation (0-2). Only supported by lightning-v2. When None, uses API defaults. |
None values use the Smallest AI API defaults. The consistency,
similarity, and enhancement parameters are only supported by the
lightning-v2 model.Usage
Basic Setup
With Voice Customization
Using Lightning V2 Model
Updating Settings at Runtime
Voice settings can be changed mid-conversation usingTTSUpdateSettingsFrame:
Notes
- WebSocket streaming: The service uses WebSocket connections for real-time streaming. The connection is automatically managed and will reconnect if interrupted.
- Keepalive: The service sends periodic keepalive messages (every 30 seconds) to prevent idle timeouts on the WebSocket connection.
- Model-specific parameters: The
consistency,similarity, andenhancementparameters are only effective when using thelightning-v2model. They are ignored bylightning-v3.1. - Language support: Supports multiple languages including Arabic, Bengali, German, English, Spanish, French, Gujarati, Hebrew, Hindi, Italian, Kannada, Marathi, Dutch, Polish, Russian, and Tamil.
Event Handlers
Smallest AI TTS supports the standard service connection events:| Event | Description |
|---|---|
on_connected | Connected to Smallest AI WebSocket |
on_disconnected | Disconnected from Smallest WebSocket |
on_connection_error | WebSocket connection error occurred |