fish.audio platform api sdk
Project Links
Meta
Author: abersheeran
Requires Python: >=3.10
Classifiers
Fish Audio Python SDK
To provide convenient Python program integration for https://docs.fish.audio.
Install
pip install fish-audio-sdk
Usage
Initialize a Session to use APIs. All APIs have synchronous and asynchronous versions. If you want to use the asynchronous version of the API, you only need to rewrite the original session.api_call(...) to session.api_call.awaitable(...).
from fish_audio_sdk import Session
session = Session("your_api_key")
Sometimes, you may need to change our endpoint to another address. You can use
from fish_audio_sdk import Session
session = Session("your_api_key", base_url="https://your-proxy-domain")
Text to speech
from fish_audio_sdk import Session, TTSRequest
session = Session("your_api_key")
with open("r.mp3", "wb") as f:
for chunk in session.tts(TTSRequest(text="Hello, world!")):
f.write(chunk)
Or use async version:
import asyncio
import aiofiles
from fish_audio_sdk import Session, TTSRequest
session = Session("your_api_key")
async def main():
async with aiofiles.open("r.mp3", "wb") as f:
async for chunk in session.tts.awaitable(
TTSRequest(text="Hello, world!"),
):
await f.write(chunk)
asyncio.run(main())
Reference Audio
from fish_audio_sdk import TTSRequest
TTSRequest(
text="Hello, world!",
reference_id="your_model_id",
)
Or just use ReferenceAudio in TTSRequest:
from fish_audio_sdk import TTSRequest, ReferenceAudio
TTSRequest(
text="Hello, world!",
references=[
ReferenceAudio(
audio=audio_file.read(),
text="reference audio text",
)
],
)
List models
models = session.list_models()
print(models)
Or use async version:
import asyncio
async def main():
models = await session.list_models.awaitable()
print(models)
asyncio.run(main())
Get a model info by id
model = session.get_model("your_model_id")
print(model)
Or use async version:
import asyncio
async def main():
model = await session.get_model.awaitable("your_model_id")
print(model)
asyncio.run(main())
Create a model
model = session.create_model(
title="test",
description="test",
voices=[voice_file.read(), other_voice_file.read()],
cover_image=image_file.read(),
)
print(model)
Or use async version:
import asyncio
async def main():
model = await session.create_model.awaitable(
title="test",
description="test",
voices=[voice_file.read(), other_voice_file.read()],
cover_image=image_file.read(),
)
print(model)
asyncio.run(main())
Delete a model
session.delete_model("your_model_id")
Or use async version:
import asyncio
async def main():
await session.delete_model.awaitable("your_model_id")
asyncio.run(main())
2025.6.3
Jun 03, 2025
2025.4.2
Apr 02, 2025
2025.2.11
Feb 11, 2025
2025.1.8
Jan 08, 2025
2024.12.5
Dec 05, 2024
2024.11.28
Nov 28, 2024
2024.10.22
Oct 22, 2024
2024.10.15
Oct 15, 2024
2024.10.9
Oct 09, 2024
2024.10.6
Oct 07, 2024
2024.9.27
Sep 27, 2024
1.3.0
Mar 10, 2026
1.2.0
Jan 09, 2026
1.1.1
Dec 17, 2025
1.1.0
Nov 18, 2025
1.0.0
Nov 14, 2025
1.0.0rc1
Nov 12, 2025
0.1.0
Sep 18, 2024
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
httpx
(>=0.27.2)
ormsgpack
(>=1.5.0)
pydantic
(>=2.9.1)
httpx-ws
(>=0.6.2)