voices.create() returns immediately with a voice whose state is created or training. Before you can synthesize with it, you need to wait until its state becomes trained.
This recipe creates a voice from reference.wav, polls voices.get() until training finishes (with a timeout), then synthesizes with reference_id.
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
Pollvoices.get(voice.id).state on an interval, stopping when it reaches trained (or raising if it failed or the timeout elapses). Then pass the voice id as reference_id on convert().
created → training → trained, or ends in failed. Always handle failed and the timeout so a stuck voice cannot loop forever.

