Qwen Code is a free, open source AI coding agent from Alibaba’s Qwen team. It runs in your terminal like Claude Code or Codex, reads your project, edits files, runs commands and can work through long tasks on its own.
It started as a fork of Google’s Gemini CLI and has grown into its own tool, with a desktop app, a browser Web UI, IDE plugins for VS Code, Zed and JetBrains, SDKs and chat integrations.
It works with Qwen’s own models, OpenAI, Anthropic and Gemini APIs, third-party providers, and local models through Ollama, vLLM or LM Studio.
This guide shows how to install Qwen Code, sign in or connect an API key, run it with a free local model, choose a safe approval mode, use the key commands and fix common problems. It follows the official README and docs as of November 2026 (version 0.28, with a 1.0 Preview available).
- What: an open source terminal coding agent with desktop, web, IDE and SDK options.
- Install: the standalone script,
npm install -g @qwen-code/qwen-code@latest(Node.js 22+) orbrew install qwen-code. - Start:
qwenin your project folder, then/auth. - Sign-in note: the Qwen account option now needs a Plus or Pro subscription; API keys and local models are the other routes.
- Local models: point an
openaiprovider athttp://localhost:11434/v1in~/.qwen/settings.json. - Safety: the default Auto mode uses a classifier; switch modes with Shift+Tab.
What Qwen Code Can Do
- Code in your terminal: explain a repo, write features, fix bugs, run tests and review changes.
- Agent features: SubAgents, Skills, Auto-Memory and MCP work from the first session.
- Long tasks:
/goalkeeps working across turns until an independent verifier accepts the result, within a token budget. - Scheduling:
/loopand cron tools re-run prompts on an interval or at a set time. - Experimental extras: Agent Teams, Agent Arena (compare models on the same task in Git worktrees), voice input, Qwen Live and image generation.
| Feature | Qwen Code |
|---|---|
| License | Open source |
| Interfaces | Terminal, desktop app, Web UI, VS Code, Zed, JetBrains, chat apps |
| Protocols | OpenAI, Anthropic, Gemini and Qwen APIs |
| Local models | Ollama, vLLM, LM Studio and other OpenAI-compatible servers |
| Project instructions | QWEN.md and AGENTS.md load automatically |
| Benchmark | 76.4% to 77.8% average on SWE-bench Verified across versions with Qwen 3.7 Max |
Install Qwen Code
| System | Command |
|---|---|
| Linux / macOS | curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash |
| Windows (PowerShell) | irm https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.ps1 | iex |
| npm (Node.js 22+) | npm install -g @qwen-code/qwen-code@latest |
| Homebrew | brew install qwen-code |
- Run one install command from the table above.
- Restart your terminal so the new PATH takes effect. The README calls this out specifically.
- Open your project:
cd /path/to/your-project qwen
The README also links a separate Qwen Code 1.0 Preview branch that combines Qwen Code with the agent harness from Qoder. The steps here are for the main version.
Sign In or Connect a Provider
Run /auth inside Qwen Code. The menu has five options:
| Option | What you need | Best for |
|---|---|---|
| Qwen Account with Subscription | A Plus or Pro subscription from chat.qwen.ai | Qwen subscribers; browser sign-in, no key |
| QwenCloud | Token Plan or pay-as-you-go API key | Official Qwen API, includes the web_search tool |
| Alibaba ModelStudio | Coding Plan, Token Plan or API key | Fixed monthly cost with Qwen, GLM, Kimi and MiniMax models |
| Third-party Providers | An API key | DeepSeek, Grok, MiniMax, Z.AI, Kimi, OpenRouter, ModelScope and more |
| Custom Provider | A base URL (and key if needed) | Local servers, proxies and other compatible endpoints |
Older guides mention a free Qwen OAuth tier. The current docs describe the Qwen account option as requiring a Plus or Pro subscription, so plan on an API key or a local model if you want to pay nothing.
For CI or containers where a browser sign-in can’t work, use environment variables or ~/.qwen/settings.json instead of /auth. After signing in, /model switches between the models your provider offers.
Use Qwen Code With a Local Model
You can run Qwen Code for free with a local model. Ollama, vLLM and LM Studio all expose an OpenAI-compatible API, which Qwen Code supports through the openai provider type.
- Pull a coding model in Ollama, for example a Qwen coder model, and make sure Ollama is running.
- Raise Ollama’s context length, since agents need room for files and tool output. Our Ollama context length guide shows how.
- Edit
~/.qwen/settings.json:{ "env": { "OLLAMA_API_KEY": "ollama" }, "modelProviders": { "openai": [ { "id": "qwen3-coder:30b", "name": "Qwen3 Coder 30B (Ollama)", "envKey": "OLLAMA_API_KEY", "baseUrl": "http://localhost:11434/v1", "generationConfig": { "timeout": 300000, "contextWindowSize": 32768 } } ] }, "security": { "auth": { "selectedType": "openai" } }, "model": { "name": "qwen3-coder:30b" } } - Match the id to the exact model name from
ollama list, and setmodel.nameto the same value. - Run
qwen. No interactive/authis needed once the file is saved.
Note that envKey is the name of an environment variable, not the key itself. Ollama doesn’t check the key, so any placeholder works. For LM Studio, use http://localhost:1234/v1; see our LM Studio guide. Small models often struggle with agent tool calls, so pick a strong coding model from our best Ollama models list.
Your First Session
- Start in your project with
qwen. - Ask for an overview:
Explain this repository and show me where to start. - Plan before editing bigger changes with
/plan refactor the auth module. - Approve or reject the proposed edits, depending on your approval mode.
- Add a QWEN.md file with your stack, style and test commands so every session starts with the right context.
- Resume later with
/resume.
Approval Modes: Stay in Control
| Mode | File edits | Shell commands | Best for |
|---|---|---|---|
| Plan | Read-only | Not run | Exploring and planning |
| Ask Permissions | Manual approval | Manual approval | New codebases, critical systems |
| Auto-Edit | Auto-approved | Manual approval | Daily coding |
| Auto (default) | Classifier decides | Classifier decides | Long sessions with a safety net |
| YOLO | Auto-approved | Auto-approved | Trusted automation and CI only |
Cycle modes with Shift+Tab (Tab on Windows), or use /approval-mode. The status bar always shows the current mode. Use /plan exit to leave Plan mode and go back to your previous mode. For extra safety, Qwen Code also offers a sandbox and Git worktrees to isolate big edits.
Useful Commands and Features
| Command | What it does |
|---|---|
/auth |
Sign in or change provider |
/model |
Switch model |
/plan |
Enter read-only planning (add a task after it to start right away) |
/approval-mode |
Pick an approval mode |
/goal |
Keep working until a verifier accepts the result |
/loop |
Repeat a prompt on an interval |
/review, /bugfix, /batch |
Built-in skills |
/learn |
Turn docs or code into a new skill |
/resume |
Continue a past session |
You can also add MCP servers for extra tools, run your own scripts with hooks before and after tool calls, and enable LSP integration (experimental) for go-to-definition and diagnostics.
Desktop App, Web UI and IDEs
- Desktop: download Qwen Code Desktop for macOS, Windows or Linux from the GitHub releases page.
- Web UI (experimental): run
qwen serve --open; it serves athttp://127.0.0.1:4170. - Background daemon:
qwen daemon start,status,logs -fandstop. - Editors: official setup guides for VS Code, Zed and JetBrains.
- Chat apps: Telegram, DingTalk, WeChat, WeCom and Feishu channels.
Security note from the README: the daemon listens on loopback without authentication by default, and any local process that can reach it can run code. On shared machines, set QWEN_SERVER_TOKEN and start it with --require-auth.
Headless Mode for Scripts
Run a one-off prompt without the interactive UI:
qwen -p "Summarize the changes in the last commit"
This works in CI pipelines and batch jobs. Pair it with Plan or Ask Permissions mode unless the environment is disposable. For deeper integration, there are TypeScript, Python and Java SDKs. Want to compare it with other open source agents? See our OpenHands Agent Canvas guide.
Troubleshooting
| Problem | Likely cause | Fix |
|---|---|---|
qwen: command not found |
Terminal not restarted | Open a new terminal; check your PATH |
| npm install fails | Old Node.js | Install Node.js 22 or newer, or use the standalone script |
| Qwen account sign-in won’t work | No Plus or Pro subscription | Subscribe, or use an API key or local model instead |
| Browser sign-in impossible (CI, SSH) | No browser available | Use env variables or settings.json with an API key |
| Local model “not found” | id doesn’t match Ollama’s model name | Copy the exact name from ollama list |
| Local model times out | Slow generation | Raise timeout in generationConfig; use a smaller quant |
| Agent ignores files or forgets context | Context window too small | Increase Ollama’s context and contextWindowSize |
| Too many approval prompts | Ask Permissions mode | Switch to Auto-Edit or Auto with Shift+Tab |
If Ollama runs on your CPU instead of your GPU, our Ollama not using GPU fix will help.
FAQ
Is Qwen Code free?
The tool is free and open source. Model access depends on your route: a Qwen subscription, a paid API key, or a free local model.
Is the free Qwen OAuth tier still available?
The current docs describe the Qwen account option as needing a Plus or Pro subscription. Check the auth docs for the latest terms.
Can Qwen Code use Claude or GPT models?
Yes. It supports OpenAI, Anthropic and Gemini protocols, plus third-party providers like OpenRouter.
Does Qwen Code work offline?
Yes, with a local model served by Ollama, vLLM or LM Studio.
How is it related to Gemini CLI?
It was originally based on Gemini CLI v0.8.2, then became independent from version 0.1 onwards.
Where is the config file?
~/.qwen/settings.json for user settings. Project instructions go in QWEN.md or AGENTS.md.
Does it work on Windows?
Yes. Use the PowerShell installer or npm, and Tab instead of Shift+Tab to cycle approval modes.



