Overview
Qwen Code is an open-source AI coding agent that runs in your terminal. It is built and tuned for the Qwen series of models, and it helps you understand large codebases, automate repetitive work, and write and refactor code without leaving the command line. It is a fork of Google's Gemini CLI, with parser-level changes that make it work better with Qwen-Coder models.
It is flexible about which model you connect to. You can use OpenAI-, Anthropic-, or Gemini-compatible APIs, the Alibaba Cloud Coding Plan, providers like OpenRouter or Fireworks AI, or your own API key. You can also point it at a local model running through Ollama or vLLM, so no cloud account is required. Models, keys, and defaults are all configured in a single settings file at ~/.qwen/settings.json.
Beyond the interactive terminal UI, Qwen Code can run headless for scripts and CI, integrate with VS Code, Zed, and JetBrains IDEs, run as a shared local daemon, and be driven from TypeScript, Python, and Java SDKs.
What it does
- Terminal-first agent that understands large codebases, refactors functions, and generates tests through chat
- Works with many providers: OpenAI-, Anthropic-, and Gemini-compatible APIs, OpenRouter, Fireworks AI, the Alibaba Cloud Coding Plan, or your own key
- Runs local models through Ollama or vLLM with no cloud account or API key needed
- Headless mode (qwen -p) for scripts, automation, and CI/CD pipelines
- IDE integration for VS Code, Zed, and JetBrains, plus TypeScript, Python, and Java SDKs
- Daemon mode (qwen serve) exposes one shared agent over HTTP+SSE so several clients reuse the same session
Getting started
Qwen Code needs Node.js 22 or later. Install the CLI, start an interactive session, and pick an authentication method on first run.
Install with npm
Install the package globally. On macOS or Linux you can also use Homebrew (brew install qwen-code), or the standalone install script from the docs.
npm install -g @qwen-code/qwen-code@latestStart an interactive session
Move into your project folder and launch the terminal UI. On first use you will be prompted to sign in; run /auth at any time to switch authentication methods. Use @ to reference local files, for example @src/main.ts.
cd your-project/
qwenConfigure a model provider
The recommended setup is to edit ~/.qwen/settings.json, where you declare your models, API keys, and the default model. Inside a session, /model switches between configured models and /help lists available commands.
{
"modelProviders": {
"openai": [
{
"id": "qwen3.6-plus",
"name": "qwen3.6-plus",
"baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"envKey": "DASHSCOPE_API_KEY"
}
]
},
"env": { "DASHSCOPE_API_KEY": "sk-xxxxxxxxxxxxx" },
"security": { "auth": { "selectedType": "openai" } },
"model": { "name": "qwen3.6-plus" }
}Run headless for scripts and CI
Use the -p flag to run a single prompt without the interactive UI, which is handy for automation and CI/CD.
cd your-project/
qwen -p "your question"Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Explore an unfamiliar codebase by asking what the project does and how its structure is laid out
- Refactor functions and generate unit tests directly from the terminal
- Automate code tasks in CI/CD pipelines with headless single-prompt runs
- Run a fully local coding agent against Qwen models served by Ollama or vLLM, with no cloud account
- Drive the agent programmatically from TypeScript, Python, or Java SDKs in your own tools
How Qwen Code compares
Qwen Code alongside other open-source autonomous coding agents tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| opencode | ★ 182k | OpenCode is an open source AI coding agent that runs in your terminal, with built-in build and plan agents and an optional desktop app. |
| Gemini CLI | ★ 106k | An open-source command-line AI agent from Google that connects your terminal to Gemini models for reading code, editing files, running shell commands, and searching the web. |
| OpenHands | ★ 79.3k | An open-source AI software-development agent that plans tasks, edits files, runs commands, and tests code, usable from a terminal CLI, a local web GUI, or a Python SDK. |
| Goose | ★ 50.6k | Goose is an open-source AI agent that runs on your machine for code, research, automation, and more, with a desktop app, CLI, and API built in Rust. |
| Continue | ★ 34.7k | Continue is an open-source coding agent available as a CLI, VS Code extension, and JetBrains plugin, plus version-controlled AI checks that run on pull requests in CI. |
| Vibe Kanban | ★ 27.3k | Vibe Kanban lets you plan tasks on a kanban board, run coding agents like Claude Code and Codex in isolated workspaces, then review their diffs and ship pull requests. |
| Serena | ★ 26.1k | Serena is an open-source MCP toolkit that gives any LLM coding agent symbol-level code retrieval, editing, and refactoring across 40+ languages. |
| Qwen Code | ★ 25.8k | Open-source AI coding agent that lives in your terminal, tuned for Qwen models |