Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
SmallestAITTS
Smallest AI Lightning TTS plugin for ultra-low-latency speech synthesis. Uses Smallest AI’s Lightning v3.1 model (optimised for real-time voice agents) to stream synthesised audio with minimal time-to-first-byte. Supports 12 languages and a large catalogue of pre-built voices.Constructor
Smallest AI API key. Falls back to the
SMALLESTAI_API_KEY environment variable when None.Voice name to use for synthesis (e.g.
'magnus', 'lauren', 'meher', 'devansh'). Takes precedence over voice_id when both are provided. Defaults to 'magnus' when neither argument is given.Alias for
voice; provided for API-compatibility. Ignored when voice is also set.Smallest AI model ID. Defaults to
'lightning_v3.1'. 'lightning_v3.1_pro' is the premium variant with a different per-language voice catalogue.Output audio sample rate in Hz. Defaults to
24000. Supported values: 8000, 16000, 24000, 44100.ISO 639-1 language code for the target voice. Defaults to
'en'. Supported values: 'en', 'hi', 'mr', 'kn', 'ta', 'bn', 'gu', 'te', 'ml', 'pa', 'or', 'es'.Speaking rate multiplier relative to the voice default.
1.0 is normal speed; None (default) uses the model default.When
True (default), audio is returned as a stream of chunks for lower latency. Set to False for a single synchronous response.aclose
emit
The event to emit.
interrupt
off
The event the handler was registered for.
The handler to remove.
on
callback is omitted.
The event to listen for.
The handler to invoke when the event is emitted. If
None, a decorator is returned that registers the decorated function.The registered callback when
callback is provided, otherwise a decorator that registers and returns the function it wraps.on_first_audio_byte
A callable, optionally async, invoked with synthesis timing information when the first audio byte is emitted.
synthesize
The text to synthesize; coerced to a string if needed.