modelstudioai / modelstudioai/cli
建议:usage 类命令支持 API key 鉴权(现需 Console 浏览器登录,票据寿命1~4天,无法无人值守)
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 333
- Forks
- 28
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 33
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 由自动化脚本依据多日运行日志整理提交
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.
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.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, authentication, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100