Skip to main content

Overview

LokutorTTSService generates speech from text using Lokutor’s text-to-speech API over a persistent WebSocket connection. Lokutor runs on CPU-only infrastructure and supports multiple languages (EN, ES, FR, PT, KO). The service outputs TTSAudioRawFrames.

Source Repository

Source code, examples, and issues for the Lokutor integration

PyPI Package

The pipecat-lokutor package on PyPI

Lokutor App

Get an API key and test available voices

Documentation

Lokutor API and service documentation

Installation

This is a community-maintained package distributed separately from pipecat-ai:
uv add pipecat-lokutor

Prerequisites

Lokutor Account Setup

Before using the Lokutor TTS service, you need:
  1. Lokutor Account: Sign up and get an API key at app.lokutor.com
  2. API Key: Used to authenticate the WebSocket connection

Required Environment Variables

  • LOKUTOR_API_KEY: Your Lokutor API key (used by the example to populate api_key)

Configuration

api_key
str
required
Lokutor API key used to authenticate the WebSocket connection.
voice_id
str
default:"F1"
Identifier of the voice to use. Browse and test voices at app.lokutor.com.
sample_rate
int
default:"44100"
Output audio sample rate in Hz.
params
LokutorTTSService.InputParams
default:"None"
Runtime input parameters for generation. See Input Parameters below.
settings
LokutorTTSSettings
default:"None"
Optional Pipecat TTS settings applied on top of the defaults.
base_url
str
default:"wss://api.lokutor.com/ws"
Base WebSocket URL for the Lokutor API.

Input Parameters

Runtime-configurable parameters passed via the params constructor argument using LokutorTTSService.InputParams(...).
ParameterTypeDefaultDescription
languageLanguageNoneSynthesis language (EN, ES, FR, PT, KO).
speedfloat1.0Speech speed multiplier.
stepsint5Number of synthesis steps.
visemesboolFalseWhether to request viseme data.
Available parameters and defaults are defined by the integration. See the source repository for the authoritative, up-to-date list.

Usage

from pipecat_lokutor import LokutorTTSService

tts = LokutorTTSService(
    api_key="your_api_key",
    voice_id="F1",
    params=LokutorTTSService.InputParams(
        language="en",
        speed=1.0,
        steps=5,
        visemes=False,
    ),
)

# ... add tts to your pipeline:
from pipecat.pipeline.pipeline import Pipeline

pipeline = Pipeline([
    transport.input(),
    stt,
    llm,
    tts,
    transport.output(),
])

Compatibility

Tested with Pipecat v0.0.86+. Check the source repository for the latest tested version and changelog.