Voice TTS
Synthesize WAV audio from text using a built-in voice or a custom voice ID.
Synthesize WAV audio from text using a built-in voice or an uploaded custom voice. On success the response is a binary audio stream, 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/speech
Create Voice TTS Request
Pass text and a voice. The response is WAV audio.
Request Body
Content-Type: application/json
Example:
{
"model": "IndexTeam/IndexTTS-2",
"input": "你好!欢迎使用语音合成服务。",
"voice": "jack_cheng"
}Properties:
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model name. Fixed to IndexTeam/IndexTTS-2 |
input | string | Yes | Text to synthesize. Maximum 600 characters |
voice | string | Yes | Voice. Built-in voice, custom uspeech:. ID, or an empty string to use the default voice |
voicestring(Required)
Voice identifier. Choose one of:
Built-in voices:
jack_chengsales_voicecrystla_liustephen_chowxiaoyueyuemkasentertainnovelmovie
Custom voice: ID from the Upload Voice endpoint, format uspeech:xxxx-xxxx-xxxx-xxxx.
Empty string: Uses the default voice behavior described in the docs.
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/speech" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
--output speech.wav \
-d '{
"model": "IndexTeam/IndexTTS-2",
"input": "你好!欢迎使用语音合成服务。",
"voice": "jack_cheng"
}'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, e.g. invalid_request_error |
error. | string | Machine-readable error code |
error. | string | Request ID or the name of the invalid parameter |
Error Handling
HTTP 400 Parameter Errors
| Scenario | Response |
|---|---|
Missing input / voice / model | {"error":{"message":". |
input exceeds 600 characters | {"error":{"message":". |
| Custom voice does not exist or was deleted | {"error":{"code":"invalid_voice_id",. |
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.