FishSpeech Docs
API ReferenceText to Speech

Async Jobs

Create and poll asynchronous TTS jobs.

Async Jobs

Use async TTS jobs for long text, batch generation, webhook-style workflows, and UI flows where users can leave the page while audio is still processing.

Create Job

POST /api/open/v1/speech/tts/jobs
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json

Request

{
  "text": "Hello from FishSpeech.",
  "voiceId": "YOUR_VOICE_ID",
  "engineModelId": "fishaudio-s2pro",
  "format": "mp3"
}

Persist the text hash, requested voice, and returned task id in your database. If your worker crashes after creation, polling by task id is safer than creating a second job.

curl https://fishaudio.org/api/open/v1/speech/tts/jobs \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello from FishSpeech.","voiceId":"YOUR_VOICE_ID","format":"mp3"}'

Response

The create endpoint returns 202 Accepted with a task object. The exact task fields can evolve, but clients should at least store the id and status.

{
  "id": "task_123",
  "status": "queued"
}

Get Job

GET /api/open/v1/speech/tts/jobs/{taskId}
Authorization: Bearer YOUR_API_TOKEN

Successful tasks include audioUrl when a short-lived audio URL can be generated. Failed tasks include an error code or message. Treat queued and processing as non-terminal states and poll with backoff.

Billing And Credits

Async jobs may reserve or consume credits during task creation or completion depending on the enabled model. Do not create duplicate jobs as a retry strategy unless the user explicitly asked for a second output. Store the task id and recover from it.

For a batch, throttle concurrency on your side and check Profile before adding a large number of tasks. If one task fails for insufficient credits, pause the rest of the batch until the account owner resolves balance.

Errors

StatusMeaningAction
400Invalid text, voice, model, or output formatFix the payload
401Authentication failedStop polling and refresh credentials
402Insufficient credits or quotaPause the queue
404Task id is unknown to this tokenCheck that you stored the returned id for the same account
429Too many create or poll requestsBack off and keep the task id

On this page