Skip to content

Commit ae11ea5

Browse files
oliver-meesteipete
andauthored
feat(qwen): add Token Plan (Team Edition) provider (#94419)
* feat(qwen): add Token Plan provider Co-authored-by: Oliver Mee <[email protected]> * docs: regenerate documentation map --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Oliver Mee <[email protected]>
1 parent 62de86c commit ae11ea5

22 files changed

Lines changed: 2195 additions & 31 deletions

docs/docs_map.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7929,6 +7929,7 @@ Do not edit it by hand; run `pnpm docs:map:gen`.
79297929
- H2: Getting started
79307930
- H2: Plan types and endpoints
79317931
- H2: Built-in catalog
7932+
- H3: Token Plan catalog
79327933
- H2: Thinking controls
79337934
- H2: Multimodal add-ons
79347935
- H2: Advanced configuration

docs/plugins/plugin-inventory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ Each entry lists the package, distribution route, and description.
283283

284284
- **[qqbot](/plugins/reference/qqbot)** (`@openclaw/qqbot`) - npm; ClawHub. OpenClaw QQ Bot channel plugin for group and direct-message workflows.
285285

286-
- **[qwen](/plugins/reference/qwen)** (`@openclaw/qwen-provider`) - npm; ClawHub: `clawhub:@openclaw/qwen-provider`. Adds Qwen, Qwen Cloud, Model Studio, DashScope, Qwen Oauth, Qwen Portal, Qwen CLI model provider support to OpenClaw.
286+
- **[qwen](/plugins/reference/qwen)** (`@openclaw/qwen-provider`) - npm; ClawHub: `clawhub:@openclaw/qwen-provider`. Adds Qwen, Qwen Cloud, Model Studio, DashScope, Qwen Oauth, Qwen Portal, Qwen CLI, Qwen Token Plan, Bailian Token Plan model provider support to OpenClaw.
287287

288288
- **[raft](/plugins/reference/raft)** (`@openclaw/raft`) - npm; ClawHub. OpenClaw Raft channel plugin for secure CLI wake bridges.
289289

docs/plugins/reference/qwen.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
summary: "Adds Qwen, Qwen Cloud, Model Studio, DashScope, Qwen Oauth, Qwen Portal, Qwen CLI model provider support to OpenClaw."
2+
summary: "Adds Qwen, Qwen Cloud, Model Studio, DashScope, Qwen Oauth, Qwen Portal, Qwen CLI, Qwen Token Plan, Bailian Token Plan model provider support to OpenClaw."
33
read_when:
44
- You are installing, configuring, or auditing the qwen plugin
55
title: "Qwen plugin"
66
---
77

88
# Qwen plugin
99

10-
Adds Qwen, Qwen Cloud, Model Studio, DashScope, Qwen Oauth, Qwen Portal, Qwen CLI model provider support to OpenClaw.
10+
Adds Qwen, Qwen Cloud, Model Studio, DashScope, Qwen Oauth, Qwen Portal, Qwen CLI, Qwen Token Plan, Bailian Token Plan model provider support to OpenClaw.
1111

1212
## Distribution
1313

@@ -16,7 +16,7 @@ Adds Qwen, Qwen Cloud, Model Studio, DashScope, Qwen Oauth, Qwen Portal, Qwen CL
1616

1717
## Surface
1818

19-
providers: qwen, qwencloud, modelstudio, dashscope, qwen-oauth, qwen-portal, qwen-cli; contracts: mediaUnderstandingProviders, videoGenerationProviders
19+
providers: qwen, qwencloud, modelstudio, dashscope, qwen-oauth, qwen-portal, qwen-cli, qwen-token-plan, bailian-token-plan; contracts: mediaUnderstandingProviders, videoGenerationProviders
2020

2121
## Related docs
2222

docs/providers/qwen.md

Lines changed: 95 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22
summary: "Use Qwen Cloud through its OpenClaw plugin"
33
read_when:
44
- You want to use Qwen with OpenClaw
5+
- You have an Alibaba Cloud Token Plan subscription
56
- You previously used Qwen OAuth
67
title: "Qwen"
78
---
89

9-
Qwen Cloud is an official external OpenClaw provider plugin with canonical id `qwen`. It targets Qwen Cloud / Alibaba DashScope Standard and Coding Plan endpoints, keeps legacy `modelstudio` ids working as a compatibility alias, and exposes the Qwen Portal token flow as a separate provider, [`qwen-oauth`](/providers/qwen-oauth).
10+
Qwen Cloud is an official external OpenClaw provider plugin with canonical id `qwen`. It targets Qwen Cloud / Alibaba DashScope Standard and Coding Plan endpoints, exposes Token Plan as `qwen-token-plan`, keeps `modelstudio` as a compatibility alias, independently owns Alibaba's documented `bailian-token-plan` custom-provider id, and exposes the Qwen Portal token flow as [`qwen-oauth`](/providers/qwen-oauth).
1011

1112
| Property | Value |
1213
| ---------------------- | ------------------------------------------ |
1314
| Provider | `qwen` |
15+
| Token Plan provider | `qwen-token-plan` |
1416
| Portal provider | [`qwen-oauth`](/providers/qwen-oauth) |
1517
| Preferred env var | `QWEN_API_KEY` |
18+
| Token Plan env var | `QWEN_TOKEN_PLAN_API_KEY` |
1619
| Also accepted (compat) | `MODELSTUDIO_API_KEY`, `DASHSCOPE_API_KEY` |
1720
| API style | OpenAI-compatible |
1821

@@ -133,6 +136,50 @@ Choose your plan type and follow the setup steps.
133136

134137
</Tab>
135138

139+
<Tab title="Token Plan (Team Edition)">
140+
**Best for:** credit-based team subscription access to Qwen and supported third-party models through Alibaba Cloud Model Studio.
141+
142+
<Steps>
143+
<Step title="Get your dedicated key">
144+
Assign a Token Plan seat and create its dedicated `sk-sp-...` key. Token Plan, Coding Plan, and pay-as-you-go keys are not interchangeable. See the [Global Token Plan overview](https://www.alibabacloud.com/help/en/model-studio/token-plan-overview) or [China Token Plan overview](https://help.aliyun.com/zh/model-studio/token-plan-overview).
145+
</Step>
146+
<Step title="Run onboarding">
147+
For the **Global / International** endpoint in Singapore:
148+
149+
```bash
150+
openclaw onboard --auth-choice qwen-token-plan
151+
```
152+
153+
For the **China** endpoint in Beijing:
154+
155+
```bash
156+
openclaw onboard --auth-choice qwen-token-plan-cn
157+
```
158+
</Step>
159+
<Step title="Verify the provider">
160+
```bash
161+
openclaw models list --provider qwen-token-plan
162+
openclaw agent --model qwen-token-plan/qwen3.7-plus --message "Reply with: token plan ready"
163+
```
164+
</Step>
165+
</Steps>
166+
167+
<Note>
168+
Alibaba's OpenClaw guide uses `bailian-token-plan` for a manual custom
169+
provider. The plugin registers that id as a compatibility owner, but new
170+
configs should use `qwen-token-plan`. An exact custom
171+
`models.providers.bailian-token-plan` entry keeps ownership of its configured
172+
transport and catalog; it is never merged into the canonical OpenAI catalog.
173+
</Note>
174+
175+
<Warning>
176+
Use Token Plan only for interactive OpenClaw sessions. Do not select it for
177+
cron jobs, unattended scripts, or application backends. Alibaba states that
178+
non-interactive use can suspend the subscription or revoke its API key.
179+
</Warning>
180+
181+
</Tab>
182+
136183
<Tab title="Qwen OAuth / Portal">
137184
**Best for:** a Qwen Portal token against `https://portal.qwen.ai/v1`.
138185

@@ -174,13 +221,15 @@ Choose your plan type and follow the setup steps.
174221

175222
## Plan types and endpoints
176223

177-
| Plan | Region | Auth choice | Endpoint |
178-
| -------------------------- | ------ | -------------------------- | ------------------------------------------------ |
179-
| Coding Plan (subscription) | China | `qwen-api-key-cn` | `coding.dashscope.aliyuncs.com/v1` |
180-
| Coding Plan (subscription) | Global | `qwen-api-key` | `coding-intl.dashscope.aliyuncs.com/v1` |
181-
| Qwen Portal | Global | `qwen-oauth` | `portal.qwen.ai/v1` |
182-
| Standard (pay-as-you-go) | China | `qwen-standard-api-key-cn` | `dashscope.aliyuncs.com/compatible-mode/v1` |
183-
| Standard (pay-as-you-go) | Global | `qwen-standard-api-key` | `dashscope-intl.aliyuncs.com/compatible-mode/v1` |
224+
| Plan | Region | Auth choice | Endpoint |
225+
| -------------------------- | ------ | -------------------------- | ---------------------------------------------------------------- |
226+
| Coding Plan (subscription) | China | `qwen-api-key-cn` | `coding.dashscope.aliyuncs.com/v1` |
227+
| Coding Plan (subscription) | Global | `qwen-api-key` | `coding-intl.dashscope.aliyuncs.com/v1` |
228+
| Qwen Portal | Global | `qwen-oauth` | `portal.qwen.ai/v1` |
229+
| Standard (pay-as-you-go) | China | `qwen-standard-api-key-cn` | `dashscope.aliyuncs.com/compatible-mode/v1` |
230+
| Standard (pay-as-you-go) | Global | `qwen-standard-api-key` | `dashscope-intl.aliyuncs.com/compatible-mode/v1` |
231+
| Token Plan (Team Edition) | China | `qwen-token-plan-cn` | `token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1` |
232+
| Token Plan (Team Edition) | Global | `qwen-token-plan` | `token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1` |
184233

185234
The provider auto-selects the endpoint based on your auth choice. Canonical
186235
choices use the `qwen-*` family; `modelstudio-*` remains compatibility-only.
@@ -217,17 +266,46 @@ Availability can still vary by endpoint and billing plan even when a model is
217266
present in the static catalog.
218267
</Note>
219268

269+
### Token Plan catalog
270+
271+
Token Plan uses a separate exact-string allowlist. Image-generation-only plan
272+
models are not included here because they use different APIs.
273+
274+
| Model ref | Input | Context |
275+
| ----------------------------------- | ----------- | --------- |
276+
| `qwen-token-plan/qwen3.7-max` | text | 1,000,000 |
277+
| `qwen-token-plan/qwen3.7-plus` | text, image | 1,000,000 |
278+
| `qwen-token-plan/qwen3.6-plus` | text, image | 1,000,000 |
279+
| `qwen-token-plan/qwen3.6-flash` | text, image | 1,000,000 |
280+
| `qwen-token-plan/deepseek-v4-pro` | text | 1,000,000 |
281+
| `qwen-token-plan/deepseek-v4-flash` | text | 1,000,000 |
282+
| `qwen-token-plan/deepseek-v3.2` | text | 131,072 |
283+
| `qwen-token-plan/kimi-k2.7-code` | text, image | 262,144 |
284+
| `qwen-token-plan/kimi-k2.6` | text, image | 262,144 |
285+
| `qwen-token-plan/kimi-k2.5` | text, image | 262,144 |
286+
| `qwen-token-plan/glm-5.2` | text | 1,000,000 |
287+
| `qwen-token-plan/glm-5.1` | text | 202,752 |
288+
| `qwen-token-plan/glm-5` | text | 202,752 |
289+
| `qwen-token-plan/MiniMax-M2.5` | text | 196,608 |
290+
220291
## Thinking controls
221292

222-
`qwen3.7-max`, `qwen3.7-plus`, `qwen3.6-flash`, `qwen3.6-plus`, and
223-
`qwen/MiniMax-M2.5` are
293+
`qwen3.7-max`, `qwen3.7-plus`, `qwen3.6-flash`, and `qwen3.6-plus` are
224294
reasoning-enabled in the built-in catalog. For reasoning models on the `qwen`
225295
family, the provider maps OpenClaw thinking levels to DashScope's top-level
226296
`enable_thinking` request flag: disabled thinking sends `enable_thinking: false`,
227297
any other level sends `enable_thinking: true`. Custom models can opt into an
228298
alternate chat-template thinking payload by setting
229299
`compat.thinkingFormat: "qwen-chat-template"` on the model entry.
230300

301+
Token Plan models are also marked reasoning-capable. `kimi-k2.7-code` and
302+
`MiniMax-M2.5` are thinking-only, so OpenClaw keeps thinking enabled even when
303+
the session requests `/think off`. DeepSeek V4 maps `minimal` through `high` to
304+
the service's `high` effort and maps `xhigh` or `max` to `max`. GLM 5.2 accepts
305+
the full `minimal` through `max` range; GLM 5.1 and GLM 5 accept through
306+
`xhigh`, and all three default to `high`. Other hybrid models follow the
307+
requested on/off state.
308+
231309
## Multimodal add-ons
232310

233311
The `qwen` plugin exposes multimodal capabilities on the **Standard** DashScope
@@ -295,13 +373,15 @@ See [Video generation](/tools/video-generation) for shared tool parameters, prov
295373
Native Qwen endpoints advertise streaming usage compatibility on the shared
296374
`openai-completions` transport, so DashScope-compatible custom provider ids
297375
targeting the same native hosts inherit the same behavior without requiring
298-
the built-in `qwen` provider id specifically. This applies to both Coding
299-
Plan and Standard endpoints:
376+
the built-in `qwen` provider id specifically. This applies to Coding Plan,
377+
Standard, and Token Plan endpoints:
300378

301379
- `https://coding.dashscope.aliyuncs.com/v1`
302380
- `https://coding-intl.dashscope.aliyuncs.com/v1`
303381
- `https://dashscope.aliyuncs.com/compatible-mode/v1`
304382
- `https://dashscope-intl.aliyuncs.com/compatible-mode/v1`
383+
- `https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1`
384+
- `https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1`
305385

306386
</Accordion>
307387

@@ -320,9 +400,9 @@ See [Video generation](/tools/video-generation) for shared tool parameters, prov
320400
</Accordion>
321401

322402
<Accordion title="Environment and daemon setup">
323-
If the Gateway runs as a daemon (launchd/systemd), make sure `QWEN_API_KEY` is
324-
available to that process (for example, in `~/.openclaw/.env` or via
325-
`env.shellEnv`).
403+
If the Gateway runs as a daemon (launchd/systemd), make sure `QWEN_API_KEY`
404+
or `QWEN_TOKEN_PLAN_API_KEY` is available to that process (for example, in
405+
`~/.openclaw/.env` or via `env.shellEnv`).
326406
</Accordion>
327407
</AccordionGroup>
328408

extensions/qwen/api.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ export {
2020
QWEN_GLOBAL_BASE_URL,
2121
QWEN_STANDARD_CN_BASE_URL,
2222
QWEN_STANDARD_GLOBAL_BASE_URL,
23+
QWEN_TOKEN_PLAN_CN_BASE_URL,
24+
QWEN_TOKEN_PLAN_DEFAULT_MODEL_ID,
25+
QWEN_TOKEN_PLAN_DEFAULT_MODEL_REF,
26+
QWEN_TOKEN_PLAN_GLOBAL_BASE_URL,
27+
QWEN_TOKEN_PLAN_LEGACY_PROVIDER_ID,
28+
QWEN_TOKEN_PLAN_MODEL_CATALOG,
29+
QWEN_TOKEN_PLAN_PROVIDER_ID,
30+
type QwenTokenPlanRegion,
31+
resolveQwenTokenPlanBaseUrl,
2332
QWEN_MODEL_CATALOG,
2433
applyModelStudioNativeStreamingUsageCompat,
2534
buildModelStudioDefaultModelDefinition,
@@ -35,5 +44,9 @@ export {
3544
MODELSTUDIO_STANDARD_GLOBAL_BASE_URL,
3645
MODELSTUDIO_MODEL_CATALOG,
3746
} from "./models.js";
38-
export { buildModelStudioProvider, buildQwenProvider } from "./provider-catalog.js";
47+
export {
48+
buildModelStudioProvider,
49+
buildQwenProvider,
50+
buildQwenTokenPlanProvider,
51+
} from "./provider-catalog.js";
3952
export { createQwenThinkingWrapper, wrapQwenProviderStream } from "./stream.js";

0 commit comments

Comments
 (0)