PlayHT integration guide

How to use the PlayHT TTS plugin for LiveKit Agents.

Overview

PlayHT provides realistic TTS voice generation. With LiveKit's PlayHT integration and the Agents framework, you can build voice AI applications with fluent and conversational voices.

To learn more about TTS and generating agent speech, see Agent speech.

Quick reference

This section includes a basic usage example and some reference material. For links to more detailed documentation, see Additional resources.

Installation

Install the plugin from PyPI:

pip install "livekit-agents[playai]~=1.0rc"

Authentication

The PlayHT plugin requires a PlayHT API key.

Set the following environment variables in your .env file:

PLAYHT_API_KEY=<playht-api-key>
PLAYHT_USER_ID=<playht-user-id>

Usage

Use PlayHT TTS within an AgentSession or as a standalone speech generator. For example, you can use this TTS in the Voice AI quickstart.

from livekit.plugins import playai
session = AgentSession(
tts=playai.TTS(
voice="s3://voice-cloning-zero-shot/a59cb96d-bba8-4e24-81f2-e60b888a0275/charlottenarrativesaad/manifest.json",
language="SPANISH",
model="play3.0-mini",
),
# ... llm, stt, etc.
)

Parameters

This section describes some of the available parameters. See the plugin reference for a complete list of all available parameters.

voicestringOptionalDefault: s3://voice-cloning-zero-shot/d9ff78ba-d016-47f6-b0ef-dd630f59414e/female-cs/manifest.json

URL of the voice manifest file. For a full list, see List of pre-built voices.

modelTTSModel | stringOptionalDefault: Play3.0-mini

Name of the TTS model. For a full list, see Models.

languagestringOptionalDefault: ENGLISH

Language of the text to be spoken. For language support by model, see Models.

Customizing pronunciation

PlayHT TTS supports adding custom pronunciations to your speech-to-text conversions. To learn more, see the Add Custom Pronunciations to your Audio help article.

Additional resources

The following resources provide more information about using PlayHT with LiveKit Agents.

Voice AI quickstart

Get started with LiveKit Agents and PlayHT TTS.