Qwen Code: Open-Source AI Coding Agent for CLI, IDE & Desktop

An open-source coding agent with multi-provider models, persistent project context, Skills, Subagents, MCP, and headless automation.

Qwen Code is an open-source AI coding agent that works inside your repository. Give it a bug, feature request, or refactoring task, and it can trace the relevant code, edit files, run project commands, and inspect the results.

For larger changes, Qwen Code can examine several modules, prepare a plan, and work through edits and tests in one session. Store repository rules in QWEN.md, and use approval modes to decide which edits and commands require permission.

Qwen Code runs in the terminal, supported IDEs, and a desktop app. It works with Qwen subscriptions, third-party model providers, and local models served through Ollama or vLLM. Skills define repeatable tasks, Subagents handle delegated work, and MCP connects external tools.

Key Features

  • Inspect a repository, trace related code, make multi-file edits, and run project commands.
  • Build a read-only plan and control which file changes or shell commands need approval.
  • Use QWEN.md and Auto-Memory to retain coding conventions and project decisions.
  • Create reusable Skills, install extensions, and delegate focused work to Subagents.
  • Connect GitHub-related tools, databases, APIs, and internal services through MCP.
  • Connect Qwen-hosted and third-party models, or use local models through Ollama or vLLM.
  • Work in a terminal, IDE, or desktop app, or run coding tasks in scripts and CI.
  • Find definitions, references, and diagnostics with experimental LSP support.
  • Run tasks in Git worktrees and restore earlier edits using checkpoints.
  • Run scheduled checks, pull-request follow-up, and optional Chrome Browser Use tasks.

What Can Qwen Code Do?

  • Trace a failing feature through components, API handlers, and tests to locate the cause.
  • Implement a feature across application modules and tests, then run project checks.
  • Refactor related files, imports, and interfaces with a planned set of changes.
  • Map an unfamiliar repository’s entry points, dependencies, and build scripts.
  • Review pull requests for regressions, edge cases, and inconsistent code changes.
  • Automate repository checks, summarize CI failures, and follow up on pull requests.

How to Install Qwen Code

Install the stable CLI with one of the commands below, or download the 1.0 Preview package for your operating system.

Linux and macOS

curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash

Windows

irm https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.ps1 | iex

NPM

The npm package requires Node.js 22 or later.

npm install -g @qwen-code/qwen-code@latest

Homebrew

brew install qwen-code

Check the installed version:

qwen --version

Qwen Code 1.0 Preview Downloads

Download the macOS, Linux, or Windows package from the 1.0 Preview release under Assets. Install the package, launch Qwen Code, and sign in with a Qwen or Qoder account or configure a model provider. The 1.0 Preview integrates Qoder agent features and supports resuming earlier sessions.

How to Update Qwen Code

Update the stable CLI with:

qwen update

For npm installations:

npm install -g @qwen-code/qwen-code@latest

Model Providers and Authentication

Run qwen and choose a model provider from the first-run menu. To change providers later, enter /auth in an existing session.

Authentication optionWhat you can connect
Qwen Account with SubscriptionSign in to Qwen Code with a Qwen Plus or Pro subscription through Qwen OAuth
QwenCloudQwenCloud Token Plan or Standard API Key, with China and International regions
Alibaba ModelStudioCoding Plan, Token Plan, or a standard ModelStudio API key
Third-party ProvidersBuilt-in choices including DeepSeek, Grok, MiniMax, Z.AI, Kimi, Idealab, ModelScope, OpenRouter, and Requesty
Custom ProviderCompatible OpenAI, Anthropic, Gemini, or local model endpoints

Use Alibaba Cloud Coding Plan with Qwen Code

With an Alibaba Cloud ModelStudio Coding Plan subscription, Qwen Code can use Qwen, GLM, Kimi, and MiniMax coding models. Set up the subscription in the authentication menu:

  • Get a Coding Plan API key from Alibaba Cloud ModelStudio.
  • Run qwen in your repository. Enter /auth, select Alibaba ModelStudio, and choose Coding Plan.
  • Select your account region and enter the Coding Plan API key.
  • Enter /model to select one of the Coding Plan models.

Use Qwen4-Max in Qwen Code

Qwen4-Max handles coding, complex reasoning, and image or video understanding. Access it through QwenCloud, Alibaba ModelStudio, or a Qwen subscription with Qwen4-Max access. In Qwen Code, select qwen4-max with /model and set reasoning effort to low, high, or xhigh with /effort.

To connect a QwenCloud Token Plan:

  • Get a Token Plan API key from QwenCloud.
  • Enter /auth, select QwenCloud → Token Plan, choose your account region, and enter the key.
  • Run /model and select qwen4-max.

Getting Started with a Project

From the root of a repository, launch Qwen Code. Complete the model sign-in on your first run.

cd your-project/
qwen

Example: Trace a Bug, Apply a Fix, and Run Tests

Suppose a React form sends two API requests for one submission. Ask Qwen Code to inspect the component, event handlers, and API client, then identify the cause before editing.

Find why submitting the form triggers two requests. Trace the event handlers and API call path, identify the root cause, and propose the smallest change. Do not edit files yet.

Discuss the proposed fix in /plan, then use /approval-mode to switch to an editing mode and assign the implementation:

Implement the agreed fix. Update the relevant tests, run the test and lint scripts defined in package.json, and summarize the changed files and any failing checks.

Code Navigation with LSP

Qwen Code includes experimental Language Server Protocol (LSP) support for navigating definitions, finding references, inspecting symbols, reading diagnostics, and requesting code actions.

For TypeScript and JavaScript projects, install the language server with npm install -g typescript-language-server typescript and add the following configuration to .lsp.json at the project root:

{
  "typescript": {
    "command": "typescript-language-server",
    "args": ["--stdio"],
    "extensionToLanguage": {
      ".ts": "typescript",
      ".tsx": "typescriptreact",
      ".js": "javascript",
      ".jsx": "javascriptreact"
    }
  }
}

Enable LSP for the session:

qwen --experimental-lsp

In desktop or IDE sessions, set tools.lspEnabled to true in ~/.qwen/settings.json to enable LSP.

Project Context and Memory

QWEN.md

Put build commands, testing instructions, coding conventions, and architecture decisions in QWEN.md. Create it yourself or have Qwen Code generate a starter file from the repository:

/init

For example, this QWEN.md sets rules for API changes, testing, and reporting:

# Project instructions
- Read package.json before running commands.
- Keep public component props and exported APIs stable unless the task requires a change.
- Add or update tests for behavior changes when the repository has tests.
- Report the changed files and the checks you ran.

Auto-Memory

Auto-Memory stores preferences and project decisions learned during coding sessions. Use /memory to inspect saved context or /remember <text> to save a note.

Plan and Approval Modes

ModeFile editingShell commandsUseful for
PlanRead-onlyNot executedExploration, code review, and implementation planning
Ask PermissionsApproval requiredApproval requiredUnfamiliar repositories and closely supervised work
Auto-EditAutomatically approvedApproval requiredRefactoring and normal coding work
AutoPolicy evaluationPolicy evaluationLonger autonomous sessions with risk checks
YOLOAutomatically approvedAutomatically approvedTrusted automation in controlled environments

Use /plan for read-only planning or /approval-mode to choose another permission level. During an interactive session, you can cycle through modes with Shift+Tab, or Tab on Windows.

Agent Skills and Extensions

Agent Skills package repeatable coding tasks into folders containing SKILL.md, scripts, and supporting files. Qwen Code loads a matching Skill as part of the task.

Put project Skills in .qwen/skills/ and commit them with your repository. Use /skills to inspect available Skills or /<skill-name> to invoke one directly.

Read More: Agent Skills Specification: SKILL.md Format, Fields, and Directory Structure

Extensions

Qwen Code Extensions bundle prompts, MCP servers, Subagents, Skills, and custom commands into one installable package. You can also install packages from Gemini CLI Extensions, Claude Code Marketplace, Qoder, and the Agent Plugins v1 format.

Hooks

Hooks can run commands, HTTP requests, functions, or prompts when a tool is called, a session event occurs, or a prompt is submitted. Enter /hooks to inspect the hooks loaded for your session.

MCP and External Tools

