qwen-audio-3.1-tts-flash

This is a text-to-speech model: convert text into audio, and you can choose the timbre, speaking speed, volume and reading style. When calling ShangHai Do, use POST /v1/audio/speech and the token of this site, and return the audio binary file directly after success.

Basic information

Item Content
Site model name qwen-audio-3.1-tts-flash
Model type Speech generation (text to speech)
Request interface POST /v1/audio/speech

request parameters

The first call can write input directly into text. When control of sampling rate, volume, pronunciation correction, etc. is required, write input as an object containing multiple fields.

Parameter Type Required Description
model The text is and fixedly filled in qwen-audio-3.1-tts-flash.
input Text or object Yes Directly fill in the text to be read aloud, or use the object field in the table below.
voice Text No Tone number, case sensitive. The default of this site is longanhuan_v3.1; the corresponding object is voice.
response_format Text No mp3, wav, pcm, opus, default mp3; corresponding to format in the object.
speed Number No 0.5 ~ 2, default 1, the bigger it is, the faster it is; corresponding to rate in the object.
instructions Text No Reading style, such as "reading in a gentle and natural tone"; corresponding to instruction in the object , pay attention to the singular number for inner layer.
stream_format Text No Omit or fill in audio. The interface still returns the complete audio file and will not return it while generating.

Complete parameters of object input

The fields in the following table are all placed in input. sample_rate, seed, etc. cannot be placed directly in the outermost layer of the request. The object writing method recommends that the generated parameters be concentrated in input; if the corresponding parameters are filled in inside and outside, the values ​​must be the same, otherwise a parameter error will be returned.

The following table explains the default values ​​and parameter restrictions when calling this site. When optional fields are omitted, the corresponding default settings are used.

Field Type Required Meaning, value and default behavior
text Text Yes The text to be read aloud, cannot be empty.
voice Text No The tone number available on this site, the default is longanhuan_v3.1.
instruction Text No Specify mood, character, dialect or reading method; actual effect depends on model and timbre.
format Text No mp3, wav, pcm, opus, default mp3. For first-time access, it is recommended to use wav for easy playback.
sample_rate Integer No Sampling rate, that is, the number of times the sound is recorded per second, in Hertz. Can fill in 8000, 12000, 16000, 22050, 24000, 44100, 48000. The non-Opus format defaults to 22050; when Opus is omitted, this site uses 24000.
volume Integer No Volume, 0 ~ 100, default 50.
rate Number No Speech speed, 0.5 ~ 2, default 1.
pitch Number No Pitch pitch, 0.5 ~ 2, default 1; The bigger the sound, the higher the sound.
seed Integer No Random seed, 0 ~ 65535, default 0. Used to control generation changes; only when the model version, text, timbre and other parameters are the same, the same seed will help reproduce the results.
bit_rate Integer No is only available when format: "opus", 6 ~ 510, default 32. The unit is kilobits per second and controls the amount of compressed audio data; cannot be used for MP3.
language_hints Text array No Prompt target language, such as ["zh"] for Chinese and English ["en"]. Currently, only the first item is processed. It is recommended to fill in only one language.
enable_ssml true / false No Whether to parse text according to voice tags , can be used to specify pauses, readings, etc.; when using, the corresponding mark text must be provided. Please use a tone that supports voice tags; if you are unsure, please contact the site’s customer service for confirmation.
word_timestamp_enabled true / false No Whether to return the time position of each word. This site currently does not support it, please omit or fill in false; filling in true will return a parameter error.
enable_aigc_tag true / false No Whether to add implicit identification of artificial intelligence-generated content to the audio, default false; supported wav, mp3, opus.
aigc_propagator Text No Content communicator in the logo, effective only when enable_aigc_tag: true. Omit if no customization is required.
aigc_propagate_id Text No The propagation record number in the logo is only effective when enable_aigc_tag: true; by default, this request number is used.
hot_fix Object No Pronunciation correction or text replacement before synthesis. For specific writing methods, see the example below.

The sampling rate of Opus can only be filled in 8000, 12000, 16000, 24000, 48000, 22050 or 44100.

The same character inherits the timbre

Each line uses the same voice tone number. Flash does not accept Next’s references or @voice1 reference audio writing.

To reproduce or design exclusive sounds, you need to first confirm whether this site can use this number; sounds you create in other accounts may not be directly used on this site. This site currently does not provide an interface for creating timbres. If you need exclusive timbres, please contact the site's customer service for confirmation.

Request Example

First press Voice Interface General Instructions to set the site address SHANHAI_BASE_URL and the site token SHANHAI_API_KEY. The following example saves the generated results as a WAV file.

curl --fail-with-body "$SHANHAI_BASE_URL/v1/audio/speech" \
  -H "Authorization: Bearer $SHANHAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "qwen-audio-3.1-tts-flash",
  "input": "你好,欢迎使用ShangHai Do语音服务。",
  "voice": "longanhuan_v3.1",
  "response_format": "wav",
  "speed": 1,
  "instructions": "用自然、清晰的语气朗读。"
}' \
  -o qwen-audio-flash.wav

When you need to control the volume, tone, and target language, use the following object request body; the request address and token are the same as the above example:

{
  "model": "qwen-audio-3.1-tts-flash",
  "input": {
    "text": "全军听令,向前推进!",
    "voice": "longanhuan_v3.1",
    "instruction": "请用沉稳、威严、短促有力的口吻说。",
    "format": "wav",
    "sample_rate": 24000,
    "volume": 50,
    "rate": 1.15,
    "pitch": 1,
    "language_hints": ["zh"],
    "seed": 42
  }
}

When the pronunciation is not accurate, you can add hot_fix to input. pronunciation is a list of "words and pinyin"; replace is a list of "original text and replacement text". Only the replaced text will participate in the synthesis:

{
  "model": "qwen-audio-3.1-tts-flash",
  "input": {
    "text": "欢迎使用ShangHai Do API。",
    "voice": "longanhuan_v3.1",
    "format": "wav",
    "hot_fix": {
      "pronunciation": [{ "ShangHai Do": "shan1 hai3 du4" }],
      "replace": [{ "API": "接口" }]
    }
  }
}

Return results

The successful response body is an audio binary file in the selected format, not JSON, and there is no need to extract the download address. Please save it with the corresponding extension. pcm is original audio data without common file headers. When playing, you need to set the sampling rate and other information separately.

An error message will be returned when the request fails; please check the response status first to avoid saving the error content as audio.

encountered a problem

If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, error time and error information to facilitate troubleshooting.