x-qwen-agent-cli
v1.2.9
Published
Cross-platform OpenAI-compatible Qwen coding agent CLI
Maintainers
Readme
Qwen Agent CLI
A dependency-free OpenAI-compatible coding agent for Windows, Linux, macOS, and Termux. Node.js 20 or newer is required.
Install
From npm:
npm install -g x-qwen-agent-cliLinux, macOS, and Termux:
chmod +x install.sh
./install.shWindows:
install.cmdPowerShell can also run .\install.ps1 directly.
Configure
Interactive runs always ask for a masked API key, including qwen -p when a
terminal is attached. Non-interactive runs read QWEN_API_KEY,
OPENAI_COMPAT_API_KEY, or OPENAI_API_KEY. The key remains in memory for that
process only and is never stored in source code, settings, or chat history.
Linux, macOS, and Termux:
export QWEN_API_KEY="your-key"Windows PowerShell:
$env:QWEN_API_KEY = "your-key"Use
qwen
qwen -m qwen3.7-plus
qwen -m gpt-5.5 -p "Inspect and test this project."
qwen --clarify -p "Add authentication."
qwen --yes --no-streamThe interactive composer is multiline:
Enter: insert a new line.Alt+Enter: send the complete message.Ctrl+EnterorAlt+S: send when the terminal reserves Alt+Enter.- Arrow keys, Home, End, Backspace, and Delete edit the message.
- Multiline clipboard paste is preserved.
Commands: /plan TASK, /clarify TASK, /image PATH PROMPT, /file PATH PROMPT,
/new, /sessions, /resume SESSION, /approval ask|auto, /model, and /exit.
Use /clarify TASK or --clarify -p "TASK" when you want the agent to ask
precise requirements questions first. In clarification mode the agent should
not edit files or run side-effecting commands; it returns focused questions and
safe assumptions before implementation.
Images and files are sent as structured OpenAI attachment parts. Their bytes are uploaded through the selected provider's file endpoint and are never inserted into the user's text message.
Streaming is enabled by default. Reasoning is shown in a separate Thinking section when the provider returns it, and is never mixed into the final answer.
Realtime WebSocket is the default transport. The CLI connects to
wss://a-v-5.vercel.app/v1/realtime unless QWEN_REALTIME_URL or
--realtime-url provides another full ws:// or wss:// endpoint. HTTP is
used only when explicitly requested with --transport http or
QWEN_TRANSPORT=http.
The agent includes bounded file reads, batch reads and writes, tree and text
search, path metadata, file operations, Git status/diff, cross-platform shell
execution, and background terminals for dev servers and long-running commands.
Mutating actions require approval unless --yes is used.
For substantial tasks the model can call update_plan; plan steps and their
live status are rendered separately from chat and tool output.
Workspace tools
The Agent prompt and file tools are maintained centrally. Available workspace
tools include file_info, list_files, search_files, find_in_file,
read_file, read_lines, update_file, apply_patch, create_file,
delete_file, move_file, copy_file, make_directory,
start_background_terminal, read_background_terminal, and
stop_background_terminal.
Every Agent run sends fresh lightweight runtime context in the first user
message: OS/version, processor, Node.js version, workspace root, available
tools, and approval mode. File contents and fixed workspace listings are not
embedded in that prompt; the agent locates and reads current files on demand.
The CLI and VS Code extension
intentionally transport the full Agent instructions by prefixing the first user
message with <agent_instructions>. Every fourth user turn is prefixed with
<agent_reminder> so the model keeps the active workspace and agent role in
context. This avoids gateways that drop or weaken system messages while still
sending a SHA-256 prompt proof in request metadata.
The file tools enforce workspace-only paths, reject traversal and symlink escapes, deny protected secret-looking files by default, detect binary files, return SHA-256 hashes, and use hash-aware edits with structured diffs.
Install the VS Code extension
qwen install ext
qwen install ext --path ./dist/qwen-agent-1.0.0.vsix
qwen install ext --id qwen-agent.qwen-agent
qwen install ext --editor codium --forceThe command detects code, code-insiders, or codium, validates local VSIX
paths, and installs using argument arrays instead of shell string execution. If
no --path or --id is supplied, it installs the VSIX bundled in the CLI npm
package and falls back to ./dist/*.vsix in a local checkout.
