This topic describes the parameters and interface details of the Qwen-Audio-ASR non-real-time speech recognition HTTP API.
For input requirements such as supported audio formats, file size limits, and duration limits, see Audio specifications.
The following uses the Singapore (ap-southeast-1) endpoint. For another region, replace
In streaming mode, the client needs to handle the following:
These examples preserve all request values and use a quoted heredoc so apostrophes in the JSON text are passed literally.
Service endpoints
The following uses the Singapore (ap-southeast-1) endpoint. For another region, replace ap-southeast-1 with the region ID and use an API key from that region. See Regions and endpoints.
POST https://ap-southeast-1.maas.qwencloudapi.com/api/v1/services/aigc/multimodal-generation/generation
Request headers
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | The authentication token, in the format Bearer $DASHSCOPE_API_KEY. Replace "$DASHSCOPE_API_KEY" with your actual API key. |
| Content-Type | string | Yes | The media type of the request body. Fixed to application/json. |
| X-DashScope-SSE | string | No | Controls whether to request streaming results. Set to enable to request SSE streaming. Set to disable or omit this parameter to return only the final result.Applies only to qwen-audio-3.0-asr-flash: SSE streaming is available only for audio that is at least 1 minute long. |
Request body
- Non-streaming
- Streaming
- With context - non-streaming
- With context - streaming
- Base64
- Inline hotwords
| Parameter | Type | Description |
|---|---|---|
| model | string | (Required) The model name. |
| input | object | (Required) The input information. |
| input.messages | array(object) | (Required) The message list. It contains the audio to recognize and, optionally, conversation context that improves recognition accuracy. Tip: The context feature improves the recognition accuracy of domain-specific terms. For usage, see Context enhancement. Constraints: A request can include at most 5 context messages of each type (input_text and text). If you exceed this limit, only the 5 most recent messages are kept. The total context text per turn (the combined length of the text fields in the user and assistant messages) cannot exceed 400 characters, where each character counts as 1. Any excess is truncated from the end. Tip: When you include context, the message order in messages matters: context messages must be arranged by conversation turn. Within each turn, the user message (of type input_text) must come before the corresponding assistant message (of type text). The user message that contains input_audio must be the last item in the messages array. |
| input.messages.role | string | (Required) The message role. Valid values:
|
| input.messages.content | array(object) | (Required) The message content list. |
| input.messages.content.type | string | (Required) The content type. Each request needs at least one message of type input_audio. Valid values:
|
| input.messages.content.input_audio | object | (Conditionally required) Required when type is input_audio. |
| input.messages.content.input_audio.data | string | (Required) The audio data to recognize. For input requirements such as supported audio formats, file size limits, and duration limits, see Audio specifications. Two methods are supported:
https://example.com/audio/sample.wav Example (Base64): data:audio/wav;base64,{BASE64_ENCODED_DATA} |
| input.messages.content.text | string | (Conditionally required) When type is input_text, enter the recognition results of the user's speech from previous turns or a domain-specific word list. When type is text, enter the large language model's replies from previous turns. Text length is measured in characters, where each character counts as 1. The combined length of the text fields across all messages in a single context turn cannot exceed 400 characters. Any excess is truncated from the end. |
| parameters | object | (Required) The model parameters. Note: Text polishing is disabled by default and is not yet available for qwen-audio-3.0-asr-flash. qwen-audio-3.1-asr-flash supports native text polishing. Text Polishing: While transcribing speech, the model automatically removes meaningless filler words and stuttered repetitions, handles self-corrections made during speech, smooths out colloquial expressions, and standardizes punctuation and text formatting. This results in output that is more concise, fluent, and readable, while preserving the user's original intent and key information as much as possible. |
| parameters.speaker_diarization_enabled | boolean | (Optional) Supported only by qwen-audio-3.1-asr-flash. Specifies whether to enable speaker diarization. Default: false. When set to true, the response uses speaker_id to distinguish speakers and includes output.sentences. When diarization is enabled, keep_dialect and language_hints are ignored. |
| parameters.keep_dialect | boolean | (Optional) Supported only by qwen-audio-3.1-asr-flash. Specifies whether to preserve dialect expressions. Default: false. Set to false to transcribe dialect speech as standard Mandarin text, or true to preserve dialect expressions. |
| parameters.format | string | (Required) The audio format. Set this to match your actual audio format. Supported values include wav, mp3, and opus. For details, see Audio specifications. |
| parameters.sample_rate | string | (Optional) The audio sample rate, in Hz. For example, 16000 means a 16 kHz sample rate. For details, see Audio specifications. |
| parameters.vocabulary_id | string | (Optional) The ID of a precompiled hot word list. Generate this ID in advance by calling the create hot word list API. Pass the ID during recognition to use the hot words in the list. Suitable for scenarios where the vocabulary is known and relatively stable, and where you need to reuse the same word list across requests. For usage details, see Precompiled hotwords. |
| parameters.vocabulary | object | (Optional) Instant hot words. Passed as key-value pairs, where the key is the hot word text (string) and the value is the hot word weight (integer). No hot word list needs to be created in advance. The weight ranges from [1, 5] or is set to 50: a value in [1, 5] makes the model more likely to output the word as the value increases; a value of 50 designates a super hot word, which greatly improves recall, but the number of super hot words cannot exceed 50. Suitable for temporary, session-level hot word optimization. When instant and precompiled hotwords are configured together, the system merges both sets. If the merged set contains more than 2000 hotwords, the system randomly selects 2000 to use. For usage details, see Instant hotwords. Tip: Only qwen-audio-3.1-asr-flash and qwen-audio-3.0-asr-flash support inline hotwords. |
| parameters.language_hints | array[string] | (Optional) The language codes to recognize. If you cannot determine the language in advance, leave this unset and the model detects the language automatically. You can set up to 4 values. If you set more, only the first 4 take effect.
Specifying language codes can improve recognition accuracy.
|
Response body
- Non-streaming
- Streaming
| Parameter | Type | Description |
|---|---|---|
| request_id | string | The unique identifier of this request. |
| output | object | The output result. |
| output.text | string | The full recognized text accumulated so far. |
| output.sentences | array[object] | Returned only when speaker diarization is enabled for qwen-audio-3.1-asr-flash. Contains recognition results for the current and previous sentences. Each element has the same structure as sentence. |
| output.sentence | object | The details of the current sentence. |
| output.sentence.speaker_id | integer | null | The speaker ID, used to distinguish speakers. For qwen-audio-3.1-asr-flash, this contains an ID when speaker diarization is enabled, and is null otherwise. |
| output.sentence.sentence_id | integer | The sentence number, starting from 1. |
| output.sentence.sentence_end | boolean | Whether this is the final result for the sentence. true indicates that recognition of the sentence is complete. |
| output.sentence.begin_time | integer | The start time of the sentence, in milliseconds. |
| output.sentence.end_time | integer | The end time of the sentence, in milliseconds. Returned only when sentence_end is true. |
| output.sentence.text | string | The recognized text of the current sentence. |
| output.sentence.channel_id | integer | The channel number, starting from 0. |
| output.sentence.words | array | The list of word-level timestamps. |
| output.sentence.words.speaker_id | integer | null | The ID of the speaker for this word. For qwen-audio-3.1-asr-flash, this contains an ID when speaker diarization is enabled, and is null otherwise. |
| output.sentence.words.text | string | The word text. |
| output.sentence.words.begin_time | integer | The start time of the word, in milliseconds. |
| output.sentence.words.end_time | integer | The end time of the word, in milliseconds. |
| output.sentence.words.punctuation | string | The punctuation mark after the word. An empty string when there is no punctuation. |
| output.sentence.words.fixed | boolean | Whether the word is stabilized. false indicates that the word's timestamp may be adjusted in subsequent events. |
| usage | object | The usage information. Returned only when sentence_end is true. |
| usage.duration | integer | The processed audio duration, in seconds. |
| usage.input_tokens | integer | The number of input tokens consumed by this request. Applies only to qwen-audio-3.1-asr-flash. |
| usage.output_tokens | integer | The number of output tokens consumed by this request. Applies only to qwen-audio-3.1-asr-flash. |
| usage.total_tokens | integer | The total number of tokens consumed by this request, equal to the sum of input_tokens and output_tokens. Applies only to qwen-audio-3.1-asr-flash. |
SSE streaming result processing logic
In streaming mode, the client needs to handle the following:
- For each SSE event received, parse the JSON in the
datafield. - For
qwen-audio-3.0-asr-flash, useoutput.sentence.sentence_endto determine whether the current sentence has ended. When this value istrue, recognition of the sentence is complete, the word-level timestamps are stabilized, and the result can be used as final. When this value isfalse, recognition is still in progress, and the text and timestamps may be updated in subsequent events. - The
usageinformation is returned only in the sentence-end event and includes the processed audio duration. Forqwen-audio-3.1-asr-flash, it also includes the input, output, and total token counts for the request. This model is billed by token usage.
qwen-audio-3.1-asr-flash without speaker diarization, a word timestamp becomes final only when output.sentence.words[i].fixed is true. Until then, timestamps may change. When speaker diarization is enabled, read the current and previous sentence results from output.sentences.