Sync HTTP
Generate speech synchronously with Open API v1.
CN API paths use a separate contract
This English reference describes the global FishAudio Open API. For Kitta Audio China integrations, use the CN API Reference, API Playground, and API Keys in this site.
Sync HTTP
Use the sync TTS endpoint when the text is short enough for a request-response flow and your product can wait for the audio before continuing. For long text, batch work, or user-visible queues, use Async Jobs.
POST /api/open/v1/speech/tts
Authorization: Bearer FISHSPEECH_API_KEY
Content-Type: application/jsonRequest
{
"text": "Hello from FishSpeech.",
"voiceId": "YOUR_VOICE_ID",
"format": "mp3"
}Common fields:
| Field | Type | Notes |
|---|---|---|
text | string | Text to synthesize. Normalize whitespace before sending large generated text. |
voiceId | string | Preferred voice id for new integrations. |
format | string | Output container such as mp3, depending on enabled models. |
cache | boolean | When true, the response can return JSON metadata and an audio URL. |
New integrations should use voiceId from GET /api/open/v1/voices.
Do not mix fields from older SDKs or other site variants into the current overseas Open API contract.
curl https://fishaudio.org/api/open/v1/speech/tts \
-H "Authorization: Bearer FISHSPEECH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hello from FishSpeech.","voiceId":"YOUR_VOICE_ID","format":"mp3"}' \
--output speech.mp3Response
When cache is false or omitted, successful responses return binary audio. When cache is true, successful responses return JSON metadata:
{
"audio_url": "https://example.com/generated.mp3",
"credits_used": 12,
"quota_remaining": 987988
}Your client should branch on the Content-Type header instead of assuming one response shape. Store generated audio in your own durable storage if the URL is short-lived.
Billing And Credits
Sync TTS consumes credits based on generated content and model configuration. Because the endpoint performs generation inside the HTTP request, a client timeout does not always mean the server cancelled work. Use idempotency in your own application layer when retrying user actions.
If you need exact post-generation balance, call Profile after the request completes. For large batches, prefer async jobs so each task has a durable id and status.
Errors
| Status | Meaning | Action |
|---|---|---|
400 | Text, voice id, format, or payload shape is invalid | Fix the request before retrying |
401 | API key is missing or invalid | Refresh server-side credentials |
402 | Credits or quota are insufficient | Stop the batch and show a billing state |
429 | Rate limited | Retry with backoff |
500 | Generation failed after validation | Retry only if your product can tolerate duplicate audio |
Continue with runnable API checks
Docs and executable requests stay in the same CN-site surface. After reading the reference, open the API Playground for curl examples or manage API keys in the developer workspace.