Qwen Code is Alibaba's open-source terminal coding agent, and it is one of the fastest-growing developer tools of November 2026. It turns your command line into an AI pair programmer: you describe what you want in plain English, and it reads your code, edits files, runs commands and plans multi-step changes for you. This guide walks you through installing Qwen Code, connecting a model, and using it properly in 2026 — including the important change that ended its free tier in April.
What Is Qwen Code?
Qwen Code is a terminal-based AI coding agent built by the Qwen team at Alibaba. You run it as the qwen command inside a project folder, and it works directly on your codebase. It is released under the Apache 2.0 licence, which means the software itself is free and open source, and it started life as a fork of Google's open-source Gemini CLI before being developed on its own path.
Like Claude Code and Gemini CLI, Qwen Code is an agentic tool rather than a simple autocomplete. It can explore a repository, understand how the pieces fit together, make edits across several files, run your test suite, and report back on what changed. It also supports sub-agents, skills, hooks, MCP servers and a headless mode for scripts, so it fits into a serious development workflow rather than just a quick experiment.
Qwen Code works with Qwen's own models — including the Qwen3-Coder family — and it can also drive other providers through OpenAI-compatible and Anthropic-compatible endpoints, or a model you host yourself. That flexibility is one of the reasons it keeps trending: developers who already pay for one AI service can often point Qwen Code at it instead of buying another subscription.
Before you install it, one fact matters more than any other. The free Qwen OAuth sign-in that older tutorials describe is gone. On 13 April 2026 the Qwen team cut the free quota from 1,000 requests a day to 100, and on 15 April 2026 it discontinued Qwen OAuth free access entirely. Cached tokens may work briefly, but new requests are rejected. Today you need a paid plan, a third-party API key, or a local model. We cover every option in Step 3.
Step 1: Check Your System Requirements
Qwen Code runs on macOS, Linux and Windows, and the newest release on npm is version 0.27.0, published on 7 November 2026. Before installing, check two things.
First, if you plan to use the npm route, you need Node.js 22 or later. Older Node versions will not work with the current package, and the installer will fail or the tool will behave unpredictably. Run node --version in your terminal; if it reports anything below v22, update Node first through your usual method, such as nvm, Homebrew or the official installer.
Second, decide which model you will connect to before you install. Qwen Code is free software, but the model behind it costs money unless you run a local one. The most straightforward paid route is an Alibaba Cloud Model Studio plan: the Coding Plan subscription for individual developers, or the usage-billed Token Plan for teams. You can also use a standard Model Studio API key, a Qwen Plus or Pro subscription from chat.qwen.ai, or a third-party provider's key. Have your chosen key or subscription ready so the first launch goes smoothly.
Step 2: Install Qwen Code
There are four official ways to install Qwen Code. Pick the one that matches your platform and setup.
Option A — npm (any platform with Node.js 22 or later). This is the route most developers use, and it is the easiest to update later:
npm install -g @qwen-code/qwen-code@latest
Option B — Homebrew (macOS and Linux). If you already manage tools with Homebrew, a single command is all it takes:
brew install qwen-code
Option C — standalone installer (macOS and Linux). This route does not need Node.js at all. Run the official install script:
curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash
Option D — Windows PowerShell. On Windows, run the official PowerShell installer:
irm https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.ps1 | iex
After installing with the standalone script, restart your terminal so the new path entries take effect. Then verify the installation with qwen --version. If the command is found and prints a version number, you are ready for the next step.
Step 3: Connect a Model with /auth
Open a terminal, move into any project folder, and run qwen. On first launch, Qwen Code shows an authentication menu. You can also open it later at any time by typing /auth inside a session.
The menu now offers several ways to reach a model, and the right choice depends on how you want to pay:
- Alibaba Cloud Model Studio. The recommended route. Choose the Coding Plan subscription if you are an individual developer who wants a weekly quota, the Token Plan if you are on a team and prefer usage billing, or a standard Model Studio API key for pay-as-you-go access. During setup you will pick a region — Singapore is the usual choice — and paste your key.
- Qwen Account with Subscription. Sign in through the browser with a Qwen Plus or Pro subscription from chat.qwen.ai.
- Third-party provider. Connect any OpenAI-compatible or Anthropic-compatible API key, which lets you drive another vendor's model through Qwen Code.
- Local model. Point Qwen Code at a model running on your own hardware. This is the only route with no per-token cost, and it is the option to choose if you want to keep your code entirely on your own machine.
Do not waste time looking for the old Qwen OAuth free sign-in. It is no longer offered in the /auth menu, and guides that still describe it are out of date. If a tutorial promises free daily requests through a qwen.ai account, it predates the April 2026 change.
Once authentication is set, use /model inside a session to switch between the models you have configured. Your settings live in ~/.qwen/settings.json, and project-specific settings can go in .qwen/settings.json inside a repository.
Step 4: Start Your First Session
Move into a real project folder and run qwen. The agent starts in interactive mode, reads the folder structure, and waits for your instruction. The welcome screen shows the active model and the approval mode, so you can confirm both before you type anything.
Start small. Ask Qwen Code to explain something about the project first, for example: "Explain how authentication works in this codebase and list the files involved." This does two useful things: it shows you how well the agent understands your code, and it lets the agent build context about the project before you ask it to change anything.
Pay attention to how it responds. A good coding agent reads the relevant files rather than guessing, and Qwen Code will usually quote the files it inspected. If it asks a clarifying question, answer it — a short clarification now prevents a wrong edit later.
Step 5: Give Your First Coding Task
When you are ready to make changes, be specific. Vague prompts produce vague results, and that is true of every coding agent, not just Qwen Code. Compare these two prompts:
- Vague: "Fix the login page."
- Specific: "Add a 'forgot password' link to the login form that sends a reset email. Use the existing email helper in utils/mail.js, add a test for the new route, and run the test suite when you are done."
The specific prompt tells the agent what to build, which helper to reuse, what verification to perform, and when the task is finished. Qwen Code will then plan the change, edit the files, and show you a diff of everything it touched before moving on.
Good first tasks include adding a small feature, writing tests for an untested function, refactoring a single module, or fixing a failing test. Leave large refactors and cross-cutting changes until you trust the tool — and until you have a clean git state, so you can review or revert its work with confidence.
Always review the diff. Qwen Code asks for approval according to the approval mode you pick, but the final responsibility is yours. Read what changed, run the tests yourself, and only then commit.
Step 6: Set Approval Modes and Stay in Control
Qwen Code lets you control how much it does without asking. Approval modes decide whether the agent edits files and runs commands freely, asks before each action, or only reads. The default is a sensible middle ground, but you should know where the setting is and adjust it to your comfort level.
For a new project or an unfamiliar codebase, keep approvals strict: let the agent propose edits and run commands only after you confirm them. As you build trust, you can loosen the mode for routine tasks such as running the test suite or formatting code. For anything that touches production data, deployment scripts or credentials, keep approvals on and read every command before it runs.
This matters because Qwen Code is an agent with real power over your files and your shell. It can delete files, install packages and execute commands. Used carefully, that power is the whole point. Used carelessly, it can do real damage. Treat the approval mode as a safety setting, not a speed bump.
Step 7: Add Project Context with QWEN.md
One of the most useful features in Qwen Code is the QWEN.md file. Place one in the root of your project, and Qwen Code reads it at the start of every session. Use it to record the facts the agent cannot guess: the project's architecture, the commands to build and test it, the coding conventions your team follows, and anything it should never do.
A good QWEN.md is short and concrete. Include the build and test commands, the package manager, the style rules that matter, and a line such as "never edit files in the migrations folder without asking first". This is the same idea as the instruction files used by other coding agents, and it is the single easiest way to improve the quality of Qwen Code's output on your project.
If your project already has a similar file for another agent, such as a CLAUDE.md or an AGENTS.md, you can keep both — Qwen Code reads its own file, and the others keep working with their tools.
Step 8: Connect Tools with MCP Servers
Qwen Code supports the Model Context Protocol (MCP), which lets the agent reach tools beyond your local files: a database, a design tool, a ticketing system, or your team's documentation. MCP servers are configured in the mcpServers section of your settings.json file — user scope by default, or project scope in .qwen/settings.json — and the qwen mcp add command writes the entries for you.
Start with one genuinely useful server rather than five speculative ones. A documentation or search server that answers questions about your stack is usually the most valuable, because it stops the agent from guessing about APIs it does not know. Add more servers only when a real task needs them. Every MCP server is another surface the agent can reach, so keep the list short and trusted.
Step 9: Use Headless Mode for Scripts and Automation
Not every job needs an interactive chat. Qwen Code's headless mode runs a single prompt from the command line and exits:
qwen -p "Summarise the changes in the last five commits and list any that touch the payment code."
This makes Qwen Code scriptable. You can use headless mode in CI pipelines, in git hooks, or in a nightly script that reviews pull requests, generates changelogs, or checks that documentation matches the code. Combined with the approval settings, headless mode turns the agent into a command-line utility rather than a chat window.
There is also a daemon mode. Running qwen serve --open serves a web interface on 127.0.0.1:4170, with no authentication token by default, so only use it on a machine you trust and never expose that port to a network. Qwen Code also ships a desktop app and editor plugins for VS Code, Zed and JetBrains, if you prefer a graphical interface to the terminal.
Qwen Code vs Claude Code vs Gemini CLI
Qwen Code sits in the same category as Claude Code and Gemini CLI, and the choice between them comes down to models, pricing and ecosystem rather than raw capability. All three read code, edit files, run commands and plan multi-step changes. Qwen Code's advantages are its Apache 2.0 licence, its ability to drive Qwen, OpenAI-compatible, Anthropic-compatible and local models from one tool, and the Coding Plan and Token Plan pricing through Alibaba Cloud Model Studio, which can be cheaper than a Claude subscription for heavy use.
Claude Code's strength is the quality of Anthropic's models on long, complex tasks, while Gemini CLI's strength is its deep integration with Google's ecosystem. If you already pay for Qwen models or want a fully open-source agent you can inspect and modify, Qwen Code is the natural choice. Many developers now run two agents side by side — Qwen Code for routine work and another agent for the hardest tasks — and compare them on their own code before settling.
Troubleshooting Common Qwen Code Problems
"The agent stopped working after April 2026." You were on the discontinued Qwen OAuth free tier. Run /auth and connect a Model Studio plan, a subscription, a third-party key or a local model.
"npm install fails." Check your Node.js version first — it must be 22 or later. If Node is current, try the Homebrew route or the standalone installer instead.
"The agent edits files I did not expect it to touch." Tighten the approval mode, add the protected paths to your QWEN.md, and make sure you start from a clean git state so you can review and revert.
"It keeps guessing instead of reading the docs." Connect an MCP server for your documentation, or paste the relevant docs link into the prompt. The agent can only use the context you give it.
"Costs are higher than expected." Check which model is active with /model, and consider the Coding Plan subscription instead of pay-per-token billing if your usage is steady. Headless mode with a smaller model is a cheaper option for automated jobs.
Is Qwen Code Worth Using in 2026?
Yes, with one honest caveat: it is no longer a free ride. The end of the Qwen OAuth free tier in April 2026 removed the easiest way to try it, and anyone who followed an old tutorial will hit that wall immediately. But the software itself is free, open source, and genuinely capable, and the paid routes through Model Studio are competitive — especially if you already use Qwen models or want a coding agent that can also drive other providers and local models.
Qwen Code is at its best as a daily driver for developers who live in the terminal: fast to install, easy to point at a project, and flexible about which model does the work. Install it, connect a plan or a key, add a QWEN.md to your main project, and give it a small, well-specified task. That first session will tell you more than any review — including this one — about whether it earns a place in your workflow.
#QwenCode #AICoding #AlibabaQwen #CodingAgents #Qwen #AICodingTools #TerminalAI #NextGenAIVibe
Comments (0)