Skip to main content

Overview

Hathora is a hosting provider for several models for voice AI, which can be utilized under the single HathoraTTSService.

Installation

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

Prerequisites

Hathora Account Setup

Before using Hathora STT services, you need:
  1. Hathora Account: Sign up at Hathora Models Console
  2. API Key: Generate an API token from your Tokens page

Hathora Model Specifier

The HathoraTTSService accepts a model: str parameter which corresponds to the model you would like to use. You can find available specifiers here

Configuration

HathoraTTSService

model
str
required
Model to use. Find available models at models.hathora.dev.
voice_id
str
default:"None"
Voice to use for synthesis (if supported by model).
sample_rate
int
default:"None"
Output sample rate for generated audio. When None, uses the pipeline’s configured sample rate.
api_key
str
default:"None"
API key for authentication. If None, uses the HATHORA_API_KEY environment variable.
base_url
str
default:"https://api.models.hathora.dev/inference/v1/tts"
Base API URL for the Hathora TTS service.
params
InputParams
default:"None"
Runtime-configurable settings. See InputParams below.

InputParams

Configuration settings that can be set at initialization via the params constructor argument.
ParameterTypeDefaultDescription
speedfloatNoneSpeech speed multiplier (if supported by model).
configlist[ConfigOption]NoneAdditional model-specific configuration options. Each ConfigOption has name and value fields. Refer to Hathora docs for supported options per model.

Usage

Basic Setup

from pipecat.services.hathora import HathoraTTSService

tts = HathoraTTSService(
    model="your-model-specifier",
    api_key=os.getenv("HATHORA_API_KEY"),
)

With Voice and Speed

tts = HathoraTTSService(
    model="your-model-specifier",
    voice_id="some-voice",
    api_key=os.getenv("HATHORA_API_KEY"),
    params=HathoraTTSService.InputParams(
        speed=1.2,
    ),
)

With Model-Specific Config

from pipecat.services.hathora.utils import ConfigOption

tts = HathoraTTSService(
    model="your-model-specifier",
    api_key=os.getenv("HATHORA_API_KEY"),
    params=HathoraTTSService.InputParams(
        config=[
            ConfigOption(name="option_name", value="option_value"),
        ],
    ),
)

Notes

  • Multi-model support: Hathora hosts several different TTS models under a single API. The model parameter determines which model is used.
  • Audio format handling: The service automatically detects whether the response is WAV or raw PCM and handles both formats transparently.
  • Model-specific features: Not all models support all features (e.g., voice_id, speed, config). Refer to the Hathora documentation for model-specific capabilities.