建议:usage 类命令支持 API key 鉴权(现需 Console 浏览器登录,票据寿命1~4天,无法无人值守)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- openapi, typescript
- Domain
- api, authentication, cli
Research direction
Start by tracing the bl usage token-plan, stats, summary, and bl auth generate-access-token command paths and their current authentication and error handling. Done should cover a documented unattended API-key path, actionable missing-permission errors, distinguish expired Console tickets from denied access, and expose ticket lifetime status.
Written by the indexing model from the issue text.
Description
背景
我们在无人值守自动化场景(定时任务/监控脚本)中使用 bailian-cli 查询 Token Plan 用量。目前 bl usage token-plan、stats、summary 这类用量/订阅命令只接受 Console OAuth 票据(bl auth login --console),必须人工在浏览器点一次登录才能获取,且票据有效期短且不稳定(实测 1~4 天都有),导致自动化每天都要人工"续登",无法长期无人值守。
具体问题
- API key(
sk-sp-开头)可以正常调用模型,但查询用量一律 NoPermission —— 文档确认订阅信息"在控制台 Token Plan > 我的订阅 查看",即 CLI 无头查询没有官方通道。 - 用 OpenAPI AK/SK 跑
bl auth generate-access-token派 CLI access_token 报 NoPermission。查帮助文档找不到需要哪些 RAM 授权,靠猜+查 FAQ 才定位到可能要AliyunTokenPlanReadOnlyAccess+AliyunBSSReadOnlyAccess,但报错信息里没有任何提示,排错成本很高。 - Console 票据过期后的报错同样是 NoPermission,与"权限不足"无法区分;也没有命令能查询票据剩余有效期,自动化只能盲猜。
期望
- 提供 API key 可鉴权的用量/余额查询通道(哪怕只读"我的订阅剩余 Credits + 窗口进度"),让 CLI 在 CI/定时任务里可长期无人值守运行。
generate-access-token失败时报出具体缺哪个 action / RAM 策略,而不是裸 NoPermission。- Console 票据过期时报
AuthExpired(或类似可区分错误码),并提供bl auth ticket-status一类命令查询票据剩余寿命。
环境
- bailian-cli 1.24.0,macOS arm64
- Token Plan 个人版(Pro 档)
- 本 issue 由自动化脚本依据多日运行日志整理提交
- Dominant language
- TypeScript
- Stars
- 333
- Forks
- 28
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 33
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelstudioai/cli
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
modelstudioai/cli#211 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 63/100
modelstudioai/cli#200 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
modelstudioai/cli#195 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
modelstudioai/cli#190 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
modelstudioai/cli#131 ·
All issues in modelstudioai/cli
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100