If you’re using the legacy Session-based API (
fish_audio_sdk), see the migration guide to upgrade to the new SDK.Installation
1
Install the SDK
Install via pip (Python 3.9 or higher required):For audio playback utilities, install with the
utils extra:2
Get your API key
Create a Fish Audio account
Create a Fish Audio account
Sign up for a free Fish Audio account to get started with our API.
- Go to fish.audio/auth/signup
- Fill in your details to create an account, complete steps to verify your account.
- Log in to your account and navigate to the API section
Get your API key
Get your API key
Once you have an account, you’ll need an API key to authenticate your requests.
- Log in to your Fish Audio Dashboard
- Navigate to the API Keys section
- Click “Create New Key” and give it a descriptive name, set a expiration if desired
- Copy your key and store it securely
3
Set up authentication
Configure your API key using environment variables:Or create a
.env file in your project root:Quick Start
Get started with theFishAudio client in less than a minute:
Core Features
Text-to-Speech
Fully customizable text-to-speech generation:TTSConfig. Prosody controls speech characteristics like speed and volume:
Speech-to-Text
Transcribe audio to text for various use cases:Real-time Streaming
Stream dynamically generated text for conversational AI and live applications. Perfect for integrating with LLM streaming responses, live captions, and chatbot interactions:Voice Cloning
Instant voice cloning - Clone a voice on-the-fly usingReferenceAudio:
Client Initialization
- Environment Variable
- Direct API Key
- Custom Endpoint
The recommended approach using environment variables:
Sync vs Async
The SDK provides both synchronous and asynchronous clients:Resource Clients
The SDK organizes functionality into resource clients:| Resource | Description | Key Methods |
|---|---|---|
client.tts | Text-to-speech | convert(), stream(), stream_websocket() |
client.asr | Speech recognition | transcribe() |
client.voices | Voice management | list(), get(), create(), update(), delete() |
client.account | Account info | get_credits(), get_package() |
Utility Functions
The SDK includes helpful utilities (requiresutils extra):
play() for playback and save() for writing audio files.
Learn more in the API Reference - Utils.
Error Handling
The SDK provides a comprehensive exception hierarchy:AuthenticationError, RateLimitError, ValidationError, and FishAudioError for common error scenarios.
Learn more in the API Reference - Exceptions.
Next Steps
Authentication
Set up API keys and client configuration
Text-to-Speech
Generate natural-sounding speech
Voice Cloning
Clone voices and manage voice models
Speech-to-Text
Transcribe audio to text
WebSocket Streaming
Real-time audio streaming
API Reference
Complete API documentation
Resources
- GitHub Repository
- PyPI Package
- Migration Guide - Upgrade from legacy SDK
- Best Practices - Production-ready tips
- API Reference - Detailed documentation

