Fish Audio Docs
API ReferenceText to Speech

Sync HTTP

Generate speech synchronously with Open API v1.

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 FISHAUDIO_API_KEY
Content-Type: application/json

Request

{
  "text": "Hello from Fish Audio.",
  "voiceId": "YOUR_VOICE_ID",
  "format": "mp3"
}

Common fields:

FieldTypeNotes
textstringText to synthesize. Normalize whitespace before sending large generated text.
voiceIdstringPreferred voice id for new integrations.
formatstringOutput container such as mp3, depending on enabled models.
cachebooleanWhen 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 FISHAUDIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello from Fish Audio.","voiceId":"YOUR_VOICE_ID","format":"mp3"}' \
  --output speech.mp3

Response

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

StatusMeaningAction
400Text, voice id, format, or payload shape is invalidFix the request before retrying
401API key is missing or invalidRefresh server-side credentials
402Credits or quota are insufficientStop the batch and show a billing state
429Rate limitedRetry with backoff
500Generation failed after validationRetry only if your product can tolerate duplicate audio

On this page