Text to Speech
Convert text to speech. Synchronous endpoint: the request returns a binary audio stream.
Convert text to speech. Supports voice model IDs, zero-shot cloning, multi-speaker dialogue, and control of speed, volume, and output format.
Synchronous endpoint: the request returns an audio binary stream with no task polling. Only application/json and application/msgpack are accepted. For best results, upload a reference voice before calling this endpoint to improve quality and reduce latency. Inline reference audio (references) requires MessagePack; JSON cannot carry binary data.
Base URL
https://api.autorouter.top— Production
Authentication
BearerAuth: http (bearer)
Authenticate using a Bearer Token.
Format: Authorization: Bearer sk-xxxxxx
Endpoints
POST /fishaudio/v1/tts
Create a text-to-speech request
Send text and a voice; the response is an audio stream. Multi-speaker dialogue is supported only by the S2 series (s2-pro, s2.1-pro, s2.1-pro-free) and drama-3-preview, not s1.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Request authentication. Format: Bearer sk-xxxxxx |
Content-Type | string | Yes | application/json or application/msgpack. Inline references require MessagePack |
model | string | No | TTS model. Values: s1, s2-pro, s2. (default), s2., drama-3-preview. drama-3-preview is a preview model; behavior and availability may change. If omitted or unrecognized, the request falls back to s2. |
Request Body
Content-Type: application/json
Example (single speaker):
{
"text": "Hello! Welcome to Fish Audio.",
"reference_id": "model-id",
"temperature": 0.7,
"top_p": 0.7,
"prosody": {
"speed": 1,
"volume": 0,
"normalize_loudness": true
},
"chunk_length": 300,
"normalize": true,
"format": "mp3",
"sample_rate": 44100,
"mp3_bitrate": 128,
"latency": "normal",
"max_new_tokens": 1024,
"repetition_penalty": 1.2,
"min_chunk_length": 50,
"condition_on_previous_chunks": true,
"early_stop_threshold": 1
}Example (multi-speaker, S2 family only):
{
"text": "<|speaker:0|>Hello!<|speaker:1|>Hi there!",
"reference_id": ["speaker-a-id", "speaker-b-id"]
}Properties:
| Name | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to synthesize. For multi-speaker, switch with <|speaker:0|>, <|speaker:1|> |
reference_id | string | string[] | null | No | Voice ID. A string for a single speaker; an array of IDs for multiple speakers |
references | object[] | object[][] | null | No | Inline reference audio for zero-shot cloning. Requires MessagePack; JSON cannot carry binary |
prosody | object | null | No | Speed, volume, and loudness normalization |
format | string | No | Output format: wav, pcm, mp3 (default), opus |
sample_rate | integer | null | No | Sample rate (Hz). When null, format defaults apply: 44100 for most formats, 48000 for opus |
mp3_bitrate | integer | No | MP3 bitrate (kbps): 64, 128 (default), 192. Applies only when format=mp3 |
opus_bitrate | integer | No | Opus bitrate (bps): -1000 (default, auto), 24000, 32000, 48000, 64000. Applies only when format=opus |
latency | string | No | Latency vs quality: normal (default, best quality), balanced, low |
normalize | boolean | No | Whether to normalize Chinese/English text (improves number reading stability). Default true |
chunk_length | integer | No | Text chunk length, [100, 300]. Default 300 |
min_chunk_length | integer | No | Minimum characters before splitting a new chunk, [0, 100]. Default 50 |
temperature | number | No | Expressiveness, [0, 1]. Default 0.. Higher is more diverse |
top_p | number | No | Nucleus sampling, [0, 1]. Default 0. |
max_new_tokens | integer | No | Maximum audio tokens generated per text chunk. Default 1024 |
repetition_penalty | number | No | Repetition penalty. Values greater than 1. reduce repetition. Default 1. |
condition_on_previous_chunks | boolean | No | Whether to use previous audio as context to keep the voice consistent. Default true |
early_stop_threshold | number | No | Early-stop threshold for batch processing, [0, 1]. Default 1 |
features | string[] | No | Request-scoped feature flags forwarded to the inference backend. Use ["quality-guard"] to enable the quality guard |
pronunciation_dictionary | object[] | null | No | Up to 3 pronunciation dictionaries (platform reference or inline; mutually exclusive) |
reference_idstring | string[] | null(Optional)
Voice model ID from the Fish Audio library or your custom models.
- Single speaker: pass a string, for example
"model-id". You may omit this and usereferencesfor zero-shot cloning instead. - Multiple speakers (dialogue): pass an array of IDs, for example
["speaker-a-id", "speaker-b-id"]. Mark speaker changes in the text with<|speaker:0|>,<|speaker:1|>. The speaker index matches the array index.
Multi-speaker is available with the S2 family and drama-3-preview, not s1.
referencesobject[] | object[][] | null(Optional)
Inline reference audio for zero-shot cloning. Requires MessagePack, not JSON.
- Single speaker: an array of
ReferenceAudioobjects. - Multiple speakers: a 2D array where each inner array contains reference samples for one speaker. The speaker index matches the
reference_idarray index.
Raw audio bytes of the voice sample. Supported formats: WAV, MP3, FLAC. For best results, use 10–30 seconds of clear speech with minimal background noise.
The exact transcript of what is spoken in the audio sample. Accuracy is important for cloning quality.
prosodyobject(Optional)
Speed, volume, and loudness adjustments.
Speaking-rate multiplier, [0.5, 2.0]. 1.0 (default) is normal speed, 0.5 is half speed, 2.0 is double speed.
Volume adjustment in dB. 0 (default) is unchanged; positive is louder; negative is quieter.
Whether to normalize output loudness for more consistent perceived volume. Default true. Applies to the S2 family (s2-pro, s2.1-pro, s2.1-pro-free); on s1 it is accepted but has no effect.
formatstring(Optional)
Output audio format. Default mp3. Format limits:
| Format | Sample rate | Default sample rate | Other |
|---|---|---|---|
| WAV / PCM | 8 kHz, 16 kHz, 24 kHz, 32 kHz, 44.1 kHz | 44.1 kHz | 16-bit, mono |
| MP3 | 32 kHz, 44.1 kHz | 44.1 kHz | mono; bitrate 64 / 128 (default) / 192 kbps |
| Opus | 48 kHz | 48 kHz | mono; bitrate -1000 (auto), 24 / 32 (default) / 48 / 64 kbps |
pronunciation_dictionaryobject[] | null(Optional)
Pronunciation dictionaries to apply during synthesis, up to 3. Platform references and inline dictionaries are mutually exclusive in a single request. The server resolves and merges them, then forwards the merged dictionary to the inference engine.
Matching is plain substring, leftmost-longest; case-insensitive unless an entry sets case_sensitive. Missing or unresolvable references are silently dropped — the request still succeeds.
Dictionary identifier as registered on the platform. Used with version. Pattern: ^[A-Za-z0-9_-]{1,128}$.
Immutable version identifier. Version is required — there is no implicit latest. Pattern: ^[A-Za-z0-9_-]{1,128}$.
Replacement entries for an inline dictionary, up to 5000. Each entry contains:
key(string, required): source substring to match. Pure substring match — no tokenization, no regex. Length[1, 256].value(string, required): phonetic form that replaces the key. Do not include<|phoneme_start|>/<|phoneme_end|>yourself; the engine wraps them internally. Length[1, 1024]. Requests whose key or value contain either marker are rejected.case_sensitive(boolean, optional): when true the match is case-sensitive. Defaultfalse.
Responses
200: Synthesis succeeded; audio stream returned
Content-Type: audio type depending on format (for example audio/mpeg)
401: Unauthorized
Content-Type: application/json
402: Insufficient balance
Content-Type: application/json
503: Service overloaded
Content-Type: application/json
Request Example
curl -X POST "https://api.autorouter.top/fishaudio/v1/tts" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-H "model: s2.1-pro" \
--output speech.mp3 \
-d '{
"text": "Hello! Welcome to Fish Audio.",
"reference_id": "model-id",
"format": "mp3",
"sample_rate": 44100,
"mp3_bitrate": 128,
"latency": "normal"
}'Response Example
<binary audio stream>Response fields:
| Name | Type | Description |
|---|---|---|
| (body) | binary | On success, a binary audio stream encoded as the requested format. The response uses Transfer-Encoding: chunked |
status | integer | Error status code (on failure) |
message | string | Error message (on failure) |
reason | string | null | Additional reason, may be null |
Error Handling
HTTP 401 / 403 Auth Errors
401 Unauthorized: API Key invalid or expired403 Forbidden: API Key has no access to this model (check token's model allowlist)
HTTP 402 Insufficient Balance
Returns insufficient user quota. Top up at the AutoRouter console.
HTTP 503 Service Overloaded
The server is under too much load to process the request. Retry later.