Using Qwen Code in SpaceSpider: Long-Context Agent
Run Qwen Code inside a SpaceSpider pane. Install the Qwen CLI, connect DashScope or OpenRouter, and use its long context for deep codebase reads.
April 18, 2026 · 5 min read
Using Qwen Code in SpaceSpider
Qwen Code is Alibaba's open agentic coding CLI built on top of the Qwen family of models. Its defining trait is a very large context window, which makes it unusually good at reading big files, wide diffs, and monorepos. In SpaceSpider, Qwen Code shines as the "reader" in a grid of agents: it ingests and summarizes while Claude Code or Codex edit.
This page covers install, auth, provider choice, and the workflows that make Qwen Code's long context pay off.
Install Qwen Code
Qwen Code is distributed via npm:
npm install -g @qwen-code/qwen-code
Verify:
qwen-code --version
On Windows, relaunch PowerShell after installing Node so the PATH change sticks. On macOS and Linux, confirm your global npm bin is on PATH.
Choose a provider
Qwen Code supports multiple backends. The most common are:
- DashScope (Alibaba's hosted API) with the official Qwen models.
- OpenRouter for routed access to Qwen Coder variants.
- A self-hosted or third-party OpenAI-compatible endpoint running a Qwen model.
Pick one, get an API key, and export it before launching SpaceSpider.
DashScope
export DASHSCOPE_API_KEY=sk-...
export QWEN_CODE_MODEL=qwen3-coder
OpenRouter
export OPENROUTER_API_KEY=sk-or-...
export QWEN_CODE_BASE_URL=https://openrouter.ai/api/v1
export QWEN_CODE_MODEL=qwen/qwen3-coder
On Windows use setx instead of export, then restart SpaceSpider so new panes inherit the values.
Assign Qwen Code to a pane
- Open the new-space wizard or the CLI picker (
Ctrl+Shift+T). - Click the slot where you want Qwen Code.
- Select the Qwen Code tile. A green dot confirms it is installed.
- Save.
SpaceSpider spawns qwen-code in the space directory. You see the banner and a prompt.
Recommended pane placement
Qwen Code is most useful paired with other CLIs that do the writing. In a 4-pane 2-by-2:
- Top-left: Claude Code for architecture.
- Top-right: Codex for test-driven iteration.
- Bottom-left: Qwen Code for long-context reads, reviews, and summaries.
- Bottom-right: shell for tests and git.
In a 2-pane space, put Qwen Code on the left for a "reader first" workflow:
- Left: Qwen Code summarizing and answering "where does X live" across the whole codebase.
- Right: shell for acting on those answers.
See Grid layouts for monitor-size guidance.
Workflows that fit Qwen Code
Read the whole repo before editing
Ask Qwen Code to do a full repo scan: "Walk through the src/ directory and describe the architecture in 500 words". Because the context window is generous, Qwen Code can hold the whole thing and give you a grounded summary.
Paste that summary into the Claude Code or Codex pane as framing for the edit.
Review a wide diff
After a Claude Code edit, switch to the Qwen Code pane and run:
git diff main
Then ask Qwen Code: "Summarize this diff by file. Flag anything that looks risky". Long diffs that would truncate in smaller context windows are fine here.
Monorepo spelunking
In a monorepo, Qwen Code is effective at answering "which package owns feature X" or "list every place we call rpc.send". Treat its pane as the grep-with-reasoning tool.
Qwen Code environment variables
These pass through the PTY:
DASHSCOPE_API_KEYorOPENROUTER_API_KEY: provider credentials.QWEN_CODE_BASE_URL: override endpoint for OpenRouter, self-hosted endpoints, or regional DashScope hosts.QWEN_CODE_MODEL: default model. Examples:qwen3-coder,qwen/qwen3-coder, or a specific variant.QWEN_CODE_EDITOR: editor Qwen Code launches when editing files. Falls back to$EDITOR.
Useful Qwen Code slash commands
/help: lists commands./model: switch the active model./clear: drop the in-session context./compact: compress the running conversation.
Tuning for long context
The large context window is why you use Qwen Code, but it still benefits from a little care:
- Ask for summaries in chunks rather than dumping entire files unless you need it.
- Use
/compactwhen a session has been running for hours. - Pin a Coder variant; the base Qwen is weaker at code than the specialized Coder tier.
Troubleshooting Qwen Code
- "API key not configured": environment variables were set after SpaceSpider launched. Close and relaunch the app.
- "Model not found": provider does not expose the model name you set. List available models:
qwen-code models list. - Slow streaming on OpenRouter: regional routing. Switch to DashScope direct or a different OpenRouter endpoint.
- Long reads truncated: your provider's tier caps context below the model's maximum. Upgrade the plan or compact inputs.
More general help on Troubleshooting.
Frequently asked questions
Is Qwen Code open source?
The CLI itself is open source under Apache-like terms; the model weights depend on which model you pick. The CLI runs locally and only the model calls go over the network.
Can I run a local Qwen model?
Yes. Point QWEN_CODE_BASE_URL at your local OpenAI-compatible server (vLLM, Ollama with OpenAI bridge, etc.), set QWEN_CODE_MODEL to the name your server exposes, and leave the API key empty or placeholder.
Does Qwen Code understand Claude Code's or Codex's edits?
It sees them through the filesystem. Each pane is a separate process; there is no memory shared between agents, only the working tree on disk.
What is the difference between Qwen3 Coder and base Qwen3?
Qwen3 Coder is fine-tuned for code. Use it in Qwen Code panes. Base Qwen3 is a general chat model and performs noticeably worse at edits.
How is Qwen Code different from Kimi CLI?
Both are long-context, but they come from different labs and have different strengths. See Using Kimi CLI for a comparison.
Related reading
Keep reading
- Getting Started with SpaceSpider: AI Terminal MultiplexerGet started with SpaceSpider, the AI terminal multiplexer that runs Claude Code, Codex, Qwen, and Kimi side by side in a single desktop window.
- Install SpaceSpider on Windows 10 and 11 (MSI, Signed)Install SpaceSpider on Windows 10 and 11 using the signed MSI. Enable ConPTY, install AI coding CLIs, and verify the grid works end to end.
- Install SpaceSpider on macOS (Apple Silicon and Intel)Install SpaceSpider on macOS 12 Monterey or newer. Run AI coding CLIs like Claude Code and Codex on Apple Silicon or Intel in a signed DMG.
- Install SpaceSpider on Linux (AppImage and .deb)Install SpaceSpider on Linux via AppImage or .deb. Run parallel AI agents like Claude Code and Codex with WebKitGTK and a real PTY backend.
- Create Your First Space in SpaceSpider (3-Step Wizard)Create your first SpaceSpider space in three steps: pick a folder, choose a grid layout, and assign an AI coding CLI to every pane.
- SpaceSpider Grid Layouts: 1 to 9 Panes ExplainedPick the right SpaceSpider grid layout. Compare 1, 2, 3, 4, 6, 8, and 9 pane presets for parallel AI agents on any monitor size.