Skip to main content

Overview

SpeechmaticsTTSService provides production-grade, low-latency synthesis optimized for telephony and voice agents. By streaming 16kHz mono audio, it ensures bandwidth efficiency and prioritizes pronunciation accuracy for natural, uninterrupted conversations at scale.

Installation

To use Speechmatics services, install the required dependencies:
pip install "pipecat-ai[speechmatics]"

Prerequisites

Speechmatics Account Setup

Before using Speechmatics TTS services, you need:
  1. Speechmatics Account: Sign up at Speechmatics Portal
  2. API Key: Generate an API key from your dashboard
  3. Voice Selection: Choose from available voices

Required Environment Variables

  • SPEECHMATICS_API_KEY: Your Speechmatics API key for authentication

Basic Usage

The Speechmatics TTS service requires an aiohttp ClientSession to manage high-performance network requests.
import os
import aiohttp
from pipecat.services.speechmatics.tts import SpeechmaticsTTSService

async def create_tts_service():
    # create a session (usually done within your pipeline setup)
    async with aiohttp.ClientSession() as session:
        tts = SpeechmaticsTTSService(
            api_key=os.getenv("SPEECHMATICS_API_KEY"),
            voice_id="sarah", 
            aiohttp_session=session,
        )
        # ... add tts to your pipeline ...