fishaudio plugin, providing text-to-speech synthesis with support for both chunked and real-time WebSocket streaming modes.
Prerequisites
- A Fish Audio account with an API key
- Python 3.9 or higher
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Build real-time voice AI agents with Fish Audio and LiveKit
fishaudio plugin, providing text-to-speech synthesis with support for both chunked and real-time WebSocket streaming modes.
pip install "livekit-agents[fishaudio]"
export FISH_API_KEY=your_api_key_here
from livekit.plugins.fishaudio import TTS
tts = TTS(
reference_id="your_voice_model_id", # Optional: use a specific voice
model="s1",
sample_rate=24000,
latency_mode="balanced"
)
| Parameter | Description |
|---|---|
api_key | Your Fish Audio API key (or use FISH_API_KEY env var) |
model | TTS model/backend to use (default: s1) |
reference_id | Voice model ID from the Fish Audio library |
output_format | Audio format: pcm, mp3, wav, or opus (default: pcm) |
sample_rate | Audio sample rate in Hz (default: 24000) |
num_channels | Number of audio channels (default: 1) |
base_url | Custom API endpoint (default: https://api.fish.audio) |
latency_mode | normal (~500ms) or balanced (~300ms, default) |
# Chunked (non-streaming) synthesis
stream = tts.synthesize("Hello, world!")
# Real-time WebSocket streaming
stream = tts.stream()
Was this page helpful?
