SmallestAI TTS
The SmallestAI TTS provider enables your agent to use SmallestAI's high-quality text-to-speech models for generating voice output.
Installation
Install the SmallestAI-enabled VideoSDK Agents package:
pip install "videosdk-plugins-smallestai"
Importing
from videosdk.agents.plugins import SmallestAITTS
Authentication
The Smallest AI plugin requires a Smallest AI API key.
Set SMALLEST_API_KEY in your .env file.
Example Usage
from videosdk.agents.plugins import SmallestAITTS
from videosdk.agents import Pipeline
# Initialize the SmallestAI TTS model
tts = SmallestAITTS(
# When SMALLEST_API_KEY is set in .env - DON'T pass api_key parameter
api_key="your-smallestai-api-key",
model="lightning",
voice_id="emily"
)
# Add tts to pipeline
pipeline = Pipeline(tts=tts)
note
When using .env file for credentials, don't pass them as arguments to model instances. The SDK automatically reads environment variables, so omit api_key from your code.
Configuration Options
api_key: (str) Your SmallestAI API key. Can also be set via theSMALLEST_API_KEYenvironment variable.model: (str) The TTS model to use. Allowed values:"lightning","lightning-large","lightning-v2","lightning-v3.1". Defaults to"lightning-v3.1".voice_id: (str) The ID of the voice to use. Defaults to"magnus".language: (str) The language to use. One of"en"or"hi". Defaults to"en".sample_rate: (int) The output sample rate in Hz. One of8000,16000,24000,44100. Defaults to24000.speed: (float) Speech speed multiplier. Defaults to1.0.consistency: (float) Controls word repetition and skipping. Only supported in thelightning-v2model. Defaults to0.5.similarity: (float) Controls similarity to the reference audio. Only supported in thelightning-v2model. Defaults to0.0.enhancement: (float) Output enhancement level. Only supported in thelightning-v2model. Defaults to1.0.sentence_streaming: (bool) WhenTrue, upstream tokens are batched into sentence-sized requests so audio for a sentence starts playing while the next is still being produced. Defaults toTrue.base_url: (str) HTTPS base URL for the Smallest AI Waves API. Defaults to"https://api.smallest.ai/waves/v1".timeout: (float) Per-request HTTP timeout in seconds. Defaults to30.0.enable_streaming: (bool) WhenTrue, opens a persistent WebSocket to the streaming endpoint; whenFalse, falls back to per-segment HTTP POSTs. Streaming is only valid forlightning-v3.1. Defaults toTrue.max_connection_age_sec: (float) WebSocket only. Refresh the connection after this many seconds to avoid idle/session limits. Defaults to300.0.complete_backoff_ms: (int) WebSocket only. Server-side delay after the last audio chunk beforestatus: completeis emitted. Defaults to0.max_buffer_flush_ms: (int) WebSocket only. Server-side flush trigger — max wait for more input before generating output. Defaults to0.
Additional Resources
The following resources provide more information about using Smallest AI with VideoSDK Agents SDK.
- Smallest AI docs: Smallest AI docs.
Got a Question? Ask us on discord

