Pipecat

View as Markdown

This guide walks you through integrating Smallest AI TTS into a Pipecat voice pipeline. Pipecat is an open-source Python framework for building real-time voice and multimodal conversational AI agents using a frame-based architecture.

Code Examples Repository

You can find the full example for this setup in the Pipecat repository:

Pipecat Example — Smallest AI TTS

Common Steps

1. Create a Virtual Environment

To ensure your Python environment is isolated, create a virtual environment:

$python3 -m venv venv

Activate the virtual environment:

  • On Linux/Mac:

    $source venv/bin/activate
  • On Windows:

    $venv\Scripts\activate

2. Install Pipecat with Smallest AI support

Install the pipecat-ai package with the smallest extra, which includes WebSocket streaming support:

$pip install "pipecat-ai[smallest]"

For running the full voice-agent example with Daily transport, also install:

$pip install "pipecat-ai[smallest,daily,openai,deepgram,silero]"

3. Set Up a Daily Room

Pipecat uses Daily as its WebRTC transport layer. Sign in at Daily Dashboard and create a room to get a room URL and API key.

4. Create a .env File

Create a .env file in the project root directory with the following keys:

$SMALLEST_API_KEY=...
$DAILY_API_KEY=...
$DAILY_SAMPLE_ROOM_URL=...
$OPENAI_API_KEY=...
$DEEPGRAM_API_KEY=...

Usage

Initialising SmallestTTSService

Import and configure the service in your Pipecat pipeline:

1from pipecat.services.smallest.tts import SmallestTTSService
2
3tts = SmallestTTSService(
4 api_key=os.getenv("SMALLEST_API_KEY"),
5 voice_id="sophia", # default voice
6 model="lightning-v3.1", # default model
7)

Available configuration options:

ParameterTypeDefaultDescription
api_keystrYour Smallest AI API key (required)
voice_idstrsophiaVoice to use for synthesis
modelstrlightning-v3.1TTS model name
sample_rateint24000Audio sample rate in Hz
base_urlstrwss://waves-api.smallest.aiWebSocket base URL

Running the Full Voice Agent Example

The example script at examples/foundational/07zl-interruptible-smallest.py sets up a complete interruptible voice bot using:

  • STT: Deepgram (real-time WebSocket transcription)
  • LLM: OpenAI GPT-4o
  • TTS: Smallest AI Lightning v3.1 (WebSocket streaming)
  • Transport: Daily WebRTC

Run it with:

$python examples/foundational/07zl-interruptible-smallest.py

Or connect to a specific Daily room directly:

$python examples/foundational/07zl-interruptible-smallest.py --url https://your-domain.daily.co/your-room

Notes

  • The SmallestTTSService uses WebSocket streaming for low-latency, real-time audio delivery — ideal for live voice agents.
  • The service is interruptible: if a user speaks while the bot is talking, audio generation stops immediately and the pipeline re-engages.
  • Ensure that you have added the correct API keys in the .env file before running the scripts.
  • For any issues or questions, feel free to open an issue in the Pipecat repository or contact us on Discord.