fish-audio-sdk
Installation
SKILL.md
Fish Audio SDK Skill
Use this skill to generate correct, runnable code with the official Fish Audio SDKs:
- Python: package
fish-audio-sdkon PyPI, imported asfishaudio. (The same wheel still ships a separate legacyfish_audio_sdkpackage. Do not mix them; everything here is the modernfishaudiopackage.) - JavaScript / TypeScript: package
fish-audioon npm, imported asFishAudioClient.
If the user wants raw curl / HTTP / WebSocket without installing an SDK, use the fish-audio-api skill instead.
This file is the index. Deeper, task-specific rules and full examples live in
references/. Read the reference for the task you're doing before writing code.
Global facts
- Auth: both SDKs read the API key from the
FISH_API_KEYenvironment variable automatically. Get keys athttps://fish.audio/app/api-keys. Never hardcode a key. - Base URL:
https://api.fish.audio(override withbase_url=in Python /baseUrl:in JS). - TTS models: the API supports
s1(deprecated),s2-pro,s2.1-pro(recommended for production), ands2.1-pro-free(free tier). Do not chooses1for new code: S1 is deprecated and will be retired on December 31, 2026. After that date, requests that specifys1are served bys2.1-pro(migration:https://docs.fish.audio/developer-guide/models-pricing/migrate-from-s1). However, the Python SDK typesmodelas onlys1ands2-pro(plus the deprecatedspeech-1.x), defaults2-pro. The JS package on npm (fish-audio0.1.0) typesbackendwithouts2-proors2.1-proand defaults it to"s1"at runtime (its README says"s2-pro"), so in JS always passbackendexplicitly. Both SDKs forward the model value without runtime validation, so"s2.1-pro"works over the wire. Static type checkers will flag it, so add# type: ignore(Python) / anascast (TS), or use thefish-audio-apiskill for raw calls.speech-1.5/speech-1.6are deprecated. In Python passmodel="s2-pro"(keyword); in JS pass the positionalbackendargument. - ASR models: use
transcribe-1-pro(recommended: speaker turns, long recordings, emotion cues). Neither SDK has an ASRmodelargument: send themodel: transcribe-1-proHTTP header on every request (PythonRequestOptions(additional_headers=...), JSrequestOptions.headers). A request without it is served and billed astranscribe-1, the model for short recordings. See references/speech-to-text.md. - Audio formats:
mp3(default),wav,pcm,opus. - Playback in examples:
play()shells out to a system audio tool: Python uses ffmpeg/ffplay (ormpv), JS uses ffplay. It is for local/desktop use; in a server,save()to a file or stream the bytes instead. See references/installation.md.