Official Python toolkit for the Qwen3-ASR API. Parallel high‑throughput calls, robust long‑audio transcription, multi‑sample‑rate support.
Python
1,013
9 commits
updated Feb 5, 2026
Qwen3-ASR is now open-sourced 🎉🎉🎉. Welcome to visit the GitHub and blog for more information. The open-source model offers functionality comparable to the API and supports free, fast local deployment. Qwen3-ASR open-source model includes two powerful all-in-one speech recognition models (0.6B/1.7B) that support language identification and ASR for 52 languages and dialects, as well as a novel non-autoregressive speech forced-alignment model that can align text–speech pairs in 11 languages. Its powerful performance is sufficient to deliver highly compelling speech-to-text transcription capabilities. Welcome to use it!
An advanced, high-performance Python command-line toolkit for using the Qwen-ASR API (formerly Qwen3-ASR-Flash). This implementation overcomes the API's 3-minute audio length limitation by intelligently splitting long audio/video files and processing them in parallel, enabling rapid transcription of hours-long content.
.srt subtitle files based on VAD segments, perfect for adding captions to video content..mp4, .mov, .mkv, .mp3, .wav, .m4a) thanks to its reliance on FFmpeg.This tool follows a robust pipeline to deliver fast and accurate transcriptions for long-form media:
.txt file. Optionally, a timestamped .srt subtitle file can also be generated.Follow these steps to set up and run the project on your local machine.
sudo apt update && sudo apt install ffmpegbrew install ffmpegYou can obtain one from the DashScope Console. If you are calling the API services of Tongyi Qwen for the first time, you can follow the tutorial on this website to create your own API Key.
For better security and convenience, it is highly recommended to set your API key as an environment variable named DASHSCOPE_API_KEY. The script will automatically use it, and you won't need to pass the --api-key argument in the command.
On Linux/macOS:
export DASHSCOPE_API_KEY="your_api_key_here"
(To make this permanent, add the line to your ~/.bashrc, ~/.zshrc, or ~/.profile file.)
On Windows (Command Prompt):
set DASHSCOPE_API_KEY="your_api_key_here"
On Windows (PowerShell):
$env:DASHSCOPE_API_KEY="your_api_key_here"
(For a permanent setting on Windows, search for "Edit the system environment variables" in the Start Menu and add DASHSCOPE_API_KEY to your user variables.)
We recommend installing the tool directly from PyPI for the simplest setup.
Simply run the following command in your terminal. This will install the package and make the qwen3-asr command available system-wide.
pip install qwen3-asr-toolkit
If you want to install the latest development version or contribute to the project, you can install from the source code.
Clone the repository:
git clone https://github.com/QwenLM/Qwen3-ASR-Toolkit.git
cd Qwen3-ASR-Toolkit
Install the package:
pip install .
Once installed, you can use the qwen3-asr command directly from your terminal. By default, the tool will print progress information.
qwen3-asr -i <input_file_or_url> [-key <api_key>] [-j <num_threads>] [-c <context>] [-d <duration>] [-t <tmp_dir>] [--save-srt] [-s]
| Argument | Short | Description | Required/Optional |
|---|---|---|---|
--input-file | -i | Path to the local media file or a remote URL (http/https) to transcribe. | Required |
--context | -c | Text context to guide the ASR model, improving recognition of specific terms. | Optional, Default: "" |
--dashscope-api-key | -key | Your DashScope API Key. | Optional (if DASHSCOPE_API_KEY is set) |
--num-threads | -j | The number of concurrent threads to use for API calls. | Optional, Default: 4 |
--vad-segment-threshold | -d | Target duration in seconds for each VAD-split audio chunk. | Optional, Default: 120 |
--tmp-dir | -t | Path to a directory for storing temporary chunk files. | Optional, Default: ~/qwen3-asr-cache |
--save-srt | -srt | Generate and save a timestamped SRT subtitle file in addition to the .txt file. | Optional |
--silence | -s | Silence mode. Suppresses detailed progress and chunking information on the terminal. | Optional |
The full transcription result will be printed to the terminal (unless in --silence mode) and also saved in a .txt file in the same directory as the input file. For example, if you process my_video.mp4, the output will be saved to my_video.txt.
If you use the --save-srt flag, a corresponding my_video.srt subtitle file will also be created in the same directory.
Here are a few examples of how to use the tool.
Transcribe a video file using the default 4 threads. This command assumes you have set the DASHSCOPE_API_KEY environment variable.
qwen3-asr -i "/path/to/my/long_lecture.mp4"
Directly process an audio file from a URL.
qwen3-asr -i "https://somewebsite.com/audios/podcast_episode.mp3"
Use the --save-srt (or -srt) flag to generate a timestamped subtitle file alongside the plain text transcript. This is ideal for video captioning.
qwen3-asr -i "/path/to/my/documentary.mp4" -srt
This command will create documentary.txt and documentary.srt.
Transcribe a long audio file using 8 parallel threads and pass the API key directly via the command line.
qwen3-asr -i "/path/to/my/podcast_episode_01.wav" -j 8 -key "your_api_key_here"
If your audio contains specific jargon, use the -c flag. If you prefer shorter, more frequent subtitle segments, use -d to set a smaller chunk duration.
qwen3-asr -i "/path/to/my/tech_talk.mp4" -c "Qwen-ASR, DashScope, FFmpeg" -d 60 -srt
This command will try to split the audio into chunks around 60 seconds long, which can result in more granular subtitles.
Use the -s or --silence flag to prevent progress details from being printed to the terminal. The final transcript will still be saved to a file.
qwen3-asr -i "/path/to/my/meeting_recording.m4a" -s
While this project provides a full-featured Python toolkit, we also host implementations in other programming languages to demonstrate how the same core logic can be applied across different technology stacks. We warmly welcome the community to contribute examples in more languages!
We have provided a Java version as a standalone example located in the examples/java-example directory of this repository. This example showcases how to implement the key features of the toolkit—including VAD-based audio chunking, parallel API requests, and result aggregation—using Java. It serves as a great starting point for Java developers looking to integrate Qwen-ASR into their applications.
If you have implemented a similar toolkit in another language (e.g., Go, Rust, C#, JavaScript/Node.js), we would love to feature it! Please open a pull request to add your implementation to the examples directory. For more details on contributing, see the Contributing section below.
Contributions are welcome! If you have suggestions for improvements, please feel free to fork the repo, create a feature branch, and open a pull request. You can also open an issue with the "enhancement" tag.
This project is licensed under the MIT License - see the LICENSE file for details.
1,283 followers · starred Sep 2025
152 followers · starred Feb 2026
41 followers · starred Nov 2025
168 followers · starred Mar 2026
Official Python toolkit for the Qwen3-ASR API. Parallel high‑throughput calls, robust long‑audio transcription, multi‑sample‑rate support.
Python
1,013
9 commits
updated Feb 5, 2026
Qwen3-ASR is now open-sourced 🎉🎉🎉. Welcome to visit the GitHub and blog for more information. The open-source model offers functionality comparable to the API and supports free, fast local deployment. Qwen3-ASR open-source model includes two powerful all-in-one speech recognition models (0.6B/1.7B) that support language identification and ASR for 52 languages and dialects, as well as a novel non-autoregressive speech forced-alignment model that can align text–speech pairs in 11 languages. Its powerful performance is sufficient to deliver highly compelling speech-to-text transcription capabilities. Welcome to use it!
An advanced, high-performance Python command-line toolkit for using the Qwen-ASR API (formerly Qwen3-ASR-Flash). This implementation overcomes the API's 3-minute audio length limitation by intelligently splitting long audio/video files and processing them in parallel, enabling rapid transcription of hours-long content.
.srt subtitle files based on VAD segments, perfect for adding captions to video content..mp4, .mov, .mkv, .mp3, .wav, .m4a) thanks to its reliance on FFmpeg.This tool follows a robust pipeline to deliver fast and accurate transcriptions for long-form media:
.txt file. Optionally, a timestamped .srt subtitle file can also be generated.Follow these steps to set up and run the project on your local machine.
sudo apt update && sudo apt install ffmpegbrew install ffmpegYou can obtain one from the DashScope Console. If you are calling the API services of Tongyi Qwen for the first time, you can follow the tutorial on this website to create your own API Key.
For better security and convenience, it is highly recommended to set your API key as an environment variable named DASHSCOPE_API_KEY. The script will automatically use it, and you won't need to pass the --api-key argument in the command.
On Linux/macOS:
export DASHSCOPE_API_KEY="your_api_key_here"
(To make this permanent, add the line to your ~/.bashrc, ~/.zshrc, or ~/.profile file.)
On Windows (Command Prompt):
set DASHSCOPE_API_KEY="your_api_key_here"
On Windows (PowerShell):
$env:DASHSCOPE_API_KEY="your_api_key_here"
(For a permanent setting on Windows, search for "Edit the system environment variables" in the Start Menu and add DASHSCOPE_API_KEY to your user variables.)
We recommend installing the tool directly from PyPI for the simplest setup.
Simply run the following command in your terminal. This will install the package and make the qwen3-asr command available system-wide.
pip install qwen3-asr-toolkit
If you want to install the latest development version or contribute to the project, you can install from the source code.
Clone the repository:
git clone https://github.com/QwenLM/Qwen3-ASR-Toolkit.git
cd Qwen3-ASR-Toolkit
Install the package:
pip install .
Once installed, you can use the qwen3-asr command directly from your terminal. By default, the tool will print progress information.
qwen3-asr -i <input_file_or_url> [-key <api_key>] [-j <num_threads>] [-c <context>] [-d <duration>] [-t <tmp_dir>] [--save-srt] [-s]
| Argument | Short | Description | Required/Optional |
|---|---|---|---|
--input-file | -i | Path to the local media file or a remote URL (http/https) to transcribe. | Required |
--context | -c | Text context to guide the ASR model, improving recognition of specific terms. | Optional, Default: "" |
--dashscope-api-key | -key | Your DashScope API Key. | Optional (if DASHSCOPE_API_KEY is set) |
--num-threads | -j | The number of concurrent threads to use for API calls. | Optional, Default: 4 |
--vad-segment-threshold | -d | Target duration in seconds for each VAD-split audio chunk. | Optional, Default: 120 |
--tmp-dir | -t | Path to a directory for storing temporary chunk files. | Optional, Default: ~/qwen3-asr-cache |
--save-srt | -srt | Generate and save a timestamped SRT subtitle file in addition to the .txt file. | Optional |
--silence | -s | Silence mode. Suppresses detailed progress and chunking information on the terminal. | Optional |
The full transcription result will be printed to the terminal (unless in --silence mode) and also saved in a .txt file in the same directory as the input file. For example, if you process my_video.mp4, the output will be saved to my_video.txt.
If you use the --save-srt flag, a corresponding my_video.srt subtitle file will also be created in the same directory.
Here are a few examples of how to use the tool.
Transcribe a video file using the default 4 threads. This command assumes you have set the DASHSCOPE_API_KEY environment variable.
qwen3-asr -i "/path/to/my/long_lecture.mp4"
Directly process an audio file from a URL.
qwen3-asr -i "https://somewebsite.com/audios/podcast_episode.mp3"
Use the --save-srt (or -srt) flag to generate a timestamped subtitle file alongside the plain text transcript. This is ideal for video captioning.
qwen3-asr -i "/path/to/my/documentary.mp4" -srt
This command will create documentary.txt and documentary.srt.
Transcribe a long audio file using 8 parallel threads and pass the API key directly via the command line.
qwen3-asr -i "/path/to/my/podcast_episode_01.wav" -j 8 -key "your_api_key_here"
If your audio contains specific jargon, use the -c flag. If you prefer shorter, more frequent subtitle segments, use -d to set a smaller chunk duration.
qwen3-asr -i "/path/to/my/tech_talk.mp4" -c "Qwen-ASR, DashScope, FFmpeg" -d 60 -srt
This command will try to split the audio into chunks around 60 seconds long, which can result in more granular subtitles.
Use the -s or --silence flag to prevent progress details from being printed to the terminal. The final transcript will still be saved to a file.
qwen3-asr -i "/path/to/my/meeting_recording.m4a" -s
While this project provides a full-featured Python toolkit, we also host implementations in other programming languages to demonstrate how the same core logic can be applied across different technology stacks. We warmly welcome the community to contribute examples in more languages!
We have provided a Java version as a standalone example located in the examples/java-example directory of this repository. This example showcases how to implement the key features of the toolkit—including VAD-based audio chunking, parallel API requests, and result aggregation—using Java. It serves as a great starting point for Java developers looking to integrate Qwen-ASR into their applications.
If you have implemented a similar toolkit in another language (e.g., Go, Rust, C#, JavaScript/Node.js), we would love to feature it! Please open a pull request to add your implementation to the examples directory. For more details on contributing, see the Contributing section below.
Contributions are welcome! If you have suggestions for improvements, please feel free to fork the repo, create a feature branch, and open a pull request. You can also open an issue with the "enhancement" tag.
This project is licensed under the MIT License - see the LICENSE file for details.
1,283 followers · starred Sep 2025
152 followers · starred Feb 2026
41 followers · starred Nov 2025
168 followers · starred Mar 2026