Speech Synthesis API Reference

Speech Synthesis API Reference

OpenAI-compatible text-to-speech: one request synthesizes the whole audio clip and the response is raw audio bytes. Works with OpenAI TTS, Bailian Qwen-Audio-TTS, MiniMax and Volcengine speech models.

FieldValue
Base URLhttps://token.easyapi.com/v1
AuthenticationAuthorization: Bearer `API_KEY`
Example modelqwen-audio-3.0-tts-plus
FormatREST JSON (audio bytes in response)
BillingPriced by input characters / audio duration
Note: The response is not JSON but raw audio; Content-Type follows response_format: mp3 → audio/mpeg, wav → audio/wav, pcm → audio/pcm, opus → audio/ogg. Valid voices depend on the model: Bailian Qwen-Audio-TTS uses voices such as longanhuan_v3.6, OpenAI TTS uses alloy / nova, so check the model's voice list. Provider-specific parameters can be passed through metadata.

Example model

Examples below use qwen-audio-3.0-tts-plus (Qwen Audio TTS Plus). Replace model and adjust size, quality, etc. per console docs when switching models.

Create speech

POSThttps://token.easyapi.com/v1/audio/speech

Synthesize the input text and return audio bytes directly. Streaming is not supported yet: stream_format=sse is answered with the complete clip.

Request parameters

NameInTypeRequiredDescription
AuthorizationheaderstringYesEasyAPI API Key. Format: Bearer `API_KEY`
Content-TypeheaderstringYesAlways application/json

Request body

NameTypeRequiredDescription
modelstringYesSpeech model ID, e.g. qwen-audio-3.0-tts-plus, gpt-4o-mini-tts, tts-1
inputstringYesText to synthesize; SSML / LaTeX supported where the model allows it
voicestringYesVoice name, model-specific; Bailian defaults to longanhuan_v3.6
response_formatstringNoAudio encoding: mp3 (default), wav, pcm, opus
speednumberNoSpeed multiplier, mapped to Bailian rate (0.5–2.0) and clamped to that range
instructionsstringNoSynthesis instruction for dialect, emotion or role, mapped to Bailian instruction
metadataobjectNoProvider-native parameters passed through: volume(0-100), pitch(0.5-2.0), bit_rate(6-510, opus only), sample_rate, enable_ssml, word_timestamp_enabled, seed, language_hints, hot_fix, enable_aigc_tag; keys matching standard fields take precedence

Example

{
  "model": "qwen-audio-3.0-tts-plus",
  "input": "你好,欢迎使用 EasyAPI 语音合成。",
  "voice": "longanhuan_v3.6",
  "response_format": "mp3",
  "speed": 1.0,
  "instructions": "用轻松自然的语气朗读"
}

Response example

HTTP/1.1 200 OK
Content-Type: audio/mpeg
Content-Length: 258048

<二进制音频数据>

Status codes

Status codeMeaningDescriptionData model
200OKAudio bytes; Content-Type depends on response_formataudio/*
400Bad requestInvalid parameter or rejected by upstream, e.g. unknown voice or empty textErrorResponse
401UnauthorizedMissing or invalid API keyErrorResponse
402Insufficient quotaAccount balance cannot cover this synthesisErrorResponse
429Rate limitedToo many requests, retry laterErrorResponse
500Server errorUpstream or gateway failure, safe to retryErrorResponse
Response: The gateway measures the audio duration: billing uses input characters and output audio duration, falling back to audio size when the duration cannot be parsed.