dsh-cost-meter 1.8.23 → 1.8.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/README.zh-CN.md +6 -6
- package/docs/qwen-cli-quota.md +9 -5
- package/lib/client.js +5 -5
- package/lib/qwen-cli.js +43 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
Per-conversation cost · daily totals · OpenCode Go subscription quota display · budget with usage percentage · official account balance · custom provider balance · balance progress bar · history · peak/off-peak pricing hours display (peak hours UTC 01:00–04:00, 06:00–10:00; weekends and Chinese public holidays are off-peak all day, with separate labels) · pre-switch popup & system-notification alerts for peak/off-peak changes (position / lead time / alert type configurable) · one-click price sync from the official docs · Codex-style token usage heat grid · multi-vendor model pricing (built-in 170+ model-ID catalog with auto-matching) · mainstream Coding Plan quota queries & display (Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet / Volcano Ark / Qwen / Xiaomi MiMo) plan/API dual-track billing (subscription quota vs pay-as-you-go money separated, per-1% & full-window token/equivalent-cost estimates with daily/weekly/monthly curves) · · quota strip above the input box (budget / Go / coding-plan usage in one row, toggleable)
|
|
10
10
|
|
|
11
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
12
12
|
|
|
13
|
-
**v1.8.
|
|
13
|
+
**v1.8.24** fixes Qianwen personal Token Plan quota detection when the usage summary reports no subscription, and keeps billing selectors visible beside long model names in per-model statistics. See the [release notes](CHANGELOG.md).
|
|
14
14
|
|
|
15
15
|
Desktop users: follow the [Desktop installation instructions](docs/install-troubleshooting.md#desktop-安装与更新) for the application's own CLI and `desktop` Profile.
|
|
16
16
|
|
|
@@ -323,22 +323,22 @@ On Node.js 20, use `npm install -g pnpm@10` instead. See [pnpm installation and
|
|
|
323
323
|
dsh plugin --profile web add dsh-cost-meter
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
-
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.8.
|
|
326
|
+
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.8.24`** — review the script before running):
|
|
327
327
|
|
|
328
328
|
```powershell
|
|
329
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.
|
|
329
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.24/install.ps1 | iex
|
|
330
330
|
```
|
|
331
331
|
|
|
332
332
|
**Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
|
|
333
333
|
|
|
334
334
|
```sh
|
|
335
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.
|
|
335
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.24
|
|
336
336
|
```
|
|
337
337
|
|
|
338
338
|
Without git, use the GitHub tag archive:
|
|
339
339
|
|
|
340
340
|
```sh
|
|
341
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.
|
|
341
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.24.tar.gz
|
|
342
342
|
```
|
|
343
343
|
|
|
344
344
|
After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
|
package/README.zh-CN.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
本会话费用 · 当日费用 · OpenCode Go 订阅额度显示 · 预算与已用百分比 · 官方账户余额 · 自定义 Provider 余额查询(可配任意 HTTP 端点) · 余额三段进度条 · 历史记录 · 峰谷计价时段显示(UTC 01:00–04:00、06:00–10:00 为峰时段;周末与中国法定假日全天按谷价,分别标注) · 峰/谷切换前弹窗与系统通知提醒(位置/提前量/提醒类型可配) · 官方价格一键同步 · 类 Codex Token 用量热图 · 多厂商多模型价格计费(内置 170+ 模型 ID 价格目录与自动匹配) · 主流 Coding Plan 额度查询与显示(Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet / 火山方舟 / 千问 / 小米 MiMo 十一家,含 Volcano Ark AK/SK 签名与 MiMo 控制台 Cookie 查询) · Plan/API 双轨计费(订阅额度与按量金额分离统计,每 1% 额度与满窗的 token/等值金额估算及日/周/月曲线) · 输入框上方额度横条(预算/Go/Coding Plan 用量一条横排显示,可开关)
|
|
10
10
|
|
|
11
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
12
12
|
|
|
13
|
-
**v1.8.
|
|
13
|
+
**v1.8.24** 修复千问个人 Token Plan 有订阅却读不到额度的问题,并修复按模型统计中长名称遮住计费方式下拉框和 Plan 标签的问题。详见 [更新记录](CHANGELOG.md)。
|
|
14
14
|
|
|
15
15
|
桌面端用户请按 [Desktop 安装说明](docs/install-troubleshooting.md#desktop-安装与更新),使用应用自带的 CLI 和 `desktop` Profile。
|
|
16
16
|
|
|
@@ -323,22 +323,22 @@ Node.js 20 请改用 `npm install -g pnpm@10`。版本要求见 [pnpm 官方安
|
|
|
323
323
|
dsh plugin --profile web add dsh-cost-meter
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
-
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.8.
|
|
326
|
+
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.8.24`**,建议先下载审阅再运行):
|
|
327
327
|
|
|
328
328
|
```powershell
|
|
329
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.
|
|
329
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.8.24/install.ps1 | iex
|
|
330
330
|
```
|
|
331
331
|
|
|
332
332
|
**或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
|
|
333
333
|
|
|
334
334
|
```sh
|
|
335
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.
|
|
335
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.8.24
|
|
336
336
|
```
|
|
337
337
|
|
|
338
338
|
没有 git 时可用 GitHub tag 打包直链:
|
|
339
339
|
|
|
340
340
|
```sh
|
|
341
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.
|
|
341
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.8.24.tar.gz
|
|
342
342
|
```
|
|
343
343
|
|
|
344
344
|
安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
|
package/docs/qwen-cli-quota.md
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
npm install -g @qianwenai/qianwen-cli
|
|
11
11
|
qianwen auth login
|
|
12
12
|
qianwen usage summary --format json
|
|
13
|
+
qianwen subscription status --format json
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
安装后重启 DSH,使宿主读取新的 `PATH`。远程 DSH、容器或服务账号需要在对应环境安装和登录;只在本地浏览器所在机器登录不生效。插件使用 CLI 自己保存的登录态,不要求复制模型 API Key、Cookie 或管理令牌。
|
|
@@ -18,10 +19,11 @@ qianwen usage summary --format json
|
|
|
18
19
|
|
|
19
20
|
## 显示口径
|
|
20
21
|
|
|
21
|
-
-
|
|
22
|
+
- 优先读取 `usage summary --format json` 中的 `token_plan`:总 Credits、剩余 Credits、已用比例,以及可选加量包剩余量。已用量由总量减剩余量计算,小数 Credits 保留,标记 `(CLI)`。
|
|
23
|
+
- 若汇总命令成功但未提供有效额度(包括 `subscribed: false`),补查 `subscription status --format json`,只读取 `individual.status: active` 下明确返回的 `monthlyCredits`/`weeklyCredits`。`usedPct` 已是百分比,保留小数;`resetTime` 是该额度窗口的重置时间。总 Credits 单独显示,CLI 未提供的绝对已用/剩余额度不自行推算。原查询有效时不增加命令;认证失败、超时及无效 JSON 不触发补查。
|
|
22
24
|
- CLI 的 `resetDate` 在核验版本中来自订阅实例 `EndTime`,因此显示为「CLI 订阅到期」,不作为月度重置倒计时或采样边界。
|
|
23
|
-
- 官方快照包含该账号在其他工具中的用量;插件不会把这些总量写进 DSH 账本。CLI
|
|
24
|
-
- 未登录、超时、异常 JSON 或无有效订阅额度时显示提示并清空本次额度。CLI 会把部分上游失败转换为 `subscribed: false
|
|
25
|
+
- 官方快照包含该账号在其他工具中的用量;插件不会把这些总量写进 DSH 账本。CLI 未提供用于采样的完整额度周期边界,因此此模式不生成千问「每 1% / 满窗 Token」估算。
|
|
26
|
+
- 未登录、超时、异常 JSON 或无有效订阅额度时显示提示并清空本次额度。CLI 会把部分上游失败转换为 `subscribed: false`,补查也无有效额度时,插件仍不能据此断言账号没有订阅。可检查终端输出后刷新,或手动切回本地估算;不会自动用本地数值冒充官方数值。
|
|
25
27
|
- 本地估算的月度额度、起始日和抵扣率保留,切回后继续使用。`usage summary` 未提供可用主订阅额度、只有加量包时,当前显示无有效订阅额度提示。
|
|
26
28
|
|
|
27
29
|
## 执行与验证
|
|
@@ -65,9 +67,9 @@ Expand **Settings → Cost → Quota → Qwen Token Plan**, enable it and select
|
|
|
65
67
|
|
|
66
68
|
Install `@qianwenai/qianwen-cli` on the DSH host, run `qianwen auth login` as the same OS user, then verify `qianwen usage summary --format json`. Restart DSH after installation so it receives the updated PATH. Browser-side login alone does not configure a remote host or container.
|
|
67
69
|
|
|
68
|
-
The card reads the current `token_plan` credits, computes used credits from total minus remaining, preserves fractional credits, and labels the result `(CLI)`. Optional add-on credits appear separately. The verified CLI maps `resetDate` from subscription `EndTime`; it is shown as subscription expiry, never a monthly reset. No account-wide totals are imported into the ledger, and this mode does not produce Qwen per-1% / full-window token estimates without a reliable billing period.
|
|
70
|
+
The card first reads the current `token_plan` credits, computes used credits from total minus remaining, preserves fractional credits, and labels the result `(CLI)`. Optional add-on credits appear separately. The verified CLI maps `resetDate` from subscription `EndTime`; it is shown as subscription expiry, never a monthly reset. No account-wide totals are imported into the ledger, and this mode does not produce Qwen per-1% / full-window token estimates without a reliable billing period.
|
|
69
71
|
|
|
70
|
-
Refreshes share one child process and use the configured 1–1440 minute cache (15 by default), including failed attempts. Manual refresh retries immediately. Disabling the source or switching to local estimates cancels pending work. Errors clear the quota and provide a setup/retry hint.
|
|
72
|
+
Refreshes share one child process and use the configured 1–1440 minute cache (15 by default), including failed attempts. Manual refresh retries immediately. Disabling the source or switching to local estimates cancels pending work. Errors clear the quota and provide a setup/retry hint. When summary succeeds without valid quota, the plugin reads `subscription status --format json` and accepts only active individual monthly/weekly windows. `usedPct` is already a percentage; fractional values and the explicit window reset time are preserved. Total Credits are displayed separately; missing used/remaining Credits are not inferred. Valid summaries avoid the second command, and command failures, invalid JSON and timeouts do not trigger it. An unavailable fallback still does not prove that the account is unsubscribed. Add-on-only results without a usable main subscription also show this hint. Select local estimates explicitly when needed; saved local settings remain available.
|
|
71
73
|
|
|
72
74
|
Execution uses fixed arguments without a shell, an absolute PATH entry, closed stdin, a hidden window, a 15-second timeout and 1 MiB limits for stdout/stderr. Windows npm installations run their Node entry directly. Credentials remain in the CLI's store; raw child output is never returned to the browser or saved in the ledger.
|
|
73
75
|
|
|
@@ -90,3 +92,5 @@ Tests use synthetic output, real child processes and bilingual component callbac
|
|
|
90
92
|
Bailian source verification (2026-09-23): [Token Plan output](https://github.com/modelstudioai/cli/blob/72bc8fcce7f5ede6a5df81c1ce72d86de3f3ccd5/packages/commands/src/commands/usage/token-plan.ts), [Coding Plan output](https://github.com/modelstudioai/cli/blob/72bc8fcce7f5ede6a5df81c1ce72d86de3f3ccd5/packages/commands/src/commands/usage/coding-plan.ts), [ratio formatting](https://github.com/modelstudioai/cli/blob/72bc8fcce7f5ede6a5df81c1ce72d86de3f3ccd5/packages/commands/src/commands/usage/quota-box.ts). Tested with source-shaped fixtures and real local child processes; no live paid subscription was queried.
|
|
91
93
|
|
|
92
94
|
Login source verification (2026-10-05): [auth status](https://github.com/modelstudioai/cli/blob/8bbbbc722d70fb200641ef22b6f6d033aeae9f74/packages/commands/src/commands/auth/status.ts), [console login](https://github.com/modelstudioai/cli/blob/8bbbbc722d70fb200641ef22b6f6d033aeae9f74/packages/commands/src/commands/auth/login-console.ts), [exit codes](https://github.com/modelstudioai/cli/blob/8bbbbc722d70fb200641ef22b6f6d033aeae9f74/packages/core/src/errors/codes.ts).
|
|
95
|
+
|
|
96
|
+
#260 源码核验:[个人订阅额度映射](https://github.com/QianWen-AI/qianwen-cli/blob/054b874c985021ab4424dcf2d7e01c28aa99ad23/src/services/tokenplan-service.ts)、[订阅 JSON 输出](https://github.com/QianWen-AI/qianwen-cli/blob/054b874c985021ab4424dcf2d7e01c28aa99ad23/src/view-models/subscription/shared.ts)。新增回归覆盖 issue 中的 `0.00169%`、月/周窗口、到期与格式错误、补查失败/超时/脱敏及缓存并发;未查询真实付费订阅账号。
|