Connect MCP servers to use repository tools, databases, APIs, and internal services from Qwen Code. Enter /mcp to inspect configured servers. User-level MCP settings apply across repositories, and project-level settings belong in .qwen/settings.json.

For example, to register an HTTP MCP server:

qwen mcp add --transport http my-server http://localhost:3000/mcp

Subagents and Agent Workflows

Subagents take on repository exploration, testing, or code review during a larger task. Each has its own instructions, context, and tools.

Named Subagents start with their own context. Fork Subagents inherit context from the main conversation.

Use Dynamic Workflows to run exploration, implementation, and review through a repeatable sequence of Subagents. Save the workflow for future repository tasks.

To delegate a task to an installed agent such as Claude Code or Codex, mention it with @ in the Qwen Code conversation. Its response appears in the conversation.

Headless Mode and CI Automation

Headless mode runs Qwen Code from scripts and CI jobs. Pass the task with -p or --prompt and use an API-key-based provider for unattended runs.

qwen -p "Review this change and list potential regressions."

Structured Output

Request machine-readable review output with --output-format json:

qwen -p "Review this change" --output-format json

Scheduled Checks and Pull Request Follow-Up

In an interactive session, /loop can repeat a prompt on an interval. For example, this checks a deployment every five minutes and reports the result:

/loop 5m check if the deployment finished and report its status

For pull request maintenance, /autofix-pr 123 follows CI failures and review feedback, then prepares fixes in Git worktrees. This command uses your authenticated GitHub CLI account.

To send scheduled-task results and notifications to another service, add a Generic Webhook channel in Web Shell. It sends JSON to an HTTPS endpoint and accepts an optional Bearer token.

Sandboxing and Checkpoints

Sandbox

Run Qwen Code in a sandbox with -s to isolate command execution and file changes:

qwen -s

Checkpointing

Start a session with --checkpointing to save project snapshots before edits. Inside Qwen Code, use /restore to return to a saved state.

qwen --checkpointing

Git Worktrees

Run a coding task in its own Git worktree to work on another branch while leaving the main checkout available:

qwen --worktree=my-feature

Each new Web Shell session in a trusted Git workspace opens a Git worktree by default. Concurrent tasks can edit their own checkouts of the repository. Choose Create branch here to save a session’s changes as a branch or Hand off to local to bring them into your original checkout. To start new sessions on the current branch, set worktree.defaultForNewSessions to false.

Ways to Run Qwen Code

ModeUseful for
Interactive CLIRepository work in the terminal
IDEWorking from VS Code, JetBrains, or Zed
DesktopUsing Qwen Code in a graphical desktop app
HeadlessScripts, CI, and other automated tasks
Web UIOpening Qwen Code in the browser with qwen serve --open

The Web UI displays changed files and background task progress during a session. In local daemon mode, the Artifact Library lists files generated in the workspace.

Browser Use in Chrome

Qwen Code Browser Use connects to an existing Chrome session to inspect pages and interact with a development dashboard or web app. On macOS or Linux, install the Chrome extension in the profile you want to use.

Configuration

ScopeLocation or methodTypical use
User~/.qwen/settings.jsonModel providers, personal preferences, MCP servers, Skills, and defaults
Project.qwen/settings.jsonRepository permissions, MCP configuration, Skills, agents, and project behavior
SessionEnvironment variablesCredentials, CI values, containers, and temporary configuration
InvocationCLI flagsOne command or one Qwen Code session

Related Resources

FAQs

What happened to Qwen4-Max Preview?

The QwenCloud Token Plan preview period for qwen4-max-preview ends November 25, 2026 (UTC+8), when that preview model is retired. Select the released qwen4-max model for ongoing use.

Does Qwen Code require an API key?

A Qwen Plus or Pro subscription works through account sign-in. QwenCloud, Alibaba ModelStudio, and third-party providers use API keys. The 1.0 Preview also accepts Qoder sign-in.

Can Qwen Code run with local models?

Yes. Configure Ollama or vLLM as a custom model provider.

Is Qwen Code free?

Qwen Code itself is free and open-source. Hosted model subscriptions and API usage can incur charges.

Last Updated: Nov 22, 2026

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest & top AI tools sent directly to your email.

Subscribe now to explore the latest & top AI tools and resources, all in one convenient newsletter. No spam, we promise!