Prerequisites
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
Exception hierarchy
Every SDK error inherits fromFishAudioError. HTTP failures raise APIError or one of its subclasses, which expose .status, .message, and .body.
| Exception | Raised when | Notes |
|---|---|---|
AuthenticationError | 401 | Missing or invalid API key |
PermissionError | 403 | Key lacks permission for the resource |
NotFoundError | 404 | Voice model id not found |
RateLimitError | 429 | Rate limit / quota exceeded |
ServerError | 5xx | Transient server-side failure |
APIError | any other non-2xx | Base for the above; status == 422 for invalid parameters |
WebSocketError | realtime stream failed mid-session | Reconnect rather than retrying the same socket |
DependencyError | a required system tool is missing (e.g. ffmpeg for play()) | Carries .dependency and .install_command |
Handling errors
Retries
The Python client does not retry automatically — each call makes a single request and raises on failure. Add your own backoff where it matters, typically aroundRateLimitError and ServerError:
RequestOptions accepts a max_retries field, but the current client does
not act on it — use an explicit loop like the one above.Timeouts
The request timeout is set on the client (seconds; default240):
request_options:
Related
- Exceptions API reference
- Real-time WebSocket —
WebSocketErrorhandling

