Skip to main content

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

  1. Smallest AI Account: Sign up at Smallest AI
  2. API Key: Generate an API key from your account dashboard
Set the following environment variable:

Configuration

api_key
str
required
Smallest AI API key for authentication.
base_url
str
default:"wss://api.smallest.ai"
Base WebSocket URL for the Smallest API. Override for custom or proxied deployments.
sample_rate
int
default:"None"
Output audio sample rate in Hz. When None, uses the pipeline’s configured sample rate.
settings
SmallestTTSService.Settings
default:"None"
Runtime-configurable settings. See Settings below.

Settings

Runtime-configurable settings passed via the settings constructor argument using SmallestTTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. See Service Settings for details.
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 using TTSUpdateSettingsFrame:
Changing the model setting will trigger a WebSocket reconnection, which may cause a brief interruption in service.

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, and enhancement parameters are only effective when using the lightning-v2 model. They are ignored by lightning-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: