Skip to content

Commit a853319

Browse files
committed
feat(onboarding): add Token Plan setup guidance
- add Token Plan subscription and login entry to CLI, README, INSTALL, and skill - document built-in Base URL and automatic key validation - remove the completed Token Plan integration design document
1 parent bc162f4 commit a853319

12 files changed

Lines changed: 92 additions & 575 deletions

File tree

INSTALL.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ npx skills add modelstudioai/cli --all -g
6969

7070
> 此方式同时打通 `app list``usage free` 等控制台能力,并自动配置 API Key 调用所需的鉴权信息。
7171
72-
### 备选:由 Agent 引导用户输入 API Key 后登录
72+
### 备选一:由 Agent 引导用户输入普通 API Key 后登录
7373

7474
适用于无法拉起浏览器的对话式安装(远程 SSH、CI 调试、纯终端环境等):
7575

@@ -80,6 +80,15 @@ npx skills add modelstudioai/cli --all -g
8080
3. 用户提供了 Key 之后,在**用户本机终端**执行(Agent 用终端工具跑,勿把 Key 写进回复正文):`bl auth login --api-key <用户提供的_Key>`
8181
4. 登录成功后执行 `bl auth status --output json` 确认;汇报时只使用 masked 字段,**禁止**回显完整 Key。
8282

83+
### 备选二:使用 Token Plan API Key
84+
85+
- 获取入口:[Token Plan 订阅详情](https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview)
86+
87+
1. 请用户从订阅详情页获取或复制 Token Plan API Key,勿要求用户发到公开渠道。
88+
2. 在用户本机终端执行:`bl auth login --config token-plan --api-key <用户提供的_Key>`
89+
3. `token-plan` Profile 已内置默认 Base URL;登录命令会先测试 Key,通过后才保存并激活该 Profile,无需另行配置或重复测试。
90+
4. 执行 `bl auth status --config token-plan --output json` 确认;汇报时只使用 masked 字段。
91+
8392
### 其他方式
8493

8594
- **环境变量**(不落盘到配置文件):在 shell 中配置 API Key 环境变量;变量名见 `bl auth status --help`,勿在对话中向用户解释底层命名。
@@ -93,16 +102,15 @@ npx skills add modelstudioai/cli --all -g
93102

94103
---
95104

96-
## 4. 最小功能验证
105+
## 4. 配置验证
97106

98-
在鉴权配置完成后执行
107+
API Key 登录命令本身已经完成可用性测试,通过后只需确认配置状态
99108

100109
```bash
101110
bl auth status --output json
102-
bl text chat --message "ping" --non-interactive --output json
103111
```
104112

105-
若失败:根据 stderr / JSON 中的 `hint``message` 排查(网络、Key 无效、`base_url` 等)。DashScope 端点:使用 `--base-url` / `bl config set --key base_url` / `DASHSCOPE_BASE_URL`,默认中国大陆 `https://dashscope.aliyuncs.com`
113+
无需再执行重复的模型调用测试。若登录失败,根据 stderr / JSON 中的 `hint``message` 排查(网络、Key 无效、`base_url` 等)。DashScope 端点:使用 `--base-url` / `bl config set --key base_url` / `DASHSCOPE_BASE_URL`,默认中国大陆 `https://dashscope.aliyuncs.com`
106114

107115
---
108116

@@ -112,6 +120,6 @@ bl text chat --message "ping" --non-interactive --output json
112120
| ----------------------- | -------------------- | --------------------------------------------------------------- |
113121
| `bl: command not found` | 全局 bin 不在 PATH | 检查 `npm prefix -g` 与 PATH |
114122
| 安装报错 engines | Node 版本过低 | 升级到 ≥ 22.12 |
115-
| 401 / 鉴权失败 | 未 login 或 Key 无效 | 引导用户更新 Key `bl auth login --api-key` |
123+
| 401 / 鉴权失败 | 未 login 或 Key 无效 | Key 类型重新执行普通或 Token Plan 登录命令 |
116124
| 企业网络无法访问 npm | 代理 / 镜像 | 配置 registry 或代理后再装 |
117125
| 本机只有 pnpm、没有 npm | Agent 误用 pnpm 安装 | 先装/修好 **npm**,再用 `npm install -g bailian-cli`;勿用 pnpm |

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ bl auth login --console
9191
# Or authenticate with an API key
9292
bl auth login --api-key sk-xxxxx
9393

94+
# Or use Token Plan (Base URL built in; the key is tested during login)
95+
bl auth login --config token-plan --api-key sk-sp-xxxxx
96+
9497
# Chat with Qwen
9598
bl text chat --message "What is DashScope?"
9699

@@ -159,6 +162,15 @@ bl auth login --api-key sk-xxxxx
159162
bl text chat --api-key sk-xxxxx --message "Hello"
160163
```
161164

165+
### Token Plan API Key
166+
167+
Get or copy the API key from the [Token Plan subscription overview](https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview).
168+
The CLI has the default Token Plan Base URL built in. Login tests the key first, then saves and activates the `token-plan` config only when validation succeeds.
169+
170+
```bash
171+
bl auth login --config token-plan --api-key sk-sp-xxxxx
172+
```
173+
162174
### Console Login (OAuth)
163175

164176
Required for console capability commands (`model list`, `app list`, `usage summary/free/stats`, `workspace list`, `quota list/request/check/history`). Opens the Bailian console in your browser to sign in.
@@ -209,6 +221,7 @@ Config file location: `~/.bailian/config.json`
209221
| Qwen Model List | https://help.aliyun.com/zh/model-studio/getting-started/models |
210222
| Aliyun Model Studio Console | https://bailian.console.aliyun.com/?source_channel=cli_github |
211223
| Get API Key | https://bailian.console.aliyun.com/cn-beijing/?source_channel=key_github&tab=app#/api-key |
224+
| Get Token Plan API Key | https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview |
212225
| Get AccessKey | https://ram.console.aliyun.com/manage/ak |
213226

214227
## Changelog

README.zh.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ bl auth login --console
8989
# 或使用 API key 认证
9090
bl auth login --api-key sk-xxxxx
9191

92+
# 或使用 Token Plan(已内置 Base URL,登录时自动测试 Key)
93+
bl auth login --config token-plan --api-key sk-sp-xxxxx
94+
9295
# 和通义千问对话
9396
bl text chat --message "你好,介绍一下阿里云百炼平台"
9497

@@ -157,6 +160,15 @@ bl auth login --api-key sk-xxxxx
157160
bl text chat --api-key sk-xxxxx --message "你好"
158161
```
159162

163+
### Token Plan API Key
164+
165+
前往 [Token Plan 订阅详情](https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview) 获取或复制 API Key。
166+
CLI 已内置 Token Plan 的默认 Base URL;登录命令会先测试 Key,通过后才保存并激活 `token-plan` 配置。
167+
168+
```bash
169+
bl auth login --config token-plan --api-key sk-sp-xxxxx
170+
```
171+
160172
### 控制台登录(OAuth)
161173

162174
控制台能力命令(`model list``app list``usage summary/free/stats``workspace list``quota list/request/check/history`)需要使用此登录方式。打开浏览器跳转百炼控制台完成登录。
@@ -207,6 +219,7 @@ bl update
207219
| 通义千问模型列表 | https://help.aliyun.com/zh/model-studio/getting-started/models |
208220
| 阿里云百炼控制台 | https://bailian.console.aliyun.com/?source_channel=cli_github |
209221
| 获取 API Key | https://bailian.console.aliyun.com/cn-beijing/?source_channel=key_github&tab=app#/api-key |
222+
| 获取 Token Plan API Key | https://bailian.console.aliyun.com/cn-beijing?tab=plan#/efm/subscription/overview |
210223
| 获取 AccessKey | https://ram.console.aliyun.com/manage/ak |
211224

212225
## 更新日志

docs/agents/url-change.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ runtime/src/urls.ts ← 用户面控制台 URL(cn-only)
1919
BAILIAN_CONSOLE_ROOT bailian.console.aliyun.com
2020
BAILIAN_CONSOLE BAILIAN_CONSOLE_ROOT/cn-beijing
2121
API_KEY_PAGE BAILIAN_CONSOLE/?tab=app#/api-key
22+
TOKEN_PLAN_PAGE BAILIAN_CONSOLE_ROOT/cn-beijing?tab=plan#/efm/subscription/overview
2223
2324
core/files/upload.ts ← 文件上传 endpoint(cn-pinned)
2425
UPLOAD_API ${REGIONS.cn}/api/v1/uploads

0 commit comments

Comments
 (0)