Reference Audio TTS
Zero-shot WAV synthesis from speaker reference audio, with optional emotion control.
Submit reference audio and text, extract the speaker voice, then synthesize WAV. Optionally control emotion with emotion reference audio, an 8-dimension emotion vector, or emotion text.
The request is multipart/form-data: file fields carry reference audio, and payload is a JSON string. On success the response is binary WAV, not a JSON URL.
Base URL
https://api.autorouter.top— Production
Authentication
BearerAuth: http (bearer)
Authenticate using a Bearer Token.
Format: Authorization: Bearer sk-xxxxxx
Endpoints
POST /v1/audio/infer
Create Reference Audio TTS Request
Pass speaker reference audio and synthesis parameters. Returns WAV audio.
Request Body
Content-Type: multipart/form-data
Example:
{
"model": "IndexTeam/IndexTTS-2",
"spk_audio_file": "audio/klee.wav",
"emo_audio_file": "audio/emo_sad.wav",
"payload": "{\"input\":\"酒楼丧尽天良,开始借机竞拍房间,哎,一群蠢货。\",\"emo_alpha\":0.8,\"emo_control_method\":1}"
}Properties:
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model name. Fixed to IndexTeam/IndexTTS-2 |
spk_audio_file | file | Yes | Speaker reference audio used to extract the voice. MP3 / WAV, under 20MB |
emo_audio_file | file | No | Emotion reference audio. MP3 / WAV, under 20MB. Used when emo_control_method=1 |
payload | string | Yes | JSON string containing synthesis parameters |
payloadstring(Required)
JSON string with Content-Type application/json. Parsed fields are listed below.
Text to synthesize. Maximum 600 characters.
Output sample rate (Hz). Common values: 22050 (default), 44100, 48000.
Speed factor in [0.25, 4]. Default 1.
Gain factor. 1 (default) keeps the original volume.
Emotion control method. Default 0.
0: No emotion reference1: Useemo_audio_file2: Useemo_vec3: Useemo_text
Emotion blend weight. Default 1.
8-dimension emotion vector. Used only when emo_control_method=2. The sum of elements must not exceed 1.5. Default all zeros.
Emotion text description. Used only when emo_control_method=3. Example: 今天股票涨停了,好激动.
Whether to introduce random emotion variation. Default false.
Silence interval between synthesized text chunks, in milliseconds. Default 200.
Responses
200: Synthesis succeeded; WAV audio stream returned
Content-Type: audio/wav
400: Bad request / invalid parameters
Content-Type: application/json
Request Example
curl -X POST "https://api.autorouter.top/v1/audio/infer" \
-H "Authorization: Bearer sk-xxxxxx" \
--output speech.wav \
-F "model=IndexTeam/IndexTTS-2" \
-F "spk_audio_file=@audio/klee.wav" \
-F "emo_audio_file=@audio/emo_sad.wav" \
-F 'payload={"input":"酒楼丧尽天良,开始借机竞拍房间,哎,一群蠢货。","emo_alpha":0.8,"emo_control_method":1}'Response Example
<binary WAV audio stream>Response fields:
| Name | Type | Description |
|---|---|---|
| (body) | binary | WAV audio stream on success, Content-Type: audio/wav |
error. | string | Error description (on failure) |
error. | string | Error type |
error. | string | Machine-readable error code |
error. | string | Request ID or the name of the invalid parameter |
Error Handling
HTTP 400 Parameter Errors
| Scenario | Suggested Action |
|---|---|
Missing spk_audio_file or payload | Provide the required fields |
payload. exceeds 600 characters | Shorten the text |
Sum of emo_vec elements exceeds 1.5 | Reduce vector dimensions |
| Reference audio exceeds 20MB or is not MP3/WAV | Compress or convert the format |
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.