← All guides

How to use Qwen in Claude Code

Alibaba's Qwen models — especially the Qwen-Coder line — are strong, cheap coding options, and Claude Code can be pointed at them. Here's how to connect Qwen, what to check, and the cleaner path if you'd rather just pick it from a list.

TL;DR: Qwen is served through Alibaba's DashScope API, which is OpenAI-compatible and also offers an Anthropic-compatible endpoint. For Claude Code, point ANTHROPIC_BASE_URL at Qwen's Anthropic-compatible base and ANTHROPIC_AUTH_TOKEN at your DashScope key, then select a Qwen model (e.g. a Qwen-Coder model). It's cheap and capable, but it's a global switch — to move back to Claude you edit env vars and restart. An agent that treats the model as a setting removes that friction.

Qwen + Claude Code: the short version

Qwen models are hosted on Alibaba's DashScope platform. DashScope speaks the OpenAI-compatible shape, and also exposes an Anthropic-compatible endpoint aimed at tools like Claude Code. That means you can route Claude Code to Qwen directly by pointing it at the Anthropic-compatible base and supplying your DashScope key.

The config

What to set

  1. ANTHROPIC_BASE_URLPoint it at Qwen/DashScope's Anthropic-compatible base URL.
  2. ANTHROPIC_AUTH_TOKENYour DashScope (Alibaba Cloud Model Studio) API key — usage is billed there.
  3. ModelChoose a Qwen model — the Qwen-Coder line is tuned for coding. Use the exact name the endpoint exposes.
Two gotchas: (1) DashScope has separate international and mainland-China endpoints — use the region that matches your key. (2) It's still one global endpoint, so switching back to Claude means editing env vars and restarting.

Why route to Qwen

What Qwen brings

ReasonDetail
CheapLow per-token cost, competitive for everyday coding
Coder-tuned modelsThe Qwen-Coder line is aimed specifically at code tasks
No Claude quotaRoute around Claude plan rate limits by using your own DashScope key

The cleaner option: Qwen as a one-click setting

Rewiring Claude Code's global endpoint works, but you lose the ability to mix models per task. If you want Qwen for routine work and Claude (or DeepSeek, or a local model) for the rest, use an agent where each provider is just a selectable entry — pick Qwen, do the work, switch when you like, no restart.

What that looks like with Wuwei

Qwen in the model list

OpenAI-compatible providers like DashScope/Qwen work as a selectable provider next to Claude, GLM, Kimi and DeepSeek.

Region-aware setup

Set the base URL, key and model once; switch models without touching env vars again.

Free, open source, local

MIT-licensed agent that runs on your machine and reads your real files; you only pay Qwen's usage.

FAQ

Can Claude Code use Qwen?

Yes. Qwen is served via Alibaba's DashScope, which offers an Anthropic-compatible endpoint. Set ANTHROPIC_BASE_URL to that base and ANTHROPIC_AUTH_TOKEN to your DashScope key, then pick a Qwen model.

Which Qwen model is best for coding in Claude Code?

The Qwen-Coder line is tuned for code tasks and is the usual pick for an agent workflow. Use the exact model name your DashScope endpoint exposes.

How do I switch between Qwen and Claude without reconfiguring?

Use an agent where models are settings you pick from a list. Wuwei is free and open source — Qwen and Claude both live in the model list, so switching is one click instead of an env-var edit and restart.

If you want Claude-Code-style agent coding on Qwen's cheap, coder-tuned models, Wuwei lets you pick Qwen from a list and switch to Claude or anything else in a click — free, open source, running locally on your real files.

Windows · macOS · Linux — free, no login