Skip to main content

Baseten TTS integration guide

How to use the Baseten TTS plugin for LiveKit Agents.

Overview

Baseten is a hosted inference platform that allows you to deploy and serve any machine learning model. With LiveKit's Baseten integration and the Agents framework, you can build AI agents that provide high-quality speech synthesis using models like Orpheus.

Quick reference

This section provides a quick reference for the Baseten TTS plugin. For more information, see Additional resources.

Installation

Install the plugin from PyPI:

pip install "livekit-agents[baseten]~=1.0"

Authentication

The Baseten plugin requires a Baseten API key.

Set the following in your .env file:

BASETEN_API_KEY=<your-baseten-api-key>

Model deployment

You must deploy a TTS model such as Orpheus to Baseten to use it with LiveKit Agents. Your deployment includes a private model endpoint URL to provide to the LiveKit Agents integration.

Usage

Use Baseten 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 baseten
session = AgentSession(
tts=baseten.TTS(
model_endpoint="<your-model-endpoint>",
voice="tara",
)
# ... llm, stt, etc.
)

Parameters

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

model_endpointstringOptionalEnv: BASETEN_MODEL_ENDPOINT

The endpoint URL for your deployed model. You can find this in your Baseten dashboard.

voicestringOptionalDefault: tara

The voice to use for speech synthesis.

languagestringOptionalDefault: en

Language of output audio in ISO-639-1 format.

temperaturefloatOptionalDefault: 0.6

Controls the randomness of the generated speech. Higher values make the output more random.

Additional resources

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