Skip to main content
This guide will walk you through installation, authentication, and core features.
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

Sign up for a free Fish Audio account to get started with our API.
  1. Go to fish.audio/auth/signup
  2. Fill in your details to create an account, complete steps to verify your account.
  3. Log in to your account and navigate to the API section
Once you have an account, you’ll need an API key to authenticate your requests.
  1. Log in to your Fish Audio Dashboard
  2. Navigate to the API Keys section
  3. Click “Create New Key” and give it a descriptive name, set a expiration if desired
  4. Copy your key and store it securely
Keep your API key secret! Never commit it to version control or share it publicly.
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 the FishAudio client in less than a minute:

Core Features

Text-to-Speech

Fully customizable text-to-speech generation:
Create reusable configurations with TTSConfig. Prosody controls speech characteristics like speed and volume:
For chunk-by-chunk processing, use stream() which returns an AudioStream (iterable). For real-time streaming with dynamic text, see Real-time Streaming below.
Learn more in the Text-to-Speech guide.

Speech-to-Text

Transcribe audio to text for various use cases:
Learn more in the Speech-to-Text guide.

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:
Learn more in the WebSocket Streaming guide.

Voice Cloning

Instant voice cloning - Clone a voice on-the-fly using ReferenceAudio:
Voice models - Create persistent voice models for repeated use:
Learn more in the Voice Cloning guide.

Client Initialization

The recommended approach using environment variables:

Sync vs Async

The SDK provides both synchronous and asynchronous clients:
Use AsyncFishAudio when:
  • Building async web applications (FastAPI, Sanic, etc.)
  • Processing multiple requests concurrently
  • Integrating with other async libraries
  • You need maximum performance

Resource Clients

The SDK organizes functionality into resource clients:

Utility Functions

The SDK includes helpful utilities (requires utils extra):
Use 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:
The SDK includes exceptions for 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