Installation
Install the Fish Audio plugin withExample
Check out our Fish Audio example to see a practical implementation of the plugin, or read on for some key details.Text-to-Speech (TTS)
Initialisation
The Fish Audio TTS plugin is exposed via theTTS class:
To initialise without passing in the API key, make sure the
FISH_API_KEY environment variable is set.
You can do this either by defining it in a .env file or exporting it directly in your terminal.Parameters
These are the parameters available in the Fish TTS plugin:| Name | Type | Default | Description |
|---|---|---|---|
api_key | str or None | None | Your Fish Audio API key. If not provided, uses the FISH_API_KEY environment variable. |
reference_id | str or None | None | Optional reference voice ID for voice cloning. Uses a default voice if not specified. |
base_url | str or None | None | Optional custom API endpoint. |
client | Session or None | None | Optionally pass your own Fish Audio Session instance. |
Functionality
Send text to convert to speech
Thesend() method sends text to Fish Audio for synthesis. The resulting audio is played through the configured output track:
Voice Cloning
Fish Audio supports voice cloning using reference audio:Speech-to-Text (STT)
Initialisation
The Fish Audio STT plugin is exposed via theSTT class:
To initialise without passing in the API key, make sure the
FISH_API_KEY environment variable is set.Parameters
These are the parameters available in the Fish STT plugin:| Name | Type | Default | Description |
|---|---|---|---|
api_key | str or None | None | Your Fish Audio API key. If not provided, uses the FISH_API_KEY environment variable. |
language | str or None | None | Language code for transcription (e.g., “en”, “zh”). If None, automatic language detection is used. |
client | Session or None | None | Optionally pass your own Fish Audio Session instance. |
Functionality
Process Audio
Once you join the call, you can listen for audio events and pass them to the STT class for processing:Events
Transcript Event
The transcript event is triggered when a final transcript is available from Fish Audio:Error Event
If an error occurs during transcription, an error event is fired:Supported Languages
Fish Audio STT supports multiple languages with automatic detection:en- Englishzh- Chinesees- Spanishfr- Frenchde- Germanja- Japaneseko- Koreanpt- Portuguese
language=None (default).
Audio Format Requirements
The STT implementation accepts PCM audio data with the following specifications:- Sample rate: 16kHz or higher recommended
- Format: Mono, 16-bit PCM
Getting Your API Key
- Sign up for a Fish Audio account at https://fish.audio
- Navigate to the API Keys section in your dashboard
- Create a new API key
- Set the
FISH_API_KEYenvironment variable or pass it directly to the plugin

