Skip to main content

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.plugins.smallestai 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.plugins.smallestai import SmallestAITTS
from videosdk.agents import CascadingPipeline

# 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 cascading pipeline
pipeline = CascadingPipeline(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 the SMALLEST_API_KEY environment variable.
  • model: (str) The TTS model to use (e.g., "lightning", "lightning-large"). Defaults to "lightning".
  • voice_id: (str) The ID of the voice to use. Defaults to "emily".
  • speed: (float) Speech speed multiplier. Defaults to 1.0.
  • consistency: (float) Controls word repetition and skipping. Only supported in lightning-large model. Defaults to 0.5.
  • similarity: (float) Controls similarity to the reference audio. Only supported in lightning-large model. Defaults to 0.0.
  • enhancement: (bool) Enhances speech quality at the cost of increased latency. Only supported in lightning-large model. Defaults to False.

Additional Resources​

The following resources provide more information about using Smallest AI with VideoSDK Agents SDK.

Got a Question? Ask us on discord