Back to Blog

How to Use Qwen4-Max in Claude Code, Cursor and Cline (Tested)

2026-11-16·3 min read·CodeRouter Team

Disclosure: we build CodeRouter. Qwen4-Max is available in CodeRouter by name (Direct mode); our smart routing doesn't use it, for the reasons in our benchmark.

Qwen4-Max is Alibaba's new flagship. It has no open weights, so you reach it through an API. Through CodeRouter that's one model name, qwen4-max, in any tool that takes an Anthropic or OpenAI base URL.

What it costs

CodeRouter calls Alibaba Cloud Model Studio in its China (Beijing) region and bills that region's list price, with no markup:

Per million tokens
Input $1.413
Output (including its thinking) $4.24
Cache read $0.071

There's a 5.5% fee when you buy credits, and the free trial covers it. Alibaba's Singapore region and OpenRouter list it at $1.50 / $4.50. Your requests are processed in Alibaba Cloud's China (Beijing) region.

Claude Code

export ANTHROPIC_BASE_URL="https://www.coderouter.io"
export ANTHROPIC_AUTH_TOKEN="<your-coderouter-key>"
export ANTHROPIC_MODEL="qwen4-max"
export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen4-max"
export ANTHROPIC_DEFAULT_SONNET_MODEL="qwen4-max"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="qwen4-max"
export CLAUDE_CODE_SUBAGENT_MODEL="qwen4-max"
claude

Set all five model variables, or some calls will still ask for a Claude model.

What we saw. We gave Claude Code (2.1.282) a small job on November 16: make mean([]) return 0 without touching the test. Qwen4-Max read the file, fixed it correctly and left the test alone in 3 requests and 19 seconds. Billed: $0.030. The first request carried Claude Code's 17,700-token system prompt and tool definitions and cost $0.025; the next two hit Alibaba's prompt cache and cost $0.002 each. Claude Code's own cost summary prices every model as Claude, so read the cost in your CodeRouter dashboard instead.

Cursor

Settings → Models: turn on OpenAI API Key and paste your CodeRouter key, turn on Override OpenAI Base URL and enter https://www.coderouter.io/api/v1, then add a custom model named qwen4-max. Details and troubleshooting: our Cursor base-URL guide.

Cline

Settings → API Provider: OpenAI Compatible. Base URL https://www.coderouter.io/api/v1, your CodeRouter key, Model ID qwen4-max. In Model Configuration, a 1,000,000-token context window is accurate; set Max Output Tokens to what you need (CodeRouter caps a request at 65,536).

Thinking

Qwen4-Max thinks before it answers, at Alibaba's default effort (high), which is how we benchmarked it. Its thinking is billed as output and counts toward max_tokens. To change it, send your own effort:

Any change we make is reported in the X-CodeRouter-Adjusted response header.

Should you use it?

On our 175 coding tasks Qwen4-Max solved 96.0% with one retry, at the same cost as Claude Sonnet 5.5, which solved 100%. It's a strong model, not a cheaper Sonnet. Use it if you want Qwen specifically, a second vendor for the same work, or its 1M-token context. If cost is the goal, CodeRouter's default routing or a model like Kimi K2.6 is cheaper on the same tasks.

Limits: one small Claude Code task, one day. We haven't tested image input through CodeRouter. More on the model and its API: integration notes.

Try phase-aware routing on your own workload

One base URL for Claude Code, Cursor or Aider. Free trial, no credit card.

Start free trial

Get weekly AI cost optimization tips

Join developers cutting their agent bills