Audio file recognition (Qwen-ASR) API reference
Input and output parameters for the Qwen-ASR model. Call the API using the OpenAI compatible or DashScope protocol.
User guide: See Non-real-time speech recognition.
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
The OpenAI-compatible mode is not available in the US region.
URL
Singapore
HTTP request address: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions
base_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1
Replace {WorkspaceId} with your actual workspace ID.
Replace {WorkspaceId} with your actual workspace ID.
China (Beijing)
HTTP request address: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions
base_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1
Replace {WorkspaceId} with your actual workspace ID.
Replace {WorkspaceId} with your actual workspace ID.
Alibaba Cloud Model Studio has released workspace-specific domains for the China (Beijing) and Singapore regions. The new dedicated domains deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:
China (Beijing): from
dashscope.aliyuncs.comto{WorkspaceId}.cn-beijing.maas.aliyuncs.comSingapore: from
dashscope-intl.aliyuncs.comto{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
Replace {WorkspaceId} with your actual Workspace ID. The existing domains remain fully functional.
Request body |
Input: audio file URLPython SDK
Node.js SDK
cURLSingapore region URL. Replace WorkspaceId with your actual workspace ID. The URL varies by region.
Input: Base64-encoded audio fileYou can also pass Base64-encoded audio as a data URL, in the format
Python SDKThe example uses this audio file: welcome.mp3.
Node.js SDKThe example uses this audio file: welcome.mp3.
|
|
model The model name. This parameter applies only to the Qwen3-ASR-Flash model. |
|
|
messages The list of messages. |
|
|
asr_options Specifies whether to enable certain features.
|
|
|
stream Specifies whether to use streaming output. See Streaming output. Valid values:
Set to |
|
|
stream_options The configuration items for streaming output. This parameter takes effect only when |
Response body |
Non-streaming output
Streaming output
|
|
id The unique identifier for this call. |
|
|
choices The output information from the model. |
|
|
created The UNIX timestamp (in seconds) when the request was created. |
|
|
model The model used for this request. |
|
|
object Always |
|
|
usage The token consumption information for this request. |
DashScope synchronous
URL
Singapore
HTTP request address: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
base_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1
Replace {WorkspaceId} with your actual workspace ID.
Replace {WorkspaceId} with your actual workspace ID.
US (Virginia)
If you select the US deployment scope, model inference compute resources are restricted to the United States. Static data is stored in your selected region. Supported region: US (Virginia).
HTTP request address: POST https://dashscope-us.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
base_url for SDK calls: https://dashscope-us.aliyuncs.com/api/v1
China (Beijing)
HTTP request address: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
base_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1
Replace {WorkspaceId} with your actual workspace ID.
Alibaba Cloud Model Studio has released workspace-specific domains for the China (Beijing) and Singapore regions. The new dedicated domains deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:
China (Beijing): from
dashscope.aliyuncs.comto{WorkspaceId}.cn-beijing.maas.aliyuncs.comSingapore: from
dashscope-intl.aliyuncs.comto{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
Replace {WorkspaceId} with your actual Workspace ID. The existing domains remain fully functional.
Request body |
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. cURL
Java
Python
|
|
model The model name. This parameter applies only to the Qwen3-ASR-Flash model. |
|
|
messages The list of messages. When you make an HTTP call, place messages in the input object. |
|
|
asr_options Specifies whether to enable certain features. This parameter is supported only by the Qwen3-ASR-Flash model. |
Response body |
|
|
request_id The unique identifier for this call. The parameter returned by the Java SDK is requestId |
|
|
output The call result information. |
|
|
usage The token consumption information for this request. |
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.
-
You can choose to use an SDK or call the RESTful API directly based on your integration environment.
-
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.
-
-
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 a task
URL
Singapore
HTTP request address: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/transcription
base_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1
Replace {WorkspaceId} with your actual workspace ID.
Replace {WorkspaceId} with your actual workspace ID.
China (Beijing)
HTTP request address: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/asr/transcription
base_url for SDK calls: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1
Replace {WorkspaceId} with your actual workspace ID.
Alibaba Cloud Model Studio has released workspace-specific domains for the China (Beijing) and Singapore regions. The new dedicated domains deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:
China (Beijing): from
dashscope.aliyuncs.comto{WorkspaceId}.cn-beijing.maas.aliyuncs.comSingapore: from
dashscope-intl.aliyuncs.comto{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
Replace {WorkspaceId} with your actual Workspace ID. The existing domains remain fully functional.
Request body |
cURLJavaFor SDK examples, see QuickStart.
PythonFor SDK examples, see QuickStart.
|
|
model The model name. This parameter applies only to the Qwen3-ASR-Flash-Filetrans model. |
|
|
input |
|
|
parameters |
Response body |
|
|
request_id The unique identifier for this call. |
|
|
output The call result information. |
Get the task execution result
URL
Singapore
HTTP request address: 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/v1
Replace {WorkspaceId} with your actual workspace ID.
Replace {WorkspaceId} with your actual workspace ID.
China (Beijing)
HTTP request address: 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/v1
Replace {WorkspaceId} with your actual workspace ID.
Alibaba Cloud Model Studio has released workspace-specific domains for the China (Beijing) and Singapore regions. The new dedicated domains deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:
China (Beijing): from
dashscope.aliyuncs.comto{WorkspaceId}.cn-beijing.maas.aliyuncs.comSingapore: from
dashscope-intl.aliyuncs.comto{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
Replace {WorkspaceId} with your actual Workspace ID. The existing domains remain fully functional.
Request body |
cURLJavaFor SDK examples, see QuickStart.
PythonFor SDK examples, see QuickStart.
|
|
task_id The task ID. Pass the task_id from the response of the Submit a task operation to query the speech recognition result. |
Response body |
RUNNING
SUCCEEDED
FAILED
|
|
request_id The unique identifier for this call. |
|
|
output The call result information. |
Description of asynchronous call results |
|
|
file_url The URL of the recognized audio file. |
|
|
audio_info Information about the recognized audio file. |
|
|
transcripts A list of complete recognition results. Each element corresponds to the recognized content of an audio track. |