Skip to main content

Usage guide

Setup, environment variables, and Python/JavaScript/Go usage examples.

SmallestAITTS

Low-latency text-to-speech with Smallest AI’s Lightning models, using your own Smallest AI API key. Supports English and Hindi voices. Authenticates with SMALLEST_API_KEY from your environment, or an explicit api_key.

Fields

Literal['lightning', 'lightning-large', 'lightning-v2', 'lightning-v3.1']
default:"UNSET"
Lightning model: “lightning-v3.1” (latest, streaming), “lightning-v2”, “lightning-large” or “lightning”. Defaults to ‘lightning-v3.1’.
str
default:"UNSET"
Voice to speak with, e.g. “magnus”. Voices are model-specific; v2 voices such as “emily” need model=“lightning-v2”. Defaults to ‘magnus’.
Literal['en', 'hi']
default:"UNSET"
Language of the speech: “en” (English) or “hi” (Hindi). For Hindi, pick a Hindi-capable voice. Defaults to ‘en’.
int
default:"UNSET"
Output sample rate in Hz: 8000, 16000, 24000 or 44100. Defaults to 24000.
float
default:"UNSET"
Speaking speed multiplier, where 1.0 is normal speed. Defaults to 1.0.
float
default:"UNSET"
Voice-clone consistency, 0 to 1. Lightning v2 only. Defaults to 0.5.
float
default:"UNSET"
Voice-clone similarity to the reference voice, 0 to 1. Lightning v2 only. Defaults to 0.0.
float
default:"UNSET"
Output audio enhancement level. Lightning v2 only. Defaults to 1.0.
bool
default:"UNSET"
Send text one sentence at a time, so the first sentence plays while later ones are still being generated. Defaults to True.
str
default:"UNSET"
Base URL of the Smallest AI Waves API. Defaults to ‘https://api.smallest.ai/waves/v1’.
float
default:"UNSET"
Timeout for each HTTP request, in seconds. Defaults to 30.0.
bool
default:"UNSET"
Stream over a persistent WebSocket instead of one HTTP request per segment. Only works with “lightning-v3.1”. Defaults to True.
float
default:"UNSET"
Seconds after which the streaming WebSocket is reopened, to stay within Smallest AI session limits. Defaults to 300.0.
int
default:"UNSET"
Streaming only. Milliseconds the server waits after the last audio chunk before marking the request complete. Defaults to 0.
int
default:"UNSET"
Streaming only. Maximum milliseconds the server waits for more text before generating audio; 0 generates as soon as possible. Defaults to 0.