---
title: "Qwen in Claude Code — Qwen3.8 for a whole team · Selan"
description: "Qwen runs in Claude Code through Alibaba's Anthropic-format endpoints. Run Qwen3.8 Max for a team on OpenRouter, beside Claude, no key on a laptop."
url: https://selan.ai/guides/qwen-in-claude-code
updated: 2026-11-08T10:07:04+02:00
---

Guide · Other models in Claude Code

# How do you run Qwen in Claude Code?

Point Claude Code at an endpoint that serves Qwen in Anthropic's API format, then name the model. Alibaba Cloud Model Studio publishes three such endpoints, one per way of paying, and OpenRouter is another. Through Selan, an owner connects the company's OpenRouter key once. Each developer then runs `selan claude --model openrouter:qwen/qwen3.8-max-0902`.

## Why does Qwen work in Claude Code at all?

Claude Code sends every request in Anthropic's Messages format. It reaches another server when `ANTHROPIC_BASE_URL` is set to that server's address.

Alibaba Cloud Model Studio serves Qwen in that same format, at addresses ending in `/apps/anthropic`. OpenRouter answers in it too.

So Qwen needs no translation in the middle, unlike GPT. What it needs is the right endpoint, the key made for that endpoint, the model names and the window. How GPT differs is in [running GPT in Claude Code](https://selan.ai/guides/gpt-in-claude-code).

## How do you set up Qwen in Claude Code by hand?

Alibaba's guide puts these in the `env` block of `~/.claude/settings.json`. For a Token Plan, it is:

-   `https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic` as the base URL, and your Token Plan API key as `ANTHROPIC_AUTH_TOKEN`
-   `qwen3.8-max` as the Opus model and `qwen3.8-flash` as the Sonnet model
-   `qwen3.6-flash` as the Haiku model
-   `auto` as the main model and the subagent model
-   `CLAUDE_CODE_MAX_CONTEXT_TOKENS` at `983616`

Claude Code assumes a 200K window otherwise. Alibaba's other way to raise it is a `[1m]` suffix on a model name that supports a 1M window.

To skip Anthropic's own sign-in at startup, Alibaba sets `hasCompletedOnboarding` to `true` in `~/.claude.json`. A change takes effect only in a new terminal window.

Every request in that session then goes to Alibaba. Claude models are out of reach until you change the file back.

That works for one person. On a team, it is one Alibaba key and one settings file per laptop. Why a key on every laptop is the expensive part is in [keeping API keys off laptops](https://selan.ai/guides/claude-code-without-api-keys).

## Which Alibaba plan and key does Claude Code need?

Model Studio offers three ways to pay. Each has its own base URL and its own API key.

| Way to pay | Base URL for Claude Code | Models in Alibaba's example |
| --- | --- | --- |
| Coding Plan | `https://coding-intl.dashscope.aliyuncs.com/apps/anthropic`, with a key starting `sk-sp-` | `qwen3.7-plus` in every slot |
| Token Plan, Personal or Team | `https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic` | `qwen3.8-max`, `qwen3.8-flash`, `qwen3.6-flash` |
| Pay-as-you-go | Your workspace's address, such as `https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic`, with a key starting `sk-` | `qwen3.7-max`, `qwen3.6-flash` |

An Alibaba key opens only the endpoint it was made for.

A key sent to another plan's base URL is refused with `401 invalid_api_key`.

A request sent with the general Model Studio key and base URL instead of the plan's is billed per token. Alibaba's fix is to delete the general key and keep only the plan's key.

## Can a team share one Qwen Coding Plan?

No. Alibaba says a Coding Plan is for your use only and must not be shared. Sharing may lead to restrictions on the subscription.

The plan is also for interactive use in coding tools. Its key must not run automated scripts or application backends, so a CI job is out.

Pro costs $50 a month. It allows up to 6,000 requests per 5 hours, 45,000 a week and 90,000 a month, whichever runs out first. Slots are limited and restocked daily.

It serves only the exact models Alibaba lists. On 8 November 2026 those were `qwen3.7-plus`, `qwen3.6-plus` and `qwen3.5-plus`, beside Kimi, GLM and MiniMax models. Qwen3.8 was not on that list.

For a team that wants only Qwen, Alibaba's Token Plan Team Edition is the simpler answer. It has seats you assign and revoke, usage per member and SSO. Alibaba commits to not using the team's conversation data for model training.

## How do you run Qwen in Claude Code through Selan?

Selan does not connect an Alibaba plan or key. It reaches Qwen through an OpenRouter key, which an owner connects once.

Qwen3.8 Max (0902) is the Qwen model Selan lists at OpenRouter. An owner switches it on under [Settings → Models](https://control.selan.ai/settings/models).

Developers install the `selan` CLI, sign in as themselves and name the model:

```bash
selan claude --model openrouter:qwen/qwen3.8-max-0902
```

The part before the first colon is the provider. Everything after it is that provider's own model id, passed through as it is. Another Qwen model OpenRouter serves works the same way, named by its OpenRouter id.

With `--model`, Selan tells Claude Code the model's real context window. Selan lists 1,000,000 tokens for Qwen3.8 Max, so a session compacts there and not at 200K. If an owner set a lower context limit for your company, it compacts at that instead.

It starts at `xhigh` effort. If an owner has set a lower [Max effort](https://selan.ai/docs#admins) for Qwen, it starts at the highest level left under that ceiling.

To skip the flag, an owner adds Qwen to Claude Code's picker under [Settings → Model pickers](https://control.selan.ai/settings/pickers). It then appears in `/model` beside the Claude models. The details are in [Run any model](https://selan.ai/docs#any-model).

## What does a team get beyond the model?

-   **One usage record.** Qwen turns land beside Claude turns, per person and per repository. [Usage per developer](https://selan.ai/guides/claude-code-usage-per-developer) shows what an owner sees.
-   **One spend limit.** An OpenRouter turn is metered, so it counts against a member's limit. See [spend limits](https://selan.ai/solutions/spend).
-   **No OpenRouter key on a laptop.** The key stays on the gateway. A developer holds a Selan session you can revoke.
-   **Codex on the same account.** `selan codex --model openrouter:qwen/qwen3.8-max-0902` uses the same route. See [Codex](https://selan.ai/docs/codex).

A Qwen turn runs on the OpenRouter key and on no other account. If that key is out of credit, the request fails rather than moving elsewhere. All of this is on [Providers and models](https://selan.ai/docs/providers). When OpenRouter alone is the simpler answer is in [OpenRouter and Selan compared](https://selan.ai/compare/openrouter).

## What should you check before switching a team to Qwen?

-   **No Ollama route yet.** Ollama's cloud model list had no Qwen model on 8 November 2026, so an Ollama Cloud plan does not reach Qwen today. Qwen runs on OpenRouter, per token.
-   **Effort and spend.** Qwen3.8 Max thinks before it answers, and Selan starts it at `xhigh`. On OpenRouter, the thinking is metered too.
-   **Images.** Selan lists Qwen3.8 Max as taking text, images and video.
-   **The model must be switched on.** A model your company cannot use is refused before Claude Code starts, not at the first request.

**Good to know:** Anthropic doesn't support routing Claude Code to non-Claude models through any gateway, Selan included. A Qwen session is the gateway's to answer for, not Anthropic's.

[Start for free](https://auth.selan.ai/r)

Free for up to three seats, and the Free plan needs no card.

### The short version

-   Qwen is served in Anthropic's API format, so Claude Code reaches it with no translation.
-   By hand, that is Alibaba's settings and an Alibaba key on every laptop, and each key opens only its own plan's endpoint.
-   A Coding Plan is one person's, for interactive use; for a Qwen-only team, the Token Plan Team Edition is the simpler answer.
-   Through Selan, a developer runs `selan claude --model openrouter:qwen/qwen3.8-max-0902`, or picks Qwen in `/model` beside Claude.
-   Qwen runs on your OpenRouter key, with one usage record and no key on a laptop.

The manual setup, the three base URLs and the key errors are Alibaba Cloud Model Studio's Claude Code guide. The Coding Plan's price, limits, models and usage rules are its Coding Plan page. The Token Plan is its Token Plan guide and Team Edition FAQ. All were read on 8 November 2026, as was Ollama's cloud model list. Anthropic's position is its gateway docs, as read on 3 November 2026. What Selan does is its model list, its CLI and its providers, Codex and getting-started docs as they stood on 8 November 2026.
