API DocsAI Model APIsAudioFish Audio

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

NameTypeRequiredDescription
AuthorizationstringYesRequest authentication. Format: Bearer sk-xxxxxx
Content-TypestringYesapplication/json or application/msgpack. Inline references require MessagePack
modelstringNoTTS model. Values: s1, s2-pro, s2.1-pro (default), s2.1-pro-free, 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.1-pro

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:

NameTypeRequiredDescription
textstringYesText to synthesize. For multi-speaker, switch with <|speaker:0|>, <|speaker:1|>
reference_idstring | string[] | nullNoVoice ID. A string for a single speaker; an array of IDs for multiple speakers
referencesobject[] | object[][] | nullNoInline reference audio for zero-shot cloning. Requires MessagePack; JSON cannot carry binary
prosodyobject | nullNoSpeed, volume, and loudness normalization
formatstringNoOutput format: wav, pcm, mp3 (default), opus
sample_rateinteger | nullNoSample rate (Hz). When null, format defaults apply: 44100 for most formats, 48000 for opus
mp3_bitrateintegerNoMP3 bitrate (kbps): 64, 128 (default), 192. Applies only when format=mp3
opus_bitrateintegerNoOpus bitrate (bps): -1000 (default, auto), 24000, 32000, 48000, 64000. Applies only when format=opus
latencystringNoLatency vs quality: normal (default, best quality), balanced, low
normalizebooleanNoWhether to normalize Chinese/English text (improves number reading stability). Default true
chunk_lengthintegerNoText chunk length, [100, 300]. Default 300
min_chunk_lengthintegerNoMinimum characters before splitting a new chunk, [0, 100]. Default 50
temperaturenumberNoExpressiveness, [0, 1]. Default 0.7. Higher is more diverse
top_pnumberNoNucleus sampling, [0, 1]. Default 0.7
max_new_tokensintegerNoMaximum audio tokens generated per text chunk. Default 1024
repetition_penaltynumberNoRepetition penalty. Values greater than 1.0 reduce repetition. Default 1.2
condition_on_previous_chunksbooleanNoWhether to use previous audio as context to keep the voice consistent. Default true
early_stop_thresholdnumberNoEarly-stop threshold for batch processing, [0, 1]. Default 1
featuresstring[]NoRequest-scoped feature flags forwarded to the inference backend. Use ["quality-guard"] to enable the quality guard
pronunciation_dictionaryobject[] | nullNoUp 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 use references for 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 ReferenceAudio objects.
  • Multiple speakers: a 2D array where each inner array contains reference samples for one speaker. The speaker index matches the reference_id array index.

audiostring (binary)(Required)

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.

textstring(Required)

The exact transcript of what is spoken in the audio sample. Accuracy is important for cloning quality.

prosodyobject(Optional)

Speed, volume, and loudness adjustments.

speednumber(Optional)

Speaking-rate multiplier, [0.5, 2.0]. 1.0 (default) is normal speed, 0.5 is half speed, 2.0 is double speed.

volumenumber(Optional)

Volume adjustment in dB. 0 (default) is unchanged; positive is louder; negative is quieter.

normalize_loudnessboolean(Optional)

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:

FormatSample rateDefault sample rateOther
WAV / PCM8 kHz, 16 kHz, 24 kHz, 32 kHz, 44.1 kHz44.1 kHz16-bit, mono
MP332 kHz, 44.1 kHz44.1 kHzmono; bitrate 64 / 128 (default) / 192 kbps
Opus48 kHz48 kHzmono; 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.

idstring(Required for refs)

Dictionary identifier as registered on the platform. Used with version. Pattern: ^[A-Za-z0-9_-]{1,128}$.

versionstring(Required for refs)

Immutable version identifier. Version is required — there is no implicit latest. Pattern: ^[A-Za-z0-9_-]{1,128}$.

itemsobject[](Required inline)

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. Default false.

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:

NameTypeDescription
(body)binaryOn success, a binary audio stream encoded as the requested format. The response uses Transfer-Encoding: chunked
statusintegerError status code (on failure)
messagestringError message (on failure)
reasonstring | nullAdditional reason, may be null

Error Handling

HTTP 401 / 403 Auth Errors

  • 401 Unauthorized: API Key invalid or expired
  • 403 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.

On this page