Qwen Code is an open source command-line tool based on Google's Gemini CLI Developed specifically for Alibaba Cloud's Qwen3-Coder Model optimization. It helps developers accomplish code generation, editing, and repository management tasks from the command line. qwen-code supports Qwen3-Coder-480B-A35B model with 480 billion parameters and 35 billion parameters activated during inference, using the Mixed Expert Architecture (MoE). It supports 256K long contexts natively, and can be scaled up to 1M with YaRN technology, making it suitable for handling large code bases. The tool offers code completion, refactoring, Git commit analysis, and open source features that allow the community to expand and developers to contribute via GitHub.
Reviews:Qwen Code in-depth review: can it replace Claude as the new development workhorse?
Dependency modeling:Qwen3-Coder: open source code generation and intelligent programming assistant
Free API:Qwen3-Code Free User's Guide: Configuring the ModelScope API and Qwen CLI
Function List
- Supports the Qwen3-Coder model, providing code completion, repair and refactoring.
- Query and edit large code bases, breaking the traditional context length limitations and supporting 256K to 1M contexts.
- Automate Git commit analysis, grouped by function or team member to optimize team collaboration.
- Support for more than 40 programming languages, such as Python, JavaScript, Haskell, and more.
- Provides a command line interface to simplify code development and project management processes.
- Compatible with OpenAI API for seamlessly calling Qwen3-Coder models.
- Automate workflows such as handling pull requests (PRs) and complex variable base operations.
- Generate JSDoc comments, unit tests and API documentation to improve code quality.
Using Help
Installation process
qwen-code supports installation via npm or source code for Linux, macOS and Windows. Here are the steps:
Install via npm
- Make sure Node.js (version 20 or higher) is installed. Node.js can be installed with the following command:
curl -qL https://www.npmjs.com/install.sh | sh
- Install qwen-code globally:
npm install -g @qwen-code/qwen-code
- Verify the installation:
qwen --version
If the version number is displayed, the installation was successful.
Installation via source code
- Clone a GitHub repository:
git clone https://github.com/QwenLM/qwen-code.git
- Go to the project catalog:
cd qwen-code
- Install dependencies and deploy globally:
npm install npm install -g .
- Verify the installation:
qwen --version
Configuring API Keys
qwen-code needs Qwen3-Coder's API key to invoke model functions:
- Register for an Alibaba Cloud account and activate the Model Studio service.
- Generate an API key in the Alibaba Cloud console.
- Configure environment variables or create them in the project root directory.
.env
file, add the following:OPENAI_API_KEY=your_api_key_here OPENAI_BASE_URL=https://dashscope-intl.aliyuncs.com/compatible-mode/v1 OPENAI_MODEL=qwen3-coder-plus
- If using environment variables, run:
export OPENAI_API_KEY="your_api_key_here" export OPENAI_BASE_URL="https://dashscope-intl.aliyuncs.com/compatible-mode/v1" export OPENAI_MODEL="qwen3-coder-plus"
Usage
After the installation is complete, type in the terminal qwen
The tool can be launched. The following is a detailed procedure for the main functions:
code completion
qwen-code supports code completion based on Qwen3-Coder. For example, completing the Python quick sort algorithm:
- Go to the project catalog:
cd your-project
- importation
qwen
, then enter the code snippet:def quicksort(arr): if len(arr) <= 1: return arr pivot = arr[len(arr) // 2]
- qwen-code will return complementary code, for example:
left = [x for x in arr if x < pivot] middle = [x for x in arr if x == pivot] right = [x for x in arr if x > pivot] return quicksort(left) + middle + quicksort(right)
code refactoring
Optimize code readability and performance:
- Enter the command:
qwen > Refactor this function to improve readability and performance
- Paste in the code that needs refactoring and qwen-code will return the optimized version. For example, refactoring a lengthy loop into a more concise list derivation.
Git Commit Analysis
Analyze project submission records:
- Go to the project catalog:
cd your-project
- Input:
qwen > Analyze git commits from the last 7 days, grouped by feature and team member
- qwen-code returns submission details grouped by feature and team member for easy team review.
Codebase Search
Query the project architecture or core logic:
- Input:
qwen > Describe the main pieces of this system's architecture
- qwen-code will analyze the code base and return a description of the system architecture.
Automated workflows
Handle pull requests (PRs) or complex variable bases:
- Input:
qwen > Automate the process of handling pull requests
- qwen-code generates PR processing scripts or suggested procedures.
Documentation and Testing
Generate JSDoc comments or unit tests:
- Input:
qwen > Generate comprehensive JSDoc comments for this function
- Paste the function code, qwen-code will return the code with comments.
- Similarly, enter
qwen > Write unit tests for this component
Test code can be generated.
Image format conversion
Batch convert images in a catalog:
- Input:
qwen > Convert all images in this directory to PNG format
- qwen-code performs the conversion and returns the result.
caveat
- Ensure that your network is stable to access Qwen3-Coder's API.
- Qwen3-Coder-480B-A35B does not support thinking mode, no setup required.
enable_thinking=False
The - In case of installation problems, check the Node.js version or refer to the
troubleshooting guide
(Located indocs/troubleshooting.md
). - The open source community can be reached through the
CONTRIBUTING.md
Participate in development by submitting new features or fixing bugs.
application scenario
- Quick code debugging
Individual developers can use qwen-code to patch or fix code. For example, enter some Python code and qwen-code will automatically complete the logic, making it suitable for rapid prototyping. - Team code review
Development teams can quickly understand recent code changes through Git commit analysis, grouping them by function or member to improve review efficiency. - Large-scale project management
qwen-code supports 256K to 1M contexts, which is suitable for handling large code bases, query architectures or optimization modules to meet the needs of enterprise-level development. - multilingual development
Supporting more than 40 programming languages, developers can easily handle code tasks in Python, JavaScript, Haskell and other languages, reducing the difficulty of cross-language development. - Document Generation
qwen-code generates JSDoc comments, API documentation, or unit tests for development scenarios that require rapid generation of high-quality documentation.
QA
- Is qwen-code free?
qwen-code is an open source tool and is free to use. However, calling the Qwen3-Coder model requires an Alibaba Cloud API key, which may incur a fee, for specific pricing please visithttps://dashscope.aliyuncs.com
The - How do I fix an installation failure?
Ensure that Node.js version is 20 or higher, check your network connection, and re-run thenpm install
. If it still fails, refer todocs/troubleshooting.md
The - What programming languages does qwen-code support?
More than 40 languages are supported, including Python, JavaScript, Haskell, and more, with performance as described in the McEval or SWE-Bench Verified benchmarks. - Does it support offline use?
qwen-code relies on cloud APIs and cannot be fully offline. You need to deploy local Qwen3-Coder model to realize some offline functions, refer to the official documentation. - What are the advantages over Claude Code?
qwen-code is open source and free, and supports Qwen3-Coder's very long contexts and powerful agent capabilities, with performance close to that of Claude Sonnet 4, and adapted to the domestic network environment.