📦 QwenLM/qwen-code:运行在终端中的开源 AI 编程 Agent
英文标题:📦 QwenLM/qwen-code
Qwen Code 是一款开源 AI 编程 Agent,原生提供 Auto-Memory、Auto-Skills、SubAgents、Agent Teams 和 MCP 等 Agent 能力,并支持动态工作流。它兼容 OpenAI、Anthropic、Gemini 和 Qwen API,也可接入任意第三方服务商或通过 Ollama、vLLM 运行本地模型。除终端交互外,Qwen Code 还提供 IDE 插件、桌面应用、Daemon 模式、SDK 及 Telegram、钉钉、微信、飞书等 IM 机器人集成。项目以 Google Gemini CLI v0.8.2 为基础,但自 Qwen Code v0.1 起已转为独立开发,并强调在功能覆盖和可靠性上对标 Claude Code。
122.3 KB
66.2 KB
中文
- 开箱即用的 Agent 能力 —— 提供 Auto-Memory、Auto-Skills、SubAgents、Agent Teams 和 MCP。动态工作流,零配置。
- 内外完全开源 —— 框架和 Qwen 模型均为开源项目,并共同演进。没有厂商锁定。
- 多协议支持 —— 支持 OpenAI、Anthropic、Gemini 和 Qwen API。可使用任意第三方服务商或本地模型(Ollama / vLLM),并可在运行时切换。
- 超越终端 —— 提供 IDE 插件、桌面应用、Daemon 模式、SDK,以及 IM 机器人(Telegram / 钉钉 / 微信 / 飞书)。
提示
Qwen Code 正在积极利用自身进行迭代——使用自己的 Agent 和模型创建 Issue、提交 PR、审查代码和运行测试。由社区驱动,也由 AI 驱动。
Linux / 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 / Homebrew
NPM(需要 Node.js 22+):
npm install -g @qwen-code/qwen-code@latest
Homebrew(macOS / Linux):
qwen # 启动交互式终端 UI
# 在会话中:
/auth # 配置服务商和 API 密钥
| 模式 | 命令 | 使用场景 |
|---|---|---|
| 交互式 | qwen |
具备丰富渲染、@file 引用和斜杠命令的终端 UI |
| 无界面模式 | qwen -p "..." |
脚本、CI/CD、批处理——无需 UI |
| IDE | — | VS Code、Zed、JetBrains |
| 桌面端 | — | Qwen Code Desktop——适用于 macOS、Windows 和 Linux 的 GUI |
| Daemon | qwen serve |
通过 HTTP+SSE(ACP)共享 Agent 会话。多个客户端,一个 Agent。(实验性) 文档 |
| SDK | — | TypeScript、Python、Java |
| IM 机器人 | qwen channel |
连接 Telegram、钉钉、微信或飞书 |
SDK 示例(Python)
import asyncio
from qwen_code_sdk import is_sdk_result_message, query
async def main() -> None:
result = query(
"Summarize the repository layout.",
{
"cwd": "/path/to/project",
"path_to_qwen_executable": "qwen",
},
)
async for message in result:
if is_sdk_result_message(message):
print(message["result"])
asyncio.run(main())
如果你熟悉 Claude Code,那么你已经熟悉 Qwen Code——而且它还不止于此。我们投入了大量精力,致力于让 Qwen Code 在功能上与 Claude Code 达到同等水平,并全面提升功能广度和可靠性。
| 功能 | Qwen Code | Claude Code |
|---|---|---|
| SubAgents、Agent Teams、动态工作流 | ✓ | ✓ |
| Auto-Memory、Auto-Skills、Hooks | ✓ | ✓ |
内置 Skills(/review、/batch、/loop、/bugfix……) |
✓ | ✓ |
| MCP、Plan Mode、LSP 集成 | ✓ | ✓ |
| Auto Mode、Sandbox、Git Worktrees | ✓ | ✓ |
| Computer Use(桌面自动化) | ✓ | ✓ |
| IDE 插件(VS Code / JetBrains / Zed) | ✓ | ✓ |
| SDK | ✓ | ✓ |
| 无界面模式、会话管理 | ✓ | ✓ |
| 开源——模型与框架 | ✓ | — |
| 多协议(OpenAI / Anthropic / Gemini / Qwen + 任意服务商) | ✓ | — |
| Agent Arena(多个模型在相同任务上的正面比拼) | ✓ | — |
Daemon Mode——qwen serve(多客户端共享 Agent) |
✓ | — |
| IM 渠道(Telegram / 钉钉 / 微信 / 飞书) | ✓ | — |
-
Qwen Code Desktop —— 面向 macOS、Windows 和 Linux 的官方桌面应用
-
AionUi —— 面向包括 Qwen Code 在内的命令行 AI 工具的现代 GUI
-
Gemini CLI Desktop —— 面向 Qwen Code 的跨平台桌面端 / Web / 移动端 UI
-
🦞 Qwen Code Claw —— 让其他 Agent(Claude、Codex 等)通过 ACP 将编程任务委派给 Qwen Code。将以下提示词粘贴到你的 Agent 中:
Use Qwen Code as a coding agent. First, fetch and read this skill reference: https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/.qwen/skills/qwen-code-claw/SKILL.md Then follow the instructions inside to install, authenticate, and use Qwen Code via acpx for all coding tasks.
欢迎贡献!请参阅 CONTRIBUTING.md 了解相关指南。
本项目最初基于 Google Gemini CLI v0.8.2。我们衷心感谢 Gemini CLI 团队的出色工作。自 Qwen Code v0.1 起,我们停止与上游同步,开始独立开发,将其打造为一个支持多协议、多平台的 Agent 框架,并深度集成 Qwen 模型及更多模型。
English / 原文
- Agentic out of the box — Auto-Memory, Auto-Skills, SubAgents, Agent Teams, and MCP. Dynamic workflows, zero setup.
- Open-source, inside and out — The framework and the Qwen models are open-source. They evolve together. No vendor lock-in.
- Multi-protocol — Supports OpenAI, Anthropic, Gemini, and Qwen APIs. Any third-party provider or local model (Ollama / vLLM). Switch at runtime.
- Beyond the terminal — IDE plugins, Desktop app, daemon mode, SDKs, and IM bots (Telegram / DingTalk / WeChat / Feishu).
Tip
Qwen Code is actively iterating on itself — using its own agent and models to file issues, submit PRs, review code, and run tests. Powered by the community, driven by AI.
Linux / 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
Restart your terminal after installation to ensure environment variables take effect.
NPM / Homebrew
NPM (requires Node.js 22+):
npm install -g @qwen-code/qwen-code@latest
Homebrew (macOS / Linux):
qwen # Launch interactive terminal UI
# Inside the session:
/auth # Configure your provider and API key
See the Authentication Guide and Settings Reference for detailed setup.
| Mode | Command | Use Case |
|---|---|---|
| Interactive | qwen |
Terminal UI with rich rendering, @file references, slash commands |
| Headless | qwen -p "..." |
Scripts, CI/CD, batch processing — no UI |
| IDE | — | VS Code, Zed, JetBrains |
| Desktop | — | Qwen Code Desktop — GUI for macOS, Windows, Linux |
| Daemon | qwen serve |
Shared agent session over HTTP+SSE (ACP). Multiple clients, one agent. (experimental) Docs |
| SDK | — | TypeScript, Python, Java |
| IM Bot | qwen channel |
Connect to Telegram, DingTalk, WeChat, or Feishu |
| SDK example (Python) |
import asyncio
from qwen_code_sdk import is_sdk_result_message, query
async def main() -> None:
result = query(
"Summarize the repository layout.",
{
"cwd": "/path/to/project",
"path_to_qwen_executable": "qwen",
},
)
async for message in result:
if is_sdk_result_message(message):
print(message["result"])
asyncio.run(main())
If you know Claude Code, you already know Qwen Code — and then some. We've put significant effort into bringing Qwen Code to feature parity with Claude Code, improving both breadth and reliability across the board.
| Feature | Qwen Code | Claude Code |
|---|---|---|
| SubAgents, Agent Teams, Dynamic Workflows | ✓ | ✓ |
| Auto-Memory, Auto-Skills, Hooks | ✓ | ✓ |
| Built-in Skills (/review, /batch, /loop, /bugfix…) | ✓ | ✓ |
| MCP, Plan Mode, LSP Integration | ✓ | ✓ |
| Auto Mode, Sandbox, Git Worktrees | ✓ | ✓ |
| Computer Use (desktop automation) | ✓ | ✓ |
| IDE Plugins (VS Code / JetBrains / Zed) | ✓ | ✓ |
| SDK | ✓ | ✓ |
| Headless Mode, Session Management | ✓ | ✓ |
| Open-source — model and framework | ✓ | — |
| Multi-protocol (OpenAI / Anthropic / Gemini / Qwen + any provider) | ✓ | — |
| Agent Arena (multi-model head-to-head on same task) | ✓ | — |
Daemon Mode — qwen serve (multi-client shared agent) |
✓ | — |
| IM Channels (Telegram / DingTalk / WeChat / Feishu) | ✓ | — |
-
Qwen Code Desktop — Official desktop app for macOS, Windows, and Linux
-
AionUi — A modern GUI for command-line AI tools including Qwen Code
-
Gemini CLI Desktop — A cross-platform desktop/web/mobile UI for Qwen Code
-
🦞 Qwen Code Claw — Let other agents (Claude, Codex, etc.) delegate coding tasks to Qwen Code via ACP. Paste this prompt into your agent:
Use Qwen Code as a coding agent. First, fetch and read this skill reference: https://raw.githubusercontent.com/QwenLM/qwen-code/refs/heads/main/.qwen/skills/qwen-code-claw/SKILL.md Then follow the instructions inside to install, authenticate, and use Qwen Code via acpx for all coding tasks.
Contributions are welcome! See CONTRIBUTING.md for guidelines.
This project was originally based on Google Gemini CLI v0.8.2. We gratefully acknowledge the Gemini CLI team's excellent work. Starting from Qwen Code v0.1, we stopped syncing with upstream and began independent development as a multi-protocol, multi-platform agent framework with deep integrations for Qwen models and beyond.