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
Recipe
This recipe usestranscribe-1-pro, which handles recordings up to 60 minutes long. Every tab selects it with the model request header; without that header, the request is served and billed as transcribe-1.
Read each file’s bytes from disk and pass them to asr.transcribe() with language set to a lowercase ISO 639-1 code such as en, zh, or ja. Other forms, such as en-US or English, may be rejected with 400. Pass language when you know the source language. Detection still runs, and the hint does not force the transcript into that language; the hint is reported as language_code when the language cannot be determined. See Language for details.
Collect one result row per file as you go. If a file cannot be read, its request fails with a network error such as a timeout, or the API returns an error for it, record the error in that file’s row and move on to the next file.
ASRResponse with .text and .duration (seconds). With transcribe-1-pro, text can contain inline speaker markers such as <|speaker:0|> and cues such as [laughter]; see Speaker markers to split it into turns. This recipe skips timestamps; pass include_timestamps=True (Python) or ignore_timestamps: false (JavaScript) for word-level .segments. The Python SDK currently returns only text, duration, and segments; to read language_code, call the API directly (see Direct API).
A file that fails is recorded with its error, and the loop continues. After the summary, the script exits with a non-zero status if any file failed, so a scheduled job does not report success. A file that failed with 429, a 5xx status, or a network error such as a timeout is worth retrying later with backoff; for other 4xx errors, fix the file or the request first.
Long recordings can take several minutes to transcribe, so every tab sets a 15-minute request timeout, longer than the SDKs’ default; in Node.js, also see the note below.
In Node.js, the built-in
fetch that the JavaScript SDK uses stops waiting
for a response after 5 minutes, even with a longer timeoutInSeconds. To
wait longer, install undici@7 and, once at startup, call its
setGlobalDispatcher(new Agent({ headersTimeout: 900_000, bodyTimeout: 900_000 })).
See Processing time and
timeouts.
