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
URL
- Singapore
- US (Virginia)
- China (Beijing)
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completionsbase_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1Replace {WorkspaceId} with your actual workspace ID.Replace {WorkspaceId} with your actual workspace ID.Request bodymodelstring(Required)The model name. This parameter applies only to the Qwen3-ASR-Flash model.messagesarray(Required)The list of messages.
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 use a system message, it must be the first message in the messages list.
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 type string(Required)Set to input_audio, which indicates that the input is audio.input_audiostring(Required)The audio to be recognized. For more information about how to use this parameter, see Quick start.In OpenAI-compatible mode, the Qwen3-ASR-Flash model supports two input formats: Base64-encoded 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.
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.
boolean(Optional) Defaults to: falseSpecifies whether to use streaming output. See Streaming output.Valid values:
true to reduce the risk of request timeouts.stream_optionsobject(Optional)The configuration items for streaming output. This parameter takes effect only when stream is set to true.
Properties include_usage boolean(Optional) Defaults to: falseSpecifies whether to include token consumption information in the last data block of the response.Valid values:
During streaming output, token consumption information appears only in the last data block of the response. |
|
Response bodyidstringThe unique identifier for this call.choicesarrayThe output information from the model.
Properties finish_reason stringValid values:
integerThe index of the current object in the choices array.messageobjectThe message object output by the model.
Properties role stringThe role of the output message. Set to assistant.contentarrayThe speech recognition result.annotationsarrayThe output annotation information, such as the language.
Properties language stringThe language of the recognized audio. If the language request parameter is specified, this value is the same as the specified parameter.
Valid values
stringSet to audio_info, which indicates audio information.emotionstringThe emotion of the recognized audio. The following emotions are supported:
integerThe UNIX timestamp (in seconds) when the request was created.modelstringThe model used for this request.objectstringAlways chat.completion.usageobjectThe token consumption information for this request.
Properties completion_tokens integerThe number of tokens in the model output.completion_tokens_details objectThe fine-grained details of the tokens in the model output.
Properties text_tokens integerThe number of tokens in the model output text.objectThe number of tokens in the input.prompt_tokens_details objectThe fine-grained details of the tokens in the input.
Properties audio_tokens integerThe 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.text_tokens integerYou can ignore this parameter.integerThe audio duration in seconds.total_tokens integerThe total number of input and output tokens (total_tokens = completion_tokens + prompt_tokens). |
DashScope synchronous
URL
- Singapore
- US (Virginia)
- China (Beijing)
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generationbase_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1Replace {WorkspaceId} with your actual workspace ID.Replace {WorkspaceId} with your actual workspace ID.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 Quick start.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.
| The following example shows how to recognize an audio file from a URL. For an example of how to recognize a local audio file, see Quick start. |
Response bodyrequest_idstringThe unique identifier for this call.The parameter returned by the Java SDK is requestIdoutput objectThe call result information.
Properties choices arrayThe model output. Returned when result_format is message.
Properties finish_reason stringValid values:
objectThe message object output by the model.
Properties role stringThe role of the output message. Set to assistant.contentarrayThe content of the output message.
Properties text stringThe speech recognition result.arrayThe output annotation information, such as the language.
Properties language stringThe language of the recognized audio. If the language request parameter is specified, this value is the same as the specified parameter.
Valid values
stringSet to audio_info, which indicates audio information.emotionstringThe emotion of the recognized audio. The following emotions are supported:
objectThe token consumption information for this request.
Properties input_tokens_details objectThe length of the input content for Qwen3-ASR-Flash in tokens.
Properties text_tokens integerYou can ignore this parameter.objectThe length of the output content from Qwen3-ASR-Flash in tokens.
Properties text_tokens integerThe length of the recognized text output by Qwen3-ASR-Flash in tokens.integerThe 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 QuickStart. 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
Submit a task
URL
- Singapore
- China (Beijing)
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/transcriptionbase_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1Replace {WorkspaceId} with your actual workspace ID.Replace {WorkspaceId} with your actual workspace ID.Request bodymodelstring(Required)The model name. This parameter applies only to the Qwen3-ASR-Flash-Filetrans model.inputobject(Required)
Properties 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:object(Optional)
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.
boolean(Optional) Defaults to: falseSpecifies whether to return word-level timestamps:
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. |
|
Response bodyrequest_idstringThe unique identifier for this call.outputobjectThe call result information.
Properties task_id stringThe task ID. This ID is passed as a request parameter in the API for querying speech recognition tasks.task_statusstringThe task status:
|
Get the task execution result
URL
- Singapore
- China (Beijing)
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}base_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1Replace {WorkspaceId} with your actual workspace ID.Replace {WorkspaceId} with your actual workspace ID.Request bodytask_idstring(Required)The task ID. Pass the task_id from the response of the Submit a task operation to query the speech recognition result. |
|
Response bodyrequest_idstringThe unique identifier for this call.outputobjectThe call result information.
Properties task_id stringThe task ID. This ID is passed as a request parameter in the API for querying speech recognition tasks.task_statusstringThe task status:
objectThe speech recognition result.
Properties transcription_url stringThe 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. stringThe time when the task was submitted.schedule_timestringThe time when the task was scheduled, which is the start time of execution.end_timestringThe time when the task ended.task_metricsobjectTask metrics, which include statistics on the status of subtasks.
Properties TOTAL integerThe total number of subtasks.SUCCEEDEDintegerThe number of successful subtasks.FAILEDintegerThe number of failed subtasks.stringThe error code. This is returned only when the task fails.messagestringThe error message. This is returned only when the task fails.usageobjectThe token consumption information for this request.
Properties seconds integerThe audio duration for Qwen3-ASR-Flash in seconds. |
Description of asynchronous call resultsfile_urlstringThe URL of the recognized audio file.audio_infoobjectInformation about the recognized audio file.
Properties format stringThe audio format.sample_rate integerThe audio sampling rate.arrayA list of complete recognition results. Each element corresponds to the recognized content of an audio track.
Properties channel_id integerThe audio track index, starting from 0.textstringThe recognized text.sentencesobjectA list of sentence-level recognition results.
Properties begin_time integerThe start timestamp of the sentence in milliseconds.end_time integerThe end timestamp of the sentence in milliseconds.textstringThe recognized text.sentence_idintegerThe sentence index, starting from 0.languagestringThe language of the recognized audio. If the language request parameter is specified, this value is the same as the specified parameter.
Valid values
stringThe emotion of the recognized audio. The following emotions are supported:
objectA list of word-level recognition results. This result is displayed when the enable_words request parameter is set to true.
Properties begin_time integerThe start timestamp in milliseconds.end_time integerThe end timestamp in milliseconds.textstringThe recognized text.punctuationstringThe punctuation mark. |