API DocsAI Model APIsAudioBilibili

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:

NameTypeRequiredDescription
modelstringYesModel name. Fixed to IndexTeam/IndexTTS-2
inputstringYesText to synthesize. Maximum 600 characters
voicestringYesVoice. 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_cheng
  • sales_voice
  • crystla_liu
  • stephen_chow
  • xiaoyueyue
  • mkas
  • entertain
  • novel
  • movie

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:

NameTypeDescription
(body)binaryWAV audio stream on success, Content-Type: audio/wav
error.messagestringError description (on failure)
error.typestringError type, e.g. invalid_request_error
error.codestringMachine-readable error code
error.paramstringRequest ID or the name of the invalid parameter

Error Handling

HTTP 400 Parameter Errors

ScenarioResponse
Missing input / voice / model{"error":{"message":"...","type":"invalid_request_error","code":"...","param":"..."}}
input exceeds 600 characters{"error":{"message":"...","type":"invalid_request_error","code":"...","param":"input"}}
Custom voice does not exist or was deleted{"error":{"code":"invalid_voice_id",...}}

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.

On this page