Input and output parameters for the Qwen-ASR model. Call the API using the OpenAI compatible or DashScope protocol.
Model connection types
Different models support different connection types.
| Model | Connection type |
|---|---|
| Qwen3-ASR-Flash-Filetrans | Only DashScope asynchronous invocation is supported |
| Qwen3-ASR-Flash | OpenAI compatible and DashScope synchronous |
OpenAI compatible
URL
HTTP request address: POST https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1/chat/completions
base_url for SDK calls: https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1
The URLs above are for the Singapore (ap-southeast-1) region. Qwen3-ASR-Flash is also available in China North 2 (Beijing) (cn-beijing) and US (Virginia) (us-east-1, service deployment scope: US). To use another region, replace ap-southeast-1 with its region ID and use an API key from that region. See Regions and endpoints.
Request body
Request examples
Use OpenAI Python SDK version
1.52.0 or later, or Node.js SDK version 4.68.0 or later.- Input: audio file URL
- Input: Base64-encoded audio file
- Python SDK
- Node.js SDK
- cURL
| Parameter | Type | Description |
|---|---|---|
| model | string | (Required) The model name. This parameter applies only to the Qwen3-ASR-Flash model. |
| messages | array | (Required) The list of messages. System Message (object) (Optional) Used to provide context for speech recognition, such as background text and entity glossaries. Does not support setting model role or other traditional system prompts. If you use a system message, it must be the first message in the messages list. User Message (object) (Required) The message sent by the user to the model. |
| messages.role | string | (Required) Set to system. |
| messages.content | array | (Required) The content of the user message. Only one message is allowed in the array. |
| messages.content.type | string | (Required) Set to input_audio, which indicates that the input is audio. |
| messages.content.input_audio | object | (Required) The audio object to be recognized. |
| messages.content.input_audio.data | string | (Required) The audio to be recognized. For more information about how to use this parameter, see Request examples. input_audio.data accepts a publicly accessible audio file URL or a Base64 Data URI. It does not accept a local absolute file path directly. Read and encode local audio files as Data URIs before submitting them. When you use an SDK, if the audio file is stored in OSS, temporary URLs that start with oss:// are not supported. When you use a RESTful API, if the audio file is stored in OSS, temporary URLs that start with oss:// are supported. Note: Tip: - Temporary URLs are valid for 48 hours. After expiration, they cannot be used. Do not use them in production environments.
|
| messages.role | string | (Required) The role of the user message. Set to user. |
| asr_options | object | (Optional) Specifies whether to enable certain features. Note: asr_options is not a standard OpenAI parameter. With the OpenAI Python SDK, pass it through extra_body. With the Node.js SDK, pass asr_options as a top-level request body parameter. |
| asr_options.language | string | (Optional) No default value If the language of the audio is known, you can specify it using this parameter to improve recognition accuracy. You can specify only one language. If the audio language is uncertain or includes multiple languages (such as a mix of Chinese, English, Japanese, and Korean), do not specify this parameter.
|
| asr_options.enable_itn | boolean | (Optional) Defaults to: false Specifies whether to enable Inverse Text Normalization (ITN). This feature applies only to Chinese and English audio.
|
| stream | boolean | (Optional) Defaults to: false Specifies whether to use streaming output. See Streaming output. Valid values:
true to reduce the risk of request timeouts. |
| stream_options | object | (Optional) The configuration items for streaming output. This parameter takes effect only when stream is set to true. |
| stream_options.include_usage | boolean | (Optional) Defaults to: false Specifies whether to include token consumption information in the last data block of the response. Valid values:
|
Response body
Qwen3-ASR-Flash does not return timestamps through the OpenAI-compatible API. For timestamps, use the Qwen-Audio-ASR-Filetrans series. For integration details, see the HTTP API.
choices[].delta.annotations[].emotion for streaming output and choices[].message.annotations[].emotion for non-streaming output.
| Parameter | Type | Description |
|---|---|---|
| id | string | The unique identifier for this call. |
| choices | array | The output information from the model. |
| choices.finish_reason | string | Valid values:
|
| choices.index | integer | The index of the current object in the choices array. |
| choices.message | object | The message object output by the model. |
| choices.message.role | string | The role of the output message. Set to assistant. |
| choices.message.content | string | The speech recognition result. |
| choices.message.annotations | array | The output annotation information, such as the language. |
| choices.message.annotations.language | string | The language of the recognized audio. If the language request parameter is specified, this value is the same as the specified parameter.
|
| choices.message.annotations.type | string | Set to audio_info, which indicates audio information. |
| choices.message.annotations.emotion | string | Emotion recognition is always enabled and requires no additional configuration. The emotion of the recognized audio. The following emotions are supported:
|
| created | integer | The UNIX timestamp (in seconds) when the request was created. |
| model | string | The model used for this request. |
| object | string | Always chat.completion. |
| usage | object | The token consumption information for this request. |
| usage.completion_tokens | integer | The number of tokens in the model output. |
| usage.completion_tokens_details | object | The fine-grained details of the tokens in the model output. |
| usage.completion_tokens_details.text_tokens | integer | The number of tokens in the model output text. |
| usage.prompt_tokens | object | The number of tokens in the input. |
| usage.prompt_tokens_details | object | The fine-grained details of the tokens in the input. |
| usage.prompt_tokens_details.audio_tokens | integer | The length of the input audio in tokens. Audio-to-token conversion rule: Each second of audio is converted to 25 tokens. Durations less than 1 second are counted as 1 second. |
| usage.prompt_tokens_details.text_tokens | integer | You can ignore this parameter. |
| usage.seconds | integer | The audio duration in seconds. |
| usage.total_tokens | integer | The total number of input and output tokens (total_tokens = completion_tokens + prompt_tokens). |
DashScope synchronous
URL
HTTP request address: POST https://ap-southeast-1.maas.qwencloudapi.com/api/v1/services/aigc/multimodal-generation/generation
base_url for SDK calls: https://ap-southeast-1.maas.qwencloudapi.com/api/v1
The URLs above are for the Singapore (ap-southeast-1) region. Qwen3-ASR-Flash is also available in China North 2 (Beijing) (cn-beijing) and US (Virginia) (us-east-1, service deployment scope: US). To use another region, replace ap-southeast-1 with its region ID and use an API key from that region. See Regions and endpoints.
Request bodymodelstring(Required)The model name. This parameter applies only to the Qwen3-ASR-Flash model.messagesarray(Required)The list of messages.When you make an HTTP call, place messages in the input object.
Message types System Message object (Optional)Used to provide context for speech recognition, such as background text and entity glossaries. Does not support setting model role or other traditional system prompts. If you set a system message, place it at the beginning of the messages list.Only Qwen3-ASR-Flash supports this parameter.
Properties role string(Required)Set to system.object(Required)The message sent by the user to the model.
Properties content array(Required)The content of the user message. Only one message is allowed in the array.
Properties audio string(Required)The audio to be recognized. For more information about how to use this parameter, see Request examples.When you use DashScope, the Qwen3-ASR-Flash model supports three input formats: Base64-encoded files, absolute paths of local files, and URLs of audio files that are accessible over the public network.When you use an SDK, if the audio file is stored in OSS, temporary URLs that start with oss:// are not supported.When you use a RESTful API, if the audio file is stored in OSS, temporary URLs that start with oss:// are supported. Note:
string(Required)The role of the user message. Set to user.object(Optional)Specifies whether to enable certain features.This parameter is supported only by the Qwen3-ASR-Flash model.
Properties language string (Optional) No default valueIf the language of the audio is known, you can specify it using this parameter to improve recognition accuracy.You can specify only one language.If the audio language is uncertain or includes multiple languages (such as a mix of Chinese, English, Japanese, and Korean), do not specify this parameter.
Valid values
boolean (Optional) Defaults to: falseSpecifies whether to enable Inverse Text Normalization (ITN). This feature applies only to Chinese and English audio.
| Request examplesQwen3-ASR-Flash supports recordings up to 5 minutes long, accepts a public audio file URL or a local file upload as input, and can return recognition results in streaming mode.
|
Response body
| Parameter | Type | Description |
|---|---|---|
| request_id | string | The unique identifier for this call. Note: The parameter returned by the Java SDK is requestId. |
| output | object | The call result information. |
| output.choices | array | The model output. Returned when result_format is message. |
| output.choices.finish_reason | string | Valid values:
|
| output.choices.message | object | The message object output by the model. |
| output.choices.message.role | string | The role of the output message. Set to assistant. |
| output.choices.message.content | array | The content of the output message. |
| output.choices.message.content.text | string | The speech recognition result. |
| output.choices.message.annotations | array | The output annotation information, such as the language. |
| output.choices.message.annotations.language | string | The language of the recognized audio. If the language request parameter is specified, this value is the same as the specified parameter.
|
| output.choices.message.annotations.type | string | Set to audio_info, which indicates audio information. |
| output.choices.message.annotations.emotion | string | Emotion recognition is always enabled and requires no additional configuration. The emotion of the recognized audio. The following emotions are supported:
|
| usage.input_tokens_details | object | The length of the input content for Qwen3-ASR-Flash in tokens. |
| usage.input_tokens_details.text_tokens | integer | You can ignore this parameter. |
| usage.output_tokens_details | object | The length of the output content from Qwen3-ASR-Flash in tokens. |
| usage.output_tokens_details.text_tokens | integer | The length of the recognized text output by Qwen3-ASR-Flash in tokens. |
| usage.seconds | integer | The audio duration for Qwen3-ASR-Flash in seconds. |
DashScope asynchronous invocation
Process description
Asynchronous invocation is designed for long audio files or time-consuming tasks. It uses a two-step "submit-poll" process to prevent request timeouts:
-
Step 1: Submit a task
- The client initiates an asynchronous processing request.
- After validating the request, the server does not execute the task immediately. Instead, it returns a unique
task_id, indicating that the task has been successfully created.
-
Step 2: Obtain the result
- The client uses the
task_idto poll the result query API. - When the task is complete, the result query API returns the final recognition result.
- The client uses the
-
Use an SDK. For sample code, see Request examples. For request parameters, see the Request body of the Submit a task operation. For information about the response, see Description of asynchronous call results.
SDKs handle the underlying API call details automatically.
- Submit a task: Call the
async_call()(Python) orasyncCall()(Java) method to submit the task. This method returns a task object containing atask_id. - Obtain the result: Use the task object returned in the previous step or the
task_idto call thefetch()method to retrieve the result. The SDK automatically handles the internal polling logic until the task is complete or times out.
- Submit a task: Call the
-
Use a RESTful API
Calling the RESTful API directly provides maximum flexibility.
- Submit the task. If the request is successful, the response body will contain a
task_id. - Use the
task_idfrom the previous step to retrieve the task execution result.
- Submit the task. If the request is successful, the response body will contain a
Complete example
- HTTP
- Java SDK
- Python SDK
- Download the recognition result
Java
Submit a task
URL
HTTP request address: POST https://ap-southeast-1.maas.qwencloudapi.com/api/v1/services/audio/asr/transcription
base_url for SDK calls: https://ap-southeast-1.maas.qwencloudapi.com/api/v1
The URLs above are for the Singapore (ap-southeast-1) region. Qwen3-ASR-Flash-Filetrans is also available in China North 2 (Beijing): replace ap-southeast-1 with cn-beijing and use an API key from the China North 2 (Beijing) region. See Regions and endpoints.
Request body
- cURL
- Java
- Python
| Parameter | Type | Description |
|---|---|---|
| model | string | (Required) The model name. This parameter applies only to the Qwen3-ASR-Flash-Filetrans model. |
| input | object | (Required) |
| input.file_url | string | (Required) The URL of the audio file to be recognized. The URL must be accessible over the public network. When you use an SDK, if the audio file is stored in OSS, temporary URLs that start with oss:// are not supported. When you use a RESTful API, if the audio file is stored in OSS, temporary URLs that start with oss:// are supported. Note: Tip: - Temporary URLs are valid for 48 hours. After expiration, they cannot be used. Do not use them in production environments.
|
| parameters | object | (Optional) |
| parameters.language | string | (Optional) No default value If the language of the audio is known, you can specify it using this parameter to improve recognition accuracy. You can specify only one language. If the audio language is uncertain or includes multiple languages (such as a mix of Chinese, English, Japanese, and Korean), do not specify this parameter.
|
| parameters.enable_itn | boolean | (Optional) Defaults to: false Specifies whether to enable Inverse Text Normalization (ITN). This feature applies only to Chinese and English audio.
|
| parameters.enable_words | boolean | (Optional) Defaults to: false Specifies whether to return word-level timestamps:
|
| parameters.channel_id | array | (Optional) Defaults to: [0] Specifies the indexes of the audio tracks to be recognized in a multi-track audio file. The index starts from 0. For example, [0] indicates that the first audio track is recognized, and [0, 1] indicates that the first and second audio tracks are recognized simultaneously. If this parameter is omitted, the first audio track is processed by default. Tip: Each specified audio track is billed separately. For example, requesting [0, 1] for a single file will incur two separate charges. |
Response body
| Parameter | Type | Description |
|---|---|---|
| request_id | string | The unique identifier for this call. |
| output.task_id | string | The task ID. This ID is passed as a request parameter in the API for querying speech recognition tasks. |
| output.task_status | string | The task status:
|
Get the task execution result
URL
HTTP request address: GET https://ap-southeast-1.maas.qwencloudapi.com/api/v1/tasks/{task_id}
base_url for SDK calls: https://ap-southeast-1.maas.qwencloudapi.com/api/v1
The URLs above are for the Singapore (ap-southeast-1) region. Qwen3-ASR-Flash-Filetrans is also available in China North 2 (Beijing): replace ap-southeast-1 with cn-beijing and use an API key from the China North 2 (Beijing) region. See Regions and endpoints.
Request body
- cURL
- Java
- Python
| Parameter | Type | Description |
|---|---|---|
| task_id | string | (Required) The task ID. Pass the task_id from the response of the Submit a task operation to query the speech recognition result. |
Response body
| Parameter | Type | Description |
|---|---|---|
| output.result | object | The speech recognition result. |
| output.result.transcription_url | string | The download URL for the recognition result file. The link is valid for 24 hours. After the link expires, you cannot query the task or download the result using the previous URL. The recognition result is saved as a JSON file. You can download the file from this link or read the file content directly using an HTTP request. For more information, see Description of asynchronous call results. |
| output.submit_time | string | The time when the task was submitted. |
| output.schedule_time | string | The time when the task was scheduled, which is the start time of execution. |
| output.end_time | string | The time when the task ended. |
| output.task_metrics | object | Task metrics, which include statistics on the status of subtasks. |
| output.task_metrics.TOTAL | integer | The total number of subtasks. |
| output.task_metrics.SUCCEEDED | integer | The number of successful subtasks. |
| output.task_metrics.FAILED | integer | The number of failed subtasks. |
| output.code | string | The error code. This is returned only when the task fails. |
| output.message | string | The error message. This is returned only when the task fails. |
| output.usage | object | The token consumption information for this request. |
| output.usage.seconds | integer | The audio duration for Qwen3-ASR-Flash in seconds. |
Description of asynchronous call results
| Parameter | Type | Description |
|---|---|---|
| file_url | string | The URL of the recognized audio file. |
| audio_info | object | Information about the recognized audio file. |
| audio_info.format | string | The audio format. |
| audio_info.sample_rate | integer | The audio sampling rate. |
| transcripts | array | A list of complete recognition results. Each element corresponds to the recognized content of an audio track. |
| transcripts.channel_id | integer | The audio track index, starting from 0. |
| transcripts.text | string | The recognized text. |
| transcripts.sentences | object | A list of sentence-level recognition results. |
| transcripts.sentences.begin_time | integer | The start timestamp of the sentence in milliseconds. |
| transcripts.sentences.end_time | integer | The end timestamp of the sentence in milliseconds. |
| transcripts.sentences.text | string | The recognized text. |
| transcripts.sentences.sentence_id | integer | The sentence index, starting from 0. |
| transcripts.sentences.language | string | The language of the recognized audio. If the language request parameter is specified, this value is the same as the specified parameter.
|
| transcripts.sentences.emotion | string | Emotion recognition is always enabled and requires no additional configuration. The emotion of the recognized audio. The following emotions are supported:
|
| transcripts.sentences.words | object | A list of word-level recognition results. This result is displayed when the enable_words request parameter is set to true. |
| transcripts.sentences.words.begin_time | integer | The start timestamp in milliseconds. |
| transcripts.sentences.words.end_time | integer | The end timestamp in milliseconds. |
| transcripts.sentences.words.text | string | The recognized text. |
| transcripts.sentences.words.punctuation | string | The punctuation mark. |