MCPInstall

fish-audio-sdk

Write code with the official Fish Audio SDKs, Python (fishaudio, PyPI fish-audio-sdk) and JavaScript/TypeScript (fish-audio). Use when the user wants text-to-speech, speech-to-text, voice cloning / voice-model management, or realtime WebSocket TTS through the installed SDK rather than raw HTTP. Covers install and auth, sync + async Python, the TypeScript client, exact method signatures and defaults, model selection (including the S2.1 typing caveat), the real exception types, and the Python↔JavaScript naming differences. For raw REST/WebSocket calls without an SDK (curl, unsupported languages, edge runtimes), use the fish-audio-api skill instead.

Installs
1.3K
Last 24h
+14
Trending rank
#7233
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://docs.fish.audio --skill fish-audio-sdk
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads fish-audio-sdk automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Fish Audio SDK Skill

Use this skill to generate correct, runnable code with the official Fish Audio SDKs:

  • Python: package fish-audio-sdk on PyPI, imported as fishaudio. (The same wheel still ships a separate legacy fish_audio_sdk package. Do not mix them; everything here is the modern fishaudio package.)
  • JavaScript / TypeScript: package fish-audio on npm, imported as FishAudioClient.

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_KEY environment variable automatically. Get keys at https://fish.audio/app/api-keys. Never hardcode a key.
  • Base URL: https://api.fish.audio (override with base_url= in Python / baseUrl: in JS).
  • TTS models: the API supports s1 (deprecated), s2-pro, s2.1-pro (recommended for production), and s2.1-pro-free (free tier). Do not choose s1 for new code: S1 is deprecated and will be retired on December 31, 2026. After that date, requests that specify s1 are served by s2.1-pro (migration: https://docs.fish.audio/developer-guide/models-pricing/migrate-from-s1). However, the Python SDK types model as only s1 and s2-pro (plus the deprecated speech-1.x), default s2-pro. The JS package on npm (fish-audio 0.1.0) types backend without s2-pro or s2.1-pro and defaults it to "s1" at runtime (its README says "s2-pro"), so in JS always pass backend explicitly. 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) / an as cast (TS), or use the fish-audio-api skill for raw calls. speech-1.5 / speech-1.6 are deprecated. In Python pass model="s2-pro" (keyword); in JS pass the positional backend argument.
  • ASR models: use transcribe-1-pro (recommended: speaker turns, long recordings, emotion cues). Neither SDK has an ASR model argument: send the model: transcribe-1-pro HTTP header on every request (Python RequestOptions(additional_headers=...), JS requestOptions.headers). A request without it is served and billed as transcribe-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 (or mpv), 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.

Quick start: Python

from fishaudio import FishAudio
from fishaudio.utils import play, save

client = FishAudio()  # reads FISH_API_KEY

# Generate speech (returns the full audio as bytes)
audio = client.tts.convert(text="Hello from Fish Audio!")

save(audio, "output.mp3")   # write to a file
# play(audio)               # or play locally (needs ffmpeg)

Async: identical resource tree on AsyncFishAudio, used as a context manager:

import asyncio
from fishaudio import AsyncFishAudio
from fishaudio.utils import save

async def main():
    async with AsyncFishAudio() as client:
        audio = await client.tts.convert(text="Hello from Fish Audio!")
        save(audio, "output.mp3")

asyncio.run(main())

Quick start: JavaScript / TypeScript

import { FishAudioClient, play } from "fish-audio";

const client = new FishAudioClient({ apiKey: process.env.FISH_API_KEY });

// convert() returns audio you can play or pipe to a file
const audio = await client.textToSpeech.convert({
  text: "Hello from Fish Audio!",
}); // npm 0.1.0 defaults to the deprecated "s1"; pass a model as shown below
await play(audio); // local playback (needs ffplay)

To pick a model in JS, pass backend as the positional argument (not a named option):

import type { Backends } from "fish-audio";

// The cast is needed because the npm 0.1.0 `Backends` type omits "s2.1-pro".
const audio = await client.textToSpeech.convert(
  { text: "Hi" },
  "s2.1-pro" as Backends
);

Capabilities → references

TaskReference
Install, auth, playback deps, verify a keyreferences/installation.md
Text-to-Speech (convert, stream, formats, prosody, model select)references/text-to-speech.md
Voice cloning (instant references + persistent voice models)references/voice-cloning.md
Speech-to-Text (models, timestamps, fields the SDK drops)references/speech-to-text.md
Realtime WebSocket TTS (stream text → audio)references/websocket.md
Errors, retries, and timeouts (the real exception types)references/errors.md

Python ↔ JavaScript name map

The two SDKs do not use the same names. Use this map when porting code between them.

ConceptPython (fishaudio)JavaScript (fish-audio)
ClientFishAudio() / AsyncFishAudio()new FishAudioClient({ apiKey })
Text-to-Speechclient.tts.convert(text=...) → bytesclient.textToSpeech.convert({ text })
TTS HTTP streamclient.tts.stream(...) → AudioStream(use convert; realtime streaming is convertRealtime)
Realtime WebSocketclient.tts.stream_websocket(text_stream)client.textToSpeech.convertRealtime(request, textStream)
Speech-to-Textclient.asr.transcribe(audio=...)client.speechToText.convert({ audio })
List voice modelsclient.voices.list()client.voices.search()
Get voice modelclient.voices.get(id)client.voices.get(id)
Create voice (clone)client.voices.create(title=..., voices=[bytes])client.voices.ivc.create({ title, voices: [File] })
Update / delete voiceclient.voices.update(id, ...) / delete(id)client.voices.update(id, ...) / delete(id)
Credit balanceclient.account.get_credits()client.user.get_api_credit()
Subscription packageclient.account.get_package()client.user.get_package()
Choose modelmodel="s2-pro" keyword argpositional backend arg, e.g. convert(req, "s2-pro")
ASR model (header)RequestOptions(additional_headers=...)convert(req, { headers: { model: "transcribe-1-pro" } })

Decision shortcuts

  • Audio from text → tts.convert (Python) / textToSpeech.convert (JS).
  • Reuse a saved voice → pass reference_id (the voice model id).
  • Clone a voice instantly from a clip → pass references=[ReferenceAudio(audio=..., text=...)] (Python) / references: [{ audio, text }] (JS). See voice-cloning.
  • Persistent custom voice to reuse → create a voice model, then use its id as reference_id.
  • Stream tokens from an LLM and play speech as it arrives → tts.stream_websocket (Python) / textToSpeech.convertRealtime (JS). See websocket.
  • Transcribe audio → asr.transcribe (Python) / speechToText.convert (JS) with the model: transcribe-1-pro header (recommended; without it, the request runs on transcribe-1). Pro request fields, speaker_turns, request_id, and the language fields need raw HTTP in Python (fish-audio-sdk 1.3.0). See speech-to-text.

Gotchas (verified against the SDK source)

  • Python latency accepts only "normal" or "balanced" (default "balanced"); there is no "low".
  • The Python client has no max_retries and does not auto-retry; the JS client does auto-retry (configurable via per-call requestOptions.maxRetries). See errors.
  • Python defines a ValidationError class but never raises it, so don't catch it expecting validation failures; a 422 surfaces as APIError. The JS SDK throws UnprocessableEntityError on 422.
  • ASR segment start / end and duration are all in seconds. The Python SDK's ASRResponse docstring says milliseconds; that is wrong. See speech-to-text.

FAQ

What does the fish-audio-sdk skill do?

Write code with the official Fish Audio SDKs, Python (fishaudio, PyPI fish-audio-sdk) and JavaScript/TypeScript (fish-audio). Use when the user wants text-to-speech, speech-to-text, voice cloning / voice-model management, or realtime WebSocket TTS through the installed SDK rather than raw HTTP. Covers install and auth, sync + async Python, the TypeScript client, exact method signatures and defaults, model selection (including the S2.1 typing caveat), the real exception types, and the Python↔JavaScript naming differences. For raw REST/WebSocket calls without an SDK (curl, unsupported languages, edge runtimes), use the fish-audio-api skill instead.

How do I install fish-audio-sdk?

Run npx skills add https://docs.fish.audio --skill fish-audio-sdk in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/fish-audio-sdk/ (personal) or .claude/skills/fish-audio-sdk/ (project).

Which AI agents can use fish-audio-sdk?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is fish-audio-sdk safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains fish-audio-sdk?

It is published by docs.fish.audio in docs.fish.audio. It has 1,346 recorded installs.

More from docs.fish.audio

View all →

fish-audio-api

docs.fish.audio

Write direct HTTP / WebSocket calls to the Fish Audio platform (TTS, ASR, voice design, voice models, wallet, real-time TTS streaming) without depending on the Python or JavaScript SDK. Use when the user asks to call Fish Audio from curl, a language without an official SDK, an edge/runtime environment that cannot install the SDK, or when they explicitly want raw REST / WebSocket code. Covers authentication, endpoint URLs, required headers, request / response schemas, MessagePack vs JSON vs multipart encoding rules, multi-speaker dialogue, voice-design candidate generation, and the WebSocket streaming protocol.

Media & Creative1.6K installs

Popular media & creative skills

View category →

hyperframes

heygen-com/hyperframes

Read first to make, edit, animate or render any video with HyperFrames (HTML rendered to video), including launch films, explainers, music videos, charts, maps, vertical clips, title cards, captions and overlays. Holds the render contract, the work loop and what each kind of video needs.

Media & Creative1.2M installs

media-use

heygen-com/hyperframes

Get or make any media for a HyperFrames video - music, sound effects, images, icons, logos, voiceover, avatar and generated video, transcripts, cutouts, colour grades and looks - with HeyGen or free local tools, and mix placed audio. Also for footage that looks dark, flat or dull, or should be stylized or hidden.

Media & Creative1.1M installs

hyperframes-registry

heygen-com/hyperframes

About 450 ready-made HyperFrames blocks and components installed as editable source - transitions, overlays, titles, kinetic type, captions, charts, map overlays, 3D, camera moves. Use it before hand-building any named visual (CRT scanlines, glitch, film grain, a chart); also for hyperframes add and catalog.

Media & Creative1M installs

hyperframes-creative

heygen-com/hyperframes

Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use hyperframes-animation.

Media & Creative916.5K installs

ai-video-generation

101-skills/superpowers

Generate AI videos with Google Veo, Seedance 2.0, HappyHorse, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 2.0, HappyHorse 1.0, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, reference-to-video, video editing, lipsync, avatar animation, video upscaling, foley sound. Use for: social media videos, marketing content, explainer videos, product demos, AI avatars. Triggers: video generation, ai video, text to video, image to video, veo, animate image, video from image, ai animation, video generator, generate video, t2v, i2v, ai video maker, create video with ai, runway alternative, pika alternative, sora alternative, kling alternative, seedance, happyhorse

Media & Creative881.5K installs

ai-image-generation

101-skills/superpowers

Generate AI images with GPT-Image-2, FLUX, Gemini, Grok, Seedream, Reve and 50+ models via inference.sh CLI. Models: GPT-Image-2, FLUX Dev LoRA, FLUX.2 Klein LoRA, Gemini 3 Pro Image, Grok Imagine, Seedream 4.5, Reve, ImagineArt. Capabilities: text-to-image, image-to-image, inpainting, LoRA, image editing, upscaling, text rendering. Use for: AI art, product mockups, concept art, social media graphics, marketing visuals, illustrations. Triggers: flux, image generation, ai image, text to image, stable diffusion, generate image, ai art, midjourney alternative, dall-e alternative, text2img, t2i, image generator, ai picture, create image with ai, generative ai, ai illustration, grok image, gemini image, gpt image, openai image, chatgpt image

Media & Creative880.3K installs