Blog

Qwen Code and Qwen 3.7-max: setting up Token Plan

Markdown

Installing Qwen Code on Node.js 22, connecting the international Token Plan, and three pitfalls that cause 401 errors: the API address, the key, and seat assignment.

Read full article

Ailoot reference documentation: ailoot.ai/docs/.

Updated 03.10.2026: three things have changed since publication. Alibaba closed Coding Plan to new purchases—Lite tier back in March, Pro is sold out. Token Plan switched from a weekly quota to a monthly one. A newer model, Qwen3.8-max, has been released. I also corrected an error in the description of the Token Plan key—it matters for that very 401, and I explain it below.

What is Qwen Code, and why isn't it just another knockoff?

Key takeaway

Qwen Code is an open-source terminal AI agent from Alibaba that works like Claude Code: it runs in the VS Code terminal, reads your project, writes code, and runs commands. The key difference is access to a dozen models through one subscription, including Qwen 3.7, DeepSeek V4, and Kimi K2.

When I first heard about Qwen Code, I thought, “another Claude Code clone that will break on the second prompt.” I was wrong. Alibaba didn’t copy the interface—they built their own CLI agent from scratch, but with full compatibility with the OpenAI API. That means you can run not only Qwen models inside it, but also DeepSeek, GLM, Kimi, and even Claude through the Anthropic API.

Here’s what it can actually do:

  • Reads the project structure and understands context (like Claude Code with CLAUDE.md)
  • Runs shell commands, edits files, and creates commits
  • Supports Skills and SubAgents
  • Works in VS Code through the built-in terminal or an extension
  • Switches between models with one /model command

There’s one downside, but it’s critical: the free tier closed on April 15, 2026. Previously, Qwen OAuth gave you 100 free requests a day—now only paid options remain. But even paid Qwen Code costs noticeably less than a Claude Pro subscription. If you’re choosing between tools right now, I covered all the options in the guide “What to code with in 2026: 8 AI tools”.

How much does it cost, and which plan should you choose?

Key takeaway

Alibaba offers three payment options: pay per token, the Coding Plan subscription, and the Token Plan subscription. For daily vibe coding, Token Plan is the best value: a fixed monthly amount, 10+ models, and no need to count tokens.

Confusion about plans is the biggest headache when setting up Qwen Code. Alibaba calls things different names in different parts of the console, and even the VS Code extension shows the wrong options. Here’s how it actually works (checked against Alibaba Cloud documentation, updated there on 28.09.2026).

PlanWhat it isWho it’s forApproximate cost
Pay-as-you-goYou pay separately for each million tokensOccasional use, trying it out$0.30-1.20 per 1M tokens
Coding PlanA subscription for individuals, with a monthly quota (the weekly quota was discontinued on 22.09.2026)Currently unavailable to new subscribers—Lite tier closed to purchases on 20.03.2026, Pro is sold outnot currently available for new accounts
Token Plan Team Edition, Standard Seat25,000 Credits per seat per month, 10+ modelsDaily vibe coding with model switching$20/seat per month on promotion (regular price: $30)

In the experience described by the author, Token Plan was chosen because one subscription gives you access to Qwen 3.7-max (and the newer Qwen3.8-max), DeepSeek V4 Pro, and GLM-5. All models draw from the same pool of Credits. Switch with the /model command—you don’t need to buy a separate key for each provider.

Important: Coding Plan and Token Plan are different products with different API addresses. A Coding Plan key has the sk-sp- prefix. A Token Plan key has no prefix at all—that’s how the official Qwen Code documentation describes it. Mix up the address or key between products and you’ll get a 401. And since Coding Plan is closed to new purchases, Token Plan is currently the only working option for most readers.

How do you install Qwen Code?

Key takeaway

Two options: via npm (npm install -g @qwen-code/qwen-code@latest) or Homebrew (brew install qwen-code). You need Node.js 22+. After installation, run qwen in the terminal.

Check your Node.js version before installing:

node --version

You need 22 or later. If yours is older, update through nodejs.org or with nvm:

nvm install 22
nvm use 22

Next, install Qwen Code with one command:

npm install -g @qwen-code/qwen-code@latest

Or use Homebrew on macOS:

brew install qwen-code

Check it:

qwen --version

If it displays a version, you’re ready. Launch Qwen Code with the qwen command in the terminal. In VS Code, open the built-in terminal (Ctrl+) and type qwen`.

There’s also a VS Code extension—Qwen Code Companion by QwenLM in the marketplace. It adds a chat sidebar, like GitHub Copilot. I use that one—it’s more convenient than the plain terminal.

How do you create an account and buy Token Plan?

Key takeaway

Sign up in the international Alibaba Cloud console (modelstudio.console.alibabacloud.com), add a card accepted by the provider, and subscribe to Token Plan. The whole process takes 10 minutes.

Step by step:

  1. Go to modelstudio.console.alibabacloud.com
  2. Click Free Sign Up at the top right
  3. Enter your email (Gmail works) and confirm the code from your inbox
  4. Add your phone number
  5. Add a card accepted by the provider. Alibaba will charge $1 to verify it and refund it in 1–3 days.
  6. In the console, find the ModelStudio section—the Token Plan tab
  7. Choose the Standard tier (the minimum, to get started)
  8. Confirm payment

After purchase, you’ll land on the My Subscriptions page. There you’ll see:

  • Standard Seat: 0/1—this means you bought a seat but haven’t assigned it to yourself
  • Click Assign—select your account and confirm
  • It should change to 1/1

The API key won’t work unless you do this. In the experience described by the author, this step cost 20 minutes.

Where do you get the API key and the correct address?

Key takeaway

The API key and API address (Base URL) are on the Management Platform page. For the international Token Plan, the address is https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1. Don’t confuse it with the regular DashScope address—the Token Plan key won’t work there.

On the My Subscriptions page, click the large purple Go to Management Platform button. A separate panel will open.

Select Overview in the left menu. On this page, you’ll see two sections:

Plan-specific API Key—your personal key. It’s masked with asterisks. Click the copy icon beside it (don’t select it with your mouse—the asterisks will be copied). Token Plan keys have no prefix. That’s not a typo in the instructions; the official Qwen Code documentation describes them that way. If you see sk-sp-, that’s a Coding Plan key from a different product—you copied the wrong one.

Plan-specific Base URL—two options:

  • For OpenAI-compatible tools (Qwen Code): https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1
  • For Anthropic-compatible tools: https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic

Remember: only these addresses work with a Token Plan key. The standard dashscope-intl.aliyuncs.com address is for regular keys (pay-as-you-go), while coding-intl.dashscope.aliyuncs.com is the Coding Plan address. A Token Plan key used with either of them will return a 401.

How do you connect it to VS Code?

Key takeaway

Configure the VS Code extension through the ~/.qwen/settings.json file. You need to enter the key, the correct API address, and the model. Here’s a ready-to-use config—copy it and replace the key with yours.

If you installed the Qwen Code Companion extension from the VS Code marketplace:

  1. Open the command palette (Cmd+Shift+P)
  2. Type Qwen Code: Choose Provider
  3. If you see a menu of options, don’t choose Coding Plan (it’s a different product). Choose Standard API Key
  4. Paste the key from the Management Platform—Token Plan keys have no fixed prefix
  5. Region: Singapore
  6. Model: qwen3.7-max

If you get an error after this, configure it manually through the file. The extension sometimes fills in the wrong address.

Open or create the ~/.qwen/settings.json file and paste:

{
  "env": {
    "TOKEN_PLAN_API_KEY": "YOUR-KEY-FROM-MANAGEMENT-PLATFORM"
  },
  "modelProviders": {
    "openai": [
      {
        "id": "qwen3.7-max",
        "name": "qwen3.7-max",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": { "enable_thinking": true },
          "contextWindowSize": 262144
        }
      },
      {
        "id": "qwen3.6-plus",
        "name": "qwen3.6-plus",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": { "enable_thinking": true },
          "contextWindowSize": 1000000
        }
      },
      {
        "id": "deepseek-v4-pro",
        "name": "deepseek-v4-pro",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": { "enable_thinking": true },
          "contextWindowSize": 1000000
        }
      }
    ]
  },
  "security": {
    "auth": { "selectedType": "openai" }
  },
  "model": { "name": "qwen3.7-max" }
}

Replace YOUR-KEY-FROM-MANAGEMENT-PLATFORM with your key from the Management Platform. Restart VS Code. Done.

Why does a 401 error appear, and how do you fix it?

Key takeaway

In 90% of cases, a 401 error when configuring Qwen Code means the API address or key is wrong. Token Plan, Coding Plan, and pay-as-you-go use different addresses, and their keys are not interchangeable.

The author described the errors encountered during setup. Here’s the full list of causes of 401 errors and how to check them:

SymptomCauseSolution
invalid_api_keyA Token Plan key is sent to the DashScope address (or vice versa)Check the Base URL. For Token Plan: token-plan.ap-southeast-1...; for Coding Plan: coding-intl.dashscope...
invalid access tokenStandard Seat hasn’t been assigned (0/1)Go to My Subscriptions—click Assign—it should show 1/1
invalid_api_keyThe VS Code extension generated its own key through the auth flow instead of using Token PlanOpen ~/.qwen/settings.json—check that the key matches what the Management Platform shows (don’t confuse it with the Coding Plan key, which has the sk-sp- prefix)
invalid_api_keyA space or line break was copied with the keyDelete the key and copy it again using the copy icon (don’t select it with the mouse)
model not foundThe model isn’t included in your planCheck the Available Models list on the subscription page
Insufficient quotaCredits have run outCheck Usage on My Subscriptions. If it’s at 100%, wait for the reset or buy a Boost Pack

Quick key check through the terminal:

curl -s -o /dev/null -w "%{http_code}" -X POST \
  "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen3.7-max","messages":[{"role":"user","content":"hi"}],"max_tokens":5}'

If it returns 200, the key works and the problem is in the extension settings. If it returns 401, the key or address is wrong.

Which models are available, and which should you choose?

Key takeaway

Token Plan offers 10+ models from 5 providers; the new flagship Qwen3.8-max was added in August 2026. For vibe coding, the main workhorse is qwen3.6-plus (a balance of price and quality). For complex tasks, use qwen3.7-max or the newer qwen3.8-max. For quick edits, use qwen3.6-flash.

Here are the models that are genuinely useful for vibe coding:

ModelWhen to use itCredit usage
qwen3.8-maxAlibaba’s new flagship (released in August 2026), maximum quality on complex tasksHigh—Credits run out faster than with 3.7-max
qwen3.7-maxComplex architecture, refactoring a large project, generating from scratchHigh—the quota runs out in a week with daily coding
qwen3.6-plusDaily workhorse: edits, improvements, reviews, explanationsMedium—enough for a month at 2–4 hours a day
qwen3.6-flashQuick edits, simple questions, formattingLow
deepseek-v4-proQwen alternative: sometimes better for algorithmic tasks and mathMedium
kimi-k2.6Long context: reading large codebases, analyzing documentationMedium

Switch between models with the /model command right in your Qwen Code session—you don’t need to change settings or restart.

I’d start with qwen3.6-plus. If after a week you feel the quota is running out too quickly, switch to qwen3.6-flash for routine work and keep qwen3.7-max for complex tasks only.

Qwen Code vs Claude Code—which should you use?

Key takeaway

Claude Code produces better code and understands context better. Qwen Code costs less and gives you access to several models through one subscription. The ideal combination: Claude Code for your main work, Qwen Code for parallel tasks and experiments.

The review describes the author’s month of working with both tools. Here’s a comparison based on that experience:

CriterionClaude CodeQwen Code
Code qualityBetter—Anthropic has since released newer models (Opus 5.5, 22.09.2026); the gap hasn’t narrowedGood, but even the new Qwen3.8-max flagship trails Anthropic’s top models in independent tests
Project understandingCLAUDE.md + deep reading of the tree = works like a personSimilar mechanics, but less refined
PriceClaude Pro $20/month (Max $100-200/month for heavy coding)Token Plan Standard from $20/month, includes 10+ models
Model selectionClaude only (Opus/Sonnet/Haiku)Qwen + DeepSeek + GLM + Kimi + MiniMax
Open sourceNo (closed source)Yes (MIT license)
VS Code extensionNative, stableAvailable, but rough—sometimes has key issues

When Qwen Code is a better deal:

  • You need access to several models (DeepSeek for math, Kimi for long context)
  • You’re experimenting with different approaches to one task
  • Your budget is limited, but you code every day
  • You want an open-source tool that you can customize

When Claude Code is indispensable:

  • A critical project where code quality equals money
  • Working with a large legacy project (Opus maintains context better)—I covered how not to burn through Claude Code limits separately
  • You need a stable VS Code extension without manual configuration

The combination in the author’s described experience: Claude Code for the main project, Qwen Code for experiments and parallel tasks, where you can quickly try an idea on a cheaper model. For a detailed comparison with other tools, see Cursor vs Claude Code and Codex vs Claude Code.

Three pitfalls everyone runs into

Key takeaway

Token Plan and Coding Plan are different products with different addresses. The VS Code extension fills in the wrong key. You need to assign the seat manually. These three pitfalls cost 30 minutes to several hours—I went through all three and recorded the solutions.

Pitfall 1: Token Plan ≠ Coding Plan

Alibaba calls these products different things in different parts of the console. The “Coding Plan” option in the VS Code extension is not Token Plan. Keep in mind: as of 20.03.2026, Coding Plan Lite is closed to new purchases, and Pro is sold out—if you don’t already have it, you can only choose Token Plan. They have different API addresses:

  • Token Plan: https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1
  • Coding Plan: https://coding-intl.dashscope.aliyuncs.com/v1

If you bought Token Plan but configured the extension as Coding Plan, you’ll get a 401. And vice versa.

Pitfall 2: The VS Code extension generates its own key

When you go through setup in the extension’s GUI (Cmd+Shift+P - Qwen Code: Choose Provider), the extension sometimes generates its own key through the Alibaba Auth API. This key has a different format and isn’t tied to your Token Plan subscription.

Solution: after setting it up through the GUI, open ~/.qwen/settings.json and make sure the key in env matches what the Management Platform shows (Overview - Plan-specific API Key). If it doesn’t match, replace it manually.

Pitfall 3: Standard Seat hasn’t been assigned

After buying Token Plan, you’ll see Standard Seat: 0/1 on the My Subscriptions page. This means the seat has been purchased but isn’t linked to your account. The API key won’t work until you click Assign.

In the author’s experience, debugging the 401 took 20 minutes before this line was noticed.

How do you check that everything works?

Key takeaway

Two steps: first check the key with curl in the terminal (it should return 200), then write any prompt in Qwen Code. If curl works but the extension doesn’t, the problem is in the ~/.qwen/settings.json file settings.

Step 1. Check the key through the terminal:

curl -X POST \
  "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen3.6-plus","messages":[{"role":"user","content":"Hello"}]}'

If the response contains text from the model, the key and address work.

Step 2. Check in Qwen Code:

Open VS Code—built-in terminal—type qwen. If it starts, write something:

What is this project in this folder?

Qwen Code will read the structure and reply. If it does, setup is complete.

Step 3. Check Credit usage:

Five minutes after your first requests, go to Management Platform—Overview—Usage Consumption. The percentage should be nonzero. If it’s 0% after 10+ requests, you’re using the wrong address (the requests are going outside the subscription, to pay-as-you-go or nowhere).

What’s next?

Key takeaway

Qwen Code is set up—you can start vibe coding. But the tool itself is only the beginning. The difference between “I installed the CLI” and “I’m building a product with AI” is the methodology for working with context.

You’ve installed Qwen Code and it works. You can open any project and start building through a dialogue with AI.

The next question is: why does the same prompt in Qwen Code produce a great result on one project and junk on another? It comes down to context. If the project contains a business/ structure with the audience, products, and goals, AI works like a partner. If the folder is empty, it hallucinates.

Sources

Continue exploring Ailoot at ailoot.ai.

More details

Questions about Qwen Code and Qwen 3.7-max: setting up Token Plan

What should I check first when a Token Plan key returns 401?

Confirm that the key and Base URL belong to Token Plan rather than Coding Plan or ordinary DashScope, copy the key with the console copy button, and check that the purchased Standard Seat is assigned. Then compare the extension’s saved settings with that same configuration.

Does a successful terminal request prove the VS Code extension is configured?

No. It verifies the key, endpoint, and model used by that request. Test a prompt in Qwen Code separately and compare its saved Base URL and key with the working request. Also check usage in the intended subscription.

All articles