
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
@qwen-code/qwen-code
Advanced tools

AI-powered command-line workflow tool for developers
Installation β’ Quick Start β’ Features β’ Documentation β’ Contributing
Deutsch | franΓ§ais | ζ₯ζ¬θͺ | Π ΡΡΡΠΊΠΈΠΉ | δΈζ
Qwen Code is a powerful command-line AI workflow tool adapted from Gemini CLI, specifically optimized for Qwen3-Coder models. It enhances your development workflow with advanced code understanding, automated tasks, and intelligent assistance.
Get started with Qwen Code at no cost using any of these free options:
qwen and authenticate with your qwen.ai account/auth command to switch to Qwen OAuth if you have initialized with OpenAI compatible modeFor detailed setup instructions, see Authorization.
[!WARNING] Token Usage Notice: Qwen Code may issue multiple API calls per cycle, resulting in higher token usage (similar to Claude Code). We're actively optimizing API efficiency.
Ensure you have Node.js version 20 or higher installed.
curl -qL https://www.npmjs.com/install.sh | sh
npm install -g @qwen-code/qwen-code@latest
qwen --version
git clone https://github.com/QwenLM/qwen-code.git
cd qwen-code
npm install
npm install -g .
brew install qwen-code
# Start Qwen Code
qwen
# Example commands
> Explain this codebase structure
> Help me refactor this function
> Generate unit tests for this module
Control your token usage with configurable session limits to optimize costs and performance.
Create or edit .qwen/settings.json in your home directory:
{
"sessionTokenLimit": 32000
}
/compress - Compress conversation history to continue within token limits/clear - Clear all conversation history and start fresh/stats - Check current token usage and limitsπ Note: Session token limit applies to a single conversation, not cumulative API calls.
Qwen Code includes intelligent vision model auto-switching that detects images in your input and can automatically switch to vision-capable models for multimodal analysis. This feature is enabled by default - when you include images in your queries, you'll see a dialog asking how you'd like to handle the vision model switch.
If you don't want to see the interactive dialog each time, configure the default behavior in your .qwen/settings.json:
{
"experimental": {
"vlmSwitchMode": "once"
}
}
Available modes:
"once" - Switch to vision model for this query only, then revert"session" - Switch to vision model for the entire session"persist" - Continue with current model (no switching)You can also set the behavior via command line:
# Switch once per query
qwen --vlm-switch-mode once
# Switch for entire session
qwen --vlm-switch-mode session
# Never switch automatically
qwen --vlm-switch-mode persist
To completely disable vision model support, add to your .qwen/settings.json:
{
"experimental": {
"visionModelPreview": false
}
}
π‘ Tip: In YOLO mode (
--yolo), vision switching happens automatically without prompts when images are detected.
Choose your preferred authentication method based on your needs:
The easiest way to get started - completely free with generous quotas:
# Just run this command and follow the browser authentication
qwen
What happens:
Free Tier Benefits:
Use API keys for OpenAI or other compatible providers:
Configuration Methods:
Environment Variables
export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="your_api_endpoint"
export OPENAI_MODEL="your_model_choice"
Project .env File
Create a .env file in your project root:
OPENAI_API_KEY=your_api_key_here
OPENAI_BASE_URL=your_api_endpoint
OPENAI_MODEL=your_model_choice
API Provider Options
β οΈ Regional Notice:
- Mainland China: Use Alibaba Cloud Bailian or ModelScope
- International: Use Alibaba Cloud ModelStudio or OpenRouter
Option 1: Alibaba Cloud Bailian (Apply for API Key)
export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
export OPENAI_MODEL="qwen3-coder-plus"
Option 2: ModelScope (Free Tier) (Apply for API Key)
export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="https://api-inference.modelscope.cn/v1"
export OPENAI_MODEL="Qwen/Qwen3-Coder-480B-A35B-Instruct"
Option 1: Alibaba Cloud ModelStudio (Apply for API Key)
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"
Option 2: OpenRouter (Free Tier Available) (Apply for API Key)
export OPENAI_API_KEY="your_api_key_here"
export OPENAI_BASE_URL="https://openrouter.ai/api/v1"
export OPENAI_MODEL="qwen/qwen3-coder:free"
cd your-project/
qwen
# Architecture analysis
> Describe the main pieces of this system's architecture
> What are the key dependencies and how do they interact?
> Find all API endpoints and their authentication methods
# Refactoring
> Refactor this function to improve readability and performance
> Convert this class to use dependency injection
> Split this large module into smaller, focused components
# Code generation
> Create a REST API endpoint for user management
> Generate unit tests for the authentication module
> Add error handling to all database operations
# Git automation
> Analyze git commits from the last 7 days, grouped by feature
> Create a changelog from recent commits
> Find all TODO comments and create GitHub issues
# File operations
> Convert all images in this directory to PNG format
> Rename all test files to follow the *.test.ts pattern
> Find and remove all console.log statements
# Performance analysis
> Identify performance bottlenecks in this React component
> Find all N+1 query problems in the codebase
# Security audit
> Check for potential SQL injection vulnerabilities
> Find all hardcoded credentials or API keys
> What are the core business logic components?
> What security mechanisms are in place?
> How does the data flow through the system?
> What are the main design patterns used?
> Generate a dependency graph for this module
> What parts of this module can be optimized?
> Help me refactor this class to follow SOLID principles
> Add proper error handling and logging
> Convert callbacks to async/await pattern
> Implement caching for expensive operations
> Generate comprehensive JSDoc comments for all public APIs
> Write unit tests with edge cases for this component
> Create API documentation in OpenAPI format
> Add inline comments explaining complex algorithms
> Generate a README for this module
> Set up a new Express server with authentication
> Create a React component with TypeScript and tests
> Implement a rate limiter middleware
> Add database migrations for new schema
> Configure CI/CD pipeline for this project
/help - Display available commands/clear - Clear conversation history/compress - Compress history to save tokens/stats - Show current session information/exit or /quit - Exit Qwen CodeCtrl+C - Cancel current operationCtrl+D - Exit (on empty line)Up/Down - Navigate command history| Agent | Model | Accuracy |
|---|---|---|
| Qwen Code | Qwen3-Coder-480A35 | 37.5% |
| Qwen Code | Qwen3-Coder-30BA3B | 31.3% |
See CONTRIBUTING.md to learn how to contribute to the project.
For detailed authentication setup, see the authentication guide.
If you encounter issues, check the troubleshooting guide.
This project is based on Google Gemini CLI. We acknowledge and appreciate the excellent work of the Gemini CLI team. Our main contribution focuses on parser-level adaptations to better support Qwen-Coder models.
FAQs
Qwen Code - AI-powered coding assistant
The npm package @qwen-code/qwen-code receives a total of 19,397 weekly downloads. As such, @qwen-code/qwen-code popularity was classified as popular.
We found that @qwen-code/qwen-code demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rustβs crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.