Skip to main content

Documentation Index

Fetch the complete documentation index at: https://daily-docs-pr-4535.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

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

uv add "pipecat-ai[smallest]"

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:
export SMALLEST_API_KEY=your_api_key

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.
output_format
str
default:"pcm"
Audio format returned by the API. One of pcm, mp3, wav, ulaw, alaw. Defaults to pcm, which is what Pipecat expects internally. Fixed at init time.
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.
ParameterTypeDefaultDescription
modelstrlightning_v3.1_proModel identifier: lightning_v3.1 or lightning_v3.1_pro.
voicestrmeherVoice identifier. Default is meher for lightning_v3.1_pro.
languageLanguage | strLanguage.ENLanguage code for synthesis.
speedfloatNoneSpeech speed multiplier (0.5–2.0). When None, uses API defaults.

Usage

Basic Setup

from pipecat.services.smallest import SmallestTTSService

tts = SmallestTTSService(
    api_key=os.getenv("SMALLEST_API_KEY"),
    settings=SmallestTTSService.Settings(
        voice="sophia",
    ),
)

With Voice Customization

from pipecat.transcriptions.language import Language

tts = SmallestTTSService(
    api_key=os.getenv("SMALLEST_API_KEY"),
    settings=SmallestTTSService.Settings(
        voice="sophia",
        language=Language.ES,
        speed=1.2,
    ),
)

Updating Settings at Runtime

Voice settings can be changed mid-conversation using TTSUpdateSettingsFrame:
from pipecat.frames.frames import TTSUpdateSettingsFrame
from pipecat.services.smallest.tts import SmallestTTSSettings

await task.queue_frame(
    TTSUpdateSettingsFrame(
        delta=SmallestTTSSettings(
            voice="new_voice",
            speed=1.1,
        )
    )
)

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.
  • 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:
EventDescription
on_connectedConnected to Smallest AI WebSocket
on_disconnectedDisconnected from Smallest WebSocket
on_connection_errorWebSocket connection error occurred
@tts.event_handler("on_connected")
async def on_connected(service):
    print("Connected to Smallest AI")