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. Both tabs select it with the model request header; without that header, the request is served and billed as transcribe-1.
Call asr.transcribe() with include_timestamps=True (in JavaScript, ignore_timestamps: false) to get timed segments (ASRSegment). Segments are word-level (one character, or a few, in Chinese and Japanese) and carry no punctuation, so group consecutive segments into caption-sized cues before you format them. Segment start / end are in seconds; SRT wants HH:MM:SS,mmm (comma), WebVTT wants HH:MM:SS.mmm (dot).
The recipe starts a new cue after a pause longer than 0.6 seconds, or when the cue would grow past 42 characters or 6 seconds. It joins words with a space, except between Chinese or Japanese characters, which are written without spaces. A segment can have start equal to end, so a cue with no duration gets a short one that ends no later than the next cue starts. Every cue therefore ends after it starts, as SRT and WebVTT players expect.
captions.srt and captions.vtt. Long recordings can take several minutes to transcribe, so both tabs set a 15-minute request timeout, longer than the SDKs’ default; in Node.js, also see the note below. Tune MAX_CHARS, MAX_MS, and MAX_GAP_MS for your player and audience. segments is empty when no speech was found or word timing was temporarily unavailable, and the files then contain no cues, so check the cue count before you publish them.
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.
