Skip to main content

Prerequisites

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.

Exception hierarchy

Every SDK error inherits from FishAudioError. HTTP failures raise APIError or one of its subclasses, which expose .status, .message, and .body.
There is no separate ValidationError raised at runtime. Invalid request parameters come back as an APIError with status == 422 — catch APIError, not ValidationError.

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 around RateLimitError 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; default 240):
Override headers or timeout for a single request with request_options:
If you inject your own httpx_client, the SDK uses it as-is — the client-level timeout, base_url, and the Authorization header are not applied to it. Configure those on the client you pass in.