API DocsAI Model APIsAudioQwen

Text to Speech

Synthesize speech from text, voice, and language parameters. Synchronous API: submit a request and receive an audio URL.

Generate speech from text and a system voice. Supports automatic language detection or an explicit language, and returns a downloadable audio URL synchronously.

This is a synchronous API: submit a request and receive the synthesized result directly, with no task polling. The audio URL is valid for 24 hours.

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 Text-to-Speech Request

Pass text, a voice, and optional language parameters. The response includes a URL for the synthesized audio. This path is shared with Bilibili IndexTTS; distinguish them with model. Qwen uses qwen3-tts-flash.

Request Body

Content-Type: application/json

Example:

{
  "model": "qwen3-tts-flash",
  "input": "那我来给大家推荐一款T恤,这款呢真的是超级好看,这个颜色呢很显气质。",
  "voice": "Cherry"
}

Properties:

NameTypeRequiredDescription
modelstringYesModel name. Fixed to qwen3-tts-flash
inputstringYesText to synthesize. Maximum 600 characters
voicestringYesSystem voice name. Examples: Cherry, Ethan, Serena, Chelsie
metadataobjectNoMetadata such as language
metadata.language_typestringNoSynthesis language. Default Auto. Available values: Auto, Chinese, English, German, Italian, Portuguese, Spanish, Japanese, Korean, French, Russian

metadataobject(Optional)

Metadata such as language. If omitted, language is auto-detected.

language_typestring(Optional)

Synthesis language. Case-insensitive. Default Auto (auto-detect).

  • Auto
  • Chinese
  • English
  • German
  • Italian
  • Portuguese
  • Spanish
  • Japanese
  • Korean
  • French
  • Russian

Responses

200: Synthesis succeeded; audio URL returned

Content-Type: application/json

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" \
  -d '{
  "model": "qwen3-tts-flash",
  "input": "那我来给大家推荐一款T恤,这款呢真的是超级好看,这个颜色呢很显气质。",
  "voice": "Cherry"
}'

Response Example

{
  "request_id": "5c63c65c-cad8-4bf4-959d-xxxxxxxxxxxx",
  "code": "",
  "message": "",
  "output": {
    "finish_reason": "stop",
    "audio": {
      "data": "",
      "url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xx/xxxxxxxx.wav?Expires=1766113409&OSSAccessKeyId=LTAI5xxxxxx&Signature=xxxxxx",
      "id": "audio_5c63c65c-cad8-4bf4-959d-xxxxxxxxxxxx",
      "expires_at": 1766113409
    }
  },
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "characters": 195
  }
}

Response fields:

NameTypeDescription
request_idstringUnique request ID for tracing and troubleshooting
codestringBusiness error code. Empty string on success
messagestringBusiness error message. Empty string on success
outputobjectSynthesis output
output.finish_reasonstring | nullFinish reason. null while generating; stop when complete
output.audioobjectAudio information
output.audio.urlstringFull URL of the synthesized audio, valid for 24 hours
output.audio.datastringBase64 audio used in streaming. Always an empty string in synchronous mode
output.audio.idstringAudio identifier
output.audio.expires_atintegerExpiration timestamp of the audio URL
usageobjectUsage statistics
usage.charactersintegerInput character count, used for billing
usage.input_tokensintegerAlways 0
usage.output_tokensintegerAlways 0

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"}}

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