AI agents
Qwen Code: What It Is, How to Install It and Run It on Local Models
Qwen Code explained for enterprises: the open-source CLI, install, pricing after the free tier ended, local models via vLLM or Ollama, data flows and security.
In short
Qwen Code is an open-source, Apache 2.0 coding agent from the Qwen team that runs in a terminal, editor, desktop app or browser. It works with Qwen subscriptions, Alibaba Cloud and third-party API keys, or any OpenAI-compatible endpoint, including a self-hosted vLLM or Ollama server. The free Qwen OAuth allowance ended on 15 April 2026.
Key takeaways
- Qwen Code is an Apache 2.0 terminal coding agent in the QwenLM organisation on GitHub. It started from Google Gemini CLI v0.8.2 and has been developed independently since Qwen Code v0.1.
- As of 1 December 2026 the latest stable CLI release is v0.29.1 (29 November 2026). Seven stable releases shipped between 17 and 29 November, with nightly builds and a 1.0 preview alongside, so pin and test versions.
- The free Qwen OAuth allowance was discontinued on 15 April 2026. Access now needs a Qwen Plus or Pro subscription, a QwenCloud or Alibaba Cloud Model Studio key, a third-party provider key, or your own endpoint.
- A self-hosted model is a `modelProviders` entry with a local `baseUrl`. The server must expose tool calling, and usage statistics, which are on by default and go to an Alibaba Cloud endpoint, need switching off separately.
- Sessions in trusted folders start in Auto Mode, where a model-based classifier approves tool calls, and the sandbox is off by default. Set the approval mode, sandbox and MCP allow-list centrally in the system settings file.
Qwen Code is one of the few coding agents that is open source and documents self-hosted models as a supported route. That makes it interesting for European teams that want an agent in the terminal without sending source code to a hosted model. This post explains what Qwen Code is, how access and pricing work as of 1 December 2026, how to point it at your own model, where data goes on each route and which controls to set before developers use it.
What is Qwen Code?
Qwen Code is an open-source AI coding agent from the Qwen team, published in the QwenLM organisation on GitHub under the Apache 2.0 licence. It reads a repository, proposes and makes edits, and runs shell commands on the developer’s machine.
Its acknowledgements state that the project was originally based on Google Gemini CLI v0.8.2, and that from Qwen Code v0.1 the team stopped syncing with the upstream project and developed it independently. The README now describes it as a multi-protocol agent that speaks the OpenAI, Anthropic, Gemini and Qwen APIs.
The project moves quickly. As of 1 December 2026, the latest stable CLI release is v0.29.1, published on 29 November 2026. The releases list shows seven stable CLI versions between 17 and 29 November, nightly builds, and a separate 1.0 preview line (v1.0.0-preview.2, 25 November) that the README says combines Qwen Code with the agent harness of Qoder. For a company, that pace is a reason to pin a version, test it and upgrade on your own schedule.
How do you install Qwen Code, and what can the CLI do?
You install it with a standalone script, npm or Homebrew, then run qwen in a project folder. The npm package is @qwen-code/qwen-code and needs Node.js 22 or later; Homebrew uses brew install qwen-code. The script route pipes a remote file into a shell, so managed environments usually prefer a pinned package from an internal registry.
The features below are the ones the README and documentation state as of 1 December 2026:
- Interfaces. Terminal, a desktop app, an experimental web interface (
qwen serve), and editor integrations for VS Code, Zed and JetBrains. The VS Code extension is marked Beta and needs VS Code 1.96.0 or later. - Headless mode and SDKs.
qwen -p "..."runs a prompt in scripts and CI, and there are TypeScript, Python and Java SDKs. - Approval modes. Five modes: Plan (read-only), Ask Permissions, Auto-Edit, Auto and YOLO.
- Sandboxing. macOS Seatbelt, Docker or Podman containers, and a Linux tool sandbox based on Bubblewrap.
- MCP. It connects to Model Context Protocol (MCP) servers, which add external tools and data sources.
- Subagents, skills and hooks. Subagents take focused subtasks with their own context; skills package reusable procedures; hooks run your scripts before and after tool calls.
- Memory files.
QWEN.mdandAGENTS.mdload at the start of each session, and an auto-memory feature lets the agent write notes it recalls later.
Several items are labelled experimental or opt-in in the README, including agent teams, the web interface and language-server support. Treat those as unstable.
Is Qwen Code free, and how does model access work?
The tool is free; model access is not. The project’s terms page states that the legacy free Qwen OAuth allowance was discontinued on 15 April 2026, so articles that describe a free daily quota are out of date.
As of 1 December 2026, the /auth menu documents five routes:
- Qwen Account with Subscription. Sign in through Qwen OAuth with an active Plus or Pro subscription from chat.qwen.ai. The documentation says to use an API key instead for CI and other unattended environments.
- QwenCloud. A pay-as-you-go Standard API Key or a Token Plan with a monthly credit quota, on a China platform or an International platform with separate endpoints.
- Alibaba ModelStudio. A Coding Plan for individual developers, a Token Plan for teams and companies, or an existing Model Studio key. The documented plan endpoints are China (Beijing) and an international one, which the Token Plan section identifies as Singapore.
- Third-party providers. Built-in entries for providers such as DeepSeek, OpenRouter and ModelScope, each with its own key.
- Custom Provider. A local server, proxy or other endpoint that speaks an OpenAI-, Anthropic- or Gemini-compatible API.
We have not listed prices, because they sit in the Qwen and Alibaba Cloud consoles and change. Check them on the day you decide.
How do you run Qwen Code with a local model through vLLM, Ollama or LM Studio?
You add the local server as an OpenAI-compatible provider in settings.json and select it with /model. The documentation names vLLM, Ollama and LM Studio and treats any other OpenAI-compatible server the same way.
The settings the documentation gives are:
- A
modelProviders.openaientry with the modelid, a displayname, anenvKeyand abaseUrl. Its examples usehttp://localhost:11434/v1for Ollama,http://localhost:8000/v1for vLLM andhttp://localhost:1234/v1for LM Studio. - An environment variable named by
envKey. Servers without authentication accept a placeholder, for exampleOLLAMA_API_KEY="ollama". security.auth.selectedTypeset toopenaiandmodel.nameset to the model id, so the CLI starts without the interactive menu.generationConfig.contextWindowSizeset to the server’s real limit, plus longertimeoutandstreamIdleTimeoutMsvalues for slow or queued servers.
Two details cause most failures. First, Qwen Code sends tool definitions on every request, so the server must have tool calling enabled. On vLLM the documentation lists --enable-auto-tool-choice, a --tool-call-parser for the model and, for thinking models, --reasoning-parser qwen3; it warns that parser names change between releases. Second, Qwen Code infers the context window and thinking control from the model id. If you serve a Qwen model under a name that does not start with qwen, the context window falls back to 200K and you must declare both values on the model entry.
Which model? Qwen’s Qwen3-Coder-Next model card describes an open-weight model built for coding agents and local development: Apache 2.0, 80 billion parameters with 3 billion active per token, a native context of 262,144 tokens, no thinking mode, and a vLLM command that uses the qwen3_coder tool-call parser. The card names Qwen Code among the tools it targets. The Qwen Code documentation’s custom-model-name example for vLLM uses Qwen3.6 35B A3B, with the qwen3_xml tool-call parser. For the newer general models, our post on self-hosting Qwen 3.8 covers licences, VRAM and serving flags, and our comparison of vLLM, Ollama, llama.cpp and SGLang explains which server suits a shared team endpoint. Small models on a laptop are fine for a trial; an agent that edits real code needs a model you have tested on your own tasks.
Where does your code go with each access route?
Prompts, file contents and command output go to the model provider you configure, and to no other model service. The project’s terms page states that Qwen Code itself does not use prompts, code or responses for training, and that the provider’s terms govern everything else.
- Qwen subscription (Qwen OAuth). Qwen’s Privacy Policy, effective 7 September 2026, names NTH POWER GLOBAL TECH SINGAPORE PTE. LTD. as operator and data controller. It says input is sent to Alibaba Cloud (Singapore) Private Limited as processor and processed in Singapore, and that this provider deletes input after generation. It also says Qwen may use de-identified user content and feedback to train and improve models, and does not train directly on raw input. The policy states its scope as the Qwen app, website and desktop client.
- Alibaba Cloud Model Studio. The regions page, updated 30 November 2026, lists six regions: China (Beijing), Singapore, US (Virginia), Germany (Frankfurt), Japan (Tokyo) and China (Hong Kong). Data is stored in the selected region, and a Frankfurt workspace can choose a Global or EU inference scope. The plan endpoints in Qwen Code’s own documentation are Beijing and Singapore, so a Frankfurt workspace would be configured as a custom endpoint. Check that route, and model availability there, before relying on it.
- Third-party key. The chosen provider’s terms apply.
- Self-hosted endpoint. Prompts and code stay on your infrastructure. Web search tools, MCP servers and usage statistics are separate flows that you still have to control.
What does GDPR mean for European teams using Qwen Code?
Source code is not personal data by default, but repositories, logs and tickets often contain names, email addresses and customer records, so GDPR usually applies to what an agent reads. This section is not legal advice.
Three points follow from the text of the regulation and the policies above:
- Processor terms. Article 28 requires a controller to use only processors that provide sufficient guarantees. The Qwen consumer policy names its operator as controller, which is a different relationship. A company route normally runs through a cloud contract with processor terms, so ask for them.
- Transfers. Under Article 44, personal data may leave the EU only under the conditions of Chapter V. Article 46 allows transfers with appropriate safeguards where there is no adequacy decision. Qwen’s policy says it relies on adequacy decisions and standard contractual clauses, depending on the country. Your own transfer assessment still has to cover Singapore or China if you use those endpoints.
- EU region. A Frankfurt workspace with EU inference scope narrows the transfer question. It does not remove the need to assess the provider, its group and access from outside the EU.
Self-hosting takes the model provider out of the data path. Access control, retention and purpose limitation still apply to your own logs and session records.
What telemetry does Qwen Code send, and how do you turn it off?
Usage statistics are enabled by default for all authentication methods, according to the project’s terms page, and are sent to an Alibaba Cloud collection endpoint. Assume that includes a self-hosted model until you switch them off. The settings reference says they cover tool names and status, the model used, request duration and configuration such as the approval mode, and exclude prompts, responses, file contents and tool arguments.
To opt out, set privacy.usageStatisticsEnabled to false or set QWEN_USAGE_STATISTICS_ENABLED=false; the environment variable wins. The documentation adds a caveat: a trusted workspace’s .qwen/settings.json can switch the setting back on. Disabling statistics also stops a background refresh of a model catalogue from models.dev, which has its own switch, model.catalogRefresh.
A second, separate system exports OpenTelemetry data to an endpoint you configure. Its settings can include prompt and response text, so review telemetry.logPrompts and the sensitive span attribute setting before pointing it at a shared collector.
How do you secure Qwen Code in an enterprise?
Treat it as software that runs commands with the developer’s privileges, and set its limits centrally. The defaults favour convenience: sessions in trusted folders start in Auto Mode, and the sandbox is disabled unless you enable it.
- Approval mode. In Auto Mode a model-based classifier decides which shell commands and other tool calls run without asking. In untrusted folders the default is Ask Permissions. Choose the default deliberately with
tools.approvalMode, and keep YOLO for disposable environments; the documentation warns that YOLO does not enable a sandbox by itself. - Sandbox. On Linux, the Bubblewrap tool sandbox can restrict writes to the workspace and close command networking, and workspace settings cannot change it. The documentation is frank about limits: reads remain broad, and MCP is among the features disabled in that mode. Containers and macOS Seatbelt wrap the whole CLI.
- System settings. A system settings file (for example
/etc/qwen-code/settings.json) overrides user and project settings. Use it for the approval mode, the sandbox policy,security.auth.enforcedTypeand the provider list. - MCP allow-list.
mcp.allowedandmcp.excludedrestrict which MCP servers the agent can use. Our guide to MCP security explains why each server is a supply-chain decision. - Credentials and network. Give the agent’s shell short-lived, least-privilege credentials, keep production secrets out of reach, and restrict outbound traffic to your model endpoint and approved registries. If you use daemon mode, note that it listens on loopback without authentication by default.
- Review. Keep human code review and CI checks for every change an agent produces.
Policy, logging and EU AI Act questions that apply to every coding agent are covered in our guide to AI coding agents in the enterprise.
How does Qwen Code compare with Claude Code, Gemini CLI, Codex CLI and OpenCode?
The main verified differences are the licence and the model access each project documents. The table uses only what each public repository stated on 1 December 2026; it does not rank the tools.
| Tool | Repository | Licence | Model access stated in the README |
|---|---|---|---|
| Qwen Code | QwenLM/qwen-code | Apache 2.0 | Qwen subscription, QwenCloud or Model Studio keys, third-party providers, or any compatible endpoint including local models |
| Claude Code | anthropics/claude-code | Proprietary: all rights reserved, under Anthropic’s Commercial Terms | README refers to the official documentation; see our guide to Claude Code with local models |
| Gemini CLI | google-gemini/gemini-cli | Apache 2.0 | Gemini Code Assist Standard or Enterprise and Code Assist for GitHub, plus legacy paid API or Vertex AI keys; free individual access moved to Antigravity CLI on 18 June 2026 |
| Codex CLI | openai/codex | Apache 2.0 | Sign-in with a ChatGPT plan, or an API key; see our OpenAI Codex enterprise guide |
| OpenCode | anomalyco/opencode | MIT | README refers to its documentation; see our guide to OpenCode with local models |
Sources: each project’s README and licence file on GitHub. Checked 1 December 2026.
Two observations for buyers. Gemini CLI’s README now says it is not tuned for the Gemini 4 series, so Qwen Code’s Gemini CLI origins say little about how the two behave today. And an open-source licence on the agent does not settle the data question: that depends on the model endpoint you choose.
How SysArt helps
SysArt helps regulated organisations choose and set up coding agents on infrastructure they control: selecting and serving a model, configuring the agent’s approval, sandbox and MCP settings, and documenting the data flows for security and data protection review. See our AI agent implementation service for how we design, test and govern agents that act on enterprise systems.
Featured image by Jake Walker on Unsplash.
Frequently asked questions
What is Qwen Code?
Qwen Code is an open-source AI coding agent published by the Qwen team under the Apache 2.0 licence. It runs in a terminal and also offers a desktop app, a web interface, editor integrations and SDKs. It reads a repository, edits files and runs commands, with approval modes that control what it may do unprompted. It was originally based on Google Gemini CLI v0.8.2 and is now developed independently.
Is Qwen Code free?
The software is free and open source, but model access is not. The project's terms page states that the legacy free Qwen OAuth allowance was discontinued on 15 April 2026. As of 1 December 2026, signing in with a Qwen account requires an active Plus or Pro subscription. The alternatives are a paid API key or plan, or a model you host yourself, where you pay for hardware instead of tokens.
Can Qwen Code run with a local model?
Yes. The documentation shows local servers such as vLLM, Ollama and LM Studio configured as OpenAI-compatible providers in `settings.json`, each with a local `baseUrl` such as `http://localhost:8000/v1`. Servers without authentication accept a placeholder key. The server must support tool calling, because Qwen Code sends tool definitions with every request, and you should set the context window size to match the server.
How do I install Qwen Code?
The README gives three routes: a standalone install script for Linux, macOS and Windows, the npm package `@qwen-code/qwen-code` (which requires Node.js 22 or later), and Homebrew with `brew install qwen-code`. After installing, run `qwen` inside a project folder and use the `/auth` command to choose a sign-in method or provider. Enterprises usually prefer the package route, because it allows a pinned version from an internal registry.
Is Qwen Code based on Gemini CLI?
It began that way. The repository's acknowledgements state that the project was originally based on Google Gemini CLI v0.8.2, and that from Qwen Code v0.1 the team stopped syncing with the upstream project and began independent development as a multi-protocol agent framework. Both tools use the Apache 2.0 licence. The sandbox documentation notes that some sandbox variables may historically have used a GEMINI prefix.
Does Qwen Code send my code to Alibaba?
Only if you choose a Qwen or Alibaba Cloud route. Prompts and code context go to whichever model provider you configure. With a Qwen subscription, Qwen's privacy policy says input is processed in Singapore by Alibaba Cloud (Singapore) Private Limited. With a self-hosted endpoint, they stay on your infrastructure. Separately, anonymised usage statistics go to an Alibaba Cloud collection endpoint by default until you disable them.
How do I turn off telemetry in Qwen Code?
Set `privacy.usageStatisticsEnabled` to `false` in `settings.json`, or set the environment variable `QWEN_USAGE_STATISTICS_ENABLED=false`, then restart. The environment variable takes precedence. The documentation notes that a trusted workspace's own settings file can switch the setting back on, so set the environment variable on managed machines. A separate switch, `model.catalogRefresh`, blocks the model catalogue download from models.dev.
Sources
- QwenLM/qwen-code on GitHub: README, Apache 2.0 LICENSE, releases list and the Terms of Service and Privacy Notice in docs/users/support (origin, install, features, v0.29.1, end of the free OAuth allowance) · checked 1 December 2026
- Qwen Code documentation: Authentication, with the Model Providers page (sign-in options, plan endpoints, local self-hosted models, vLLM flags) · checked 1 December 2026
- Qwen Code documentation: Settings reference (settings files, usage statistics, telemetry, MCP allow-list, sandbox default, enforced auth type) · checked 1 December 2026
- Qwen Code documentation: Approval Mode, with the Auto Mode and Sandbox pages (five modes, defaults, classifier, sandbox methods and limits) · checked 1 December 2026
- Qwen: Privacy Policy, effective 7 September 2026 (operator, processing in Singapore, model training on de-identified content, transfer safeguards) · checked 1 December 2026
- Alibaba Cloud Model Studio: Regions and service deployment scopes (last updated 30 November 2026) · checked 1 December 2026
- Qwen: Qwen3-Coder-Next model card on Hugging Face (Apache 2.0, 80B total and 3B active parameters, 262,144-token context, vLLM tool-calling command) · checked 1 December 2026
- Regulation (EU) 2016/679 (GDPR) on EUR-Lex: Article 28 and Chapter V, Articles 44 to 46 · checked 1 December 2026
- google-gemini/gemini-cli on GitHub: README and licence (Apache 2.0; enterprise Code Assist focus; free access moved to Antigravity CLI on 18 June 2026) · checked 1 December 2026
- openai/codex on GitHub: README and licence (Apache 2.0; ChatGPT plan or API key sign-in) · checked 1 December 2026
- anomalyco/opencode on GitHub: README and licence (MIT) · checked 1 December 2026
- anthropics/claude-code on GitHub: README and LICENSE.md (all rights reserved; Anthropic Commercial Terms of Service) · checked 1 December 2026