You can create a model using the Python SDK, MessagePack API, or FormData API.

Python SDK

To begin with, you need to make sure you have the Python SDK installed: GitHub or PyPI.

from fish_audio_sdk import Session

session = Session("your_api_key")

model = session.create_model(
    title="test",
    description="test",
    voices=[voice_file.read(), other_voice_file.read()],
    cover_image=image_file.read(),
)
print(model)

MessagePack API

Endpoint Details

Example Usage

Say you want to create a model with 2 audio clips and 2 corresponding texts.

import requests

response = requests.post(
    "https://api.fish.audio/model",
    files=[
        ("voices", open("hello.mp3", "rb")),
        ("voices", open("test.wav", "rb")),
    ],
    data=[
        ("visibility", "private"),
        ("type", "tts"),
        ("title", "Demo"),
        ("train_mode", "fast"),
        # Enhance audio quality will remove background noise
        ("enhance_audio_quality", "true"),
        # Texts are optional, but if you provide them, they must match the number of audio samples
        ("texts", "text1"),
        ("texts", "text2"),
    ],
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
    },
)

print(response.json())