Qwen-Audio is a large-scale audio language model developed by Alibaba Cloud. It can understand various types of audio, including human speech, natural sounds, music, and singing. The model's core features include audio transcription, content summarization, sentiment analysis, audio event detection, and voice chat.
Examples
| Application Scenario | Input Example | Output Result |
|---|---|---|
Speech recognition and analysis
| What is said in this audio? Is the speaker male or female? What is their approximate age? What language or dialect are they using? What is their emotion? | The original content of this audio is: 'This is a letter from the Panzhihua Iron and Steel Works in Sichuan.' The speaker is a male, approximately 30 years old, speaking the Southwestern Mandarin-Chongqing dialect. The emotion is calm. |
| Audio Q&AAsks and answers questions based on audio content, such as locating the timestamp of specific information in the audio. | Where does "Ali" appear in this audio? | " Ali" appears from 1.53 seconds to 1.87 seconds. |
| Voice chatThe model can respond directly to audio content without any text instructions. | You can try using earplugs or finding a relatively quiet work environment to help you concentrate. |
Supported models
| Model | Version | Context window | Max input | Max output | Input cost | Output cost | Free quotaNote |
|---|---|---|---|---|---|---|---|
| (tokens) | (per 1M tokens) | ||||||
| qwen-audio-turbo | Stable | 8,000 | 6,000 | 1,500 | This model is currently available for free trial only.You cannot invoke the model after the free quota is used. We recommend using Qwen-Omni as an alternative. | 100,000 tokensValid for 90 days after activating Model Studio | |
| qwen-audio-turbo-latest | Latest | 8,192 | 6,144 | 2,048 | |||
Rules for converting audio to tokens
Rules for converting audio to tokens
Getting started
Prerequisites
- Obtain an API key and configure it as an environment variable.
- If you use the DashScope SDK to call the model, install the latest version of the SDK.
- Python
- Java
- curl
Core features
Voice conversation
The model can respond directly to audio content without any text instructions. For example, if the audio contains a question such as "What is a suitable activity for this environment?", the model replies with suitable activities.
Currently, theqwen-audio-turbo-latestandqwen2-audio-instructmodels support voice chat.
- Python
- Java
- curl
Passing local files (Base64 encoding or file path)
Qwen-Audio supports two methods for uploading local files: Base64 encoding and file path. You can choose an upload method based on the file size and SDK type. For specific recommendations, see How to choose a file upload method.
- Pass by file path
- Base64-Encoded Input
Specify the file path
Specify the file path
System | SDK | File path to pass | Example |
|---|---|---|---|
Linux or macOS | Python SDK | file://{absolute_path_of_the_file} | file:///home/images/test.mp3 |
Java SDK | |||
Windows | Python SDK | file://{absolute_path_of_the_file} | file://D:/images/test.mp3 |
Java SDK | file:///{absolute_path_of_the_file} | file:///D:/images/test.mp3 |
- Pass by file path
- Pass by Base64 encoding
Passing a file by its path is supported only for calls made using the DashScope Python and Java SDKs. This method is not supported for HTTP calls.
- Python
- Java
More usage
Limits
Supported audio files
-
File size:
- When passed as a public URL or local path: The audio file size cannot exceed 10 MB.
- When passed as a Base64-encoded string, the size of the encoded string cannot exceed 10 MB.
- Audio duration: The audio duration is limited to 30 seconds. If it exceeds 30 seconds, the model processes only the first 30 seconds.
- File format: Common encoded audio formats are supported, such as AMR, WAV (CodecID: GSM_MS), WAV (PCM), 3GP, 3GPP, AAC, and MP3.
- Supported languages: Chinese, English, Cantonese, French, Italian, Spanish, German, and Japanese.
Audio file input methods
- Public URL: Provide a publicly accessible URL that uses the HTTP or HTTPS protocol. To obtain a public URL, you can upload a local file to OSS or upload a file to get a temporary URL.
- Pass as Base64 encoding: Convert the file to a Base64-encoded string and pass it in the request.
- Pass as a local file path: Pass the path of the local file directly.
Going live
The Qwen-Audio model is available for free trial only, has calling quota limits, and does not have a paid option. If you plan to use the audio understanding feature in a production environment, we recommend that you migrate to the Qwen-Omni model.
-
Migration advantages
Comparison item
Qwen-Audio
Qwen-Omni
Commercial support
Free trial only, no paid option
Paid option available, suitable for production environments
Features
Audio understanding capabilities
Omni-modal capabilities including audio
Region restrictions
Only the Beijing region is supported
Supports international (Singapore) and Chinese mainland (Beijing) regions
- Migration method The usage of the Qwen-Omni model is different from that of Qwen-Audio. For more information, see Asynchronous (Qwen-Omni).
API reference
For more information about the input and output parameters of the Qwen-Audio model, see Qwen.
Error codes
If the model call fails and returns an error message, see Error codes for resolution.
FAQ
How to choose a file upload method?
How to choose a file upload method?
Audio file specifications | DashScope SDK (Python, Java) | DashScope HTTP |
|---|---|---|
Greater than 7 MB and less than 10 MB | Pass local path | Only public URLs are supported. Use Alibaba Cloud Object Storage Service. |
Less than 7 MB | Pass local path | Base64 encoding |
How to compress an audio file to the required size?
How to compress an audio file to the required size?
- Online tools: Use online tools such as Compresss to compress audio files.
- Code implementation: Use the FFmpeg tool. For more information, see the FFmpeg official website.