Skip to main content

Overview

AssemblyAITTSService streams text to AssemblyAI’s Streaming TTS WebSocket API and plays the audio as it arrives. Per-word timings drive word-level text output, and interruptions cancel synthesis in flight without reconnecting.

AssemblyAI TTS API Reference

Pipecat’s API methods for AssemblyAI TTS integration

Example Implementation

Complete example with AssemblyAI STT and TTS

AssemblyAI Documentation

Official AssemblyAI documentation

AssemblyAI Dashboard

Manage API keys and cloned voices

Installation

Prerequisites

AssemblyAI Account Setup

  1. AssemblyAI Account: Sign up at the AssemblyAI dashboard
  2. API Key: Generate an API key from the dashboard

Required Environment Variables

  • ASSEMBLYAI_API_KEY: Your AssemblyAI API key for authentication

Configuration

AssemblyAITTSService

str
required
AssemblyAI API key. A temporary token opens a single session, so it can’t carry the service’s reconnects and session renewals.
str
default:"wss://tts.us.assemblyai.com/v1/ws"
Streaming TTS WebSocket URL. Use wss://tts.eu.assemblyai.com/v1/ws to process text and audio in the EU. A cloned voice works only on the host of the zone it was created in.
int
default:"None"
Output sample rate in Hz. When None, uses the pipeline’s output sample rate.
AssemblyAITTSService.Settings
default:"None"
Runtime-configurable settings. See Settings below.

Settings

Runtime-configurable settings passed via the settings constructor argument using AssemblyAITTSService.Settings(...). These can be updated mid-conversation with TTSUpdateSettingsFrame. Changing voice, language, or model reconnects the session. See Service Settings for details.

Usage

Basic Setup

Choosing a Voice

Processing Data in the EU

Notes

  • Sentence and token aggregation: With sentence aggregation, each sentence is its own request. With TextAggregationMode.TOKEN, the turn’s text streams as it is generated.
  • Word timestamps: Per-word timings produce word-level TTSTextFrame output.
  • Sessions: The service keeps an idle session open, replaces a session before its one-hour limit, and waits as long as the server asks before reconnecting.

Event Handlers

AssemblyAITTSService supports the standard service connection events: