dsh-cost-meter 1.7.13 → 1.7.14
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.en.md +10 -8
- package/README.md +10 -8
- package/lib/client.js +2 -2
- package/lib/coding-plans.js +2 -1
- package/lib/gateway-quota-adapters.js +6 -2
- package/lib/index.js +3 -1
- package/lib/store.js +23 -0
- package/lib/typert.host.js +2 -0
- package/package.json +11 -4
package/README.en.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
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; from Aug 23, 2026 weekends are billed at off-peak prices all day, shown as “Weekend — all off-peak”) · 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 90+ model price catalog with auto-matching) · mainstream Coding Plan quota queries & display (Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet) 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)
|
|
8
8
|
|
|
9
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
10
10
|
[](https://www.npmjs.com/package/dsh-cost-meter)
|
|
11
11
|
[](LICENSE)
|
|
12
12
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
@@ -254,22 +254,22 @@ Real captures from an actual DSH sidebar of the period strip and collapsed verti
|
|
|
254
254
|
dsh plugin --profile web add dsh-cost-meter
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
**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.7.
|
|
257
|
+
**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.7.14`** — review the script before running):
|
|
258
258
|
|
|
259
259
|
```powershell
|
|
260
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.7.
|
|
260
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.7.14/install.ps1 | iex
|
|
261
261
|
```
|
|
262
262
|
|
|
263
263
|
**Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
|
|
264
264
|
|
|
265
265
|
```sh
|
|
266
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.7.
|
|
266
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.7.14
|
|
267
267
|
```
|
|
268
268
|
|
|
269
269
|
Without git, use the GitHub tag archive:
|
|
270
270
|
|
|
271
271
|
```sh
|
|
272
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.7.
|
|
272
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.7.14.tar.gz
|
|
273
273
|
```
|
|
274
274
|
|
|
275
275
|
After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
|
|
@@ -286,14 +286,16 @@ Cause: your environment (pnpm config or a policy bundled into the invoking insta
|
|
|
286
286
|
|
|
287
287
|
Fix:
|
|
288
288
|
|
|
289
|
-
1. **Upgrade
|
|
290
|
-
2. If
|
|
289
|
+
1. **Upgrade the plugin and use the host's plugin installer**: `zod` remains exact-pinned. `@deepseek-ai/dsh-credentials` and `@deepseek-ai/dsh-home-paths` are now peer dependencies supplied by DSH, avoiding duplicate old host packages that can fail dependency preflight (issue #106). Pinning prevents version drift but cannot satisfy every age threshold;
|
|
290
|
+
2. If an age restriction remains, wait until the version reaches the threshold, or review the exact package and version in the error before choosing to add an individual exclusion to the profile's `pnpm-workspace.yaml` (default `$DSH_HOME/profiles/web/pnpm-workspace.yaml`):
|
|
291
291
|
|
|
292
292
|
```yaml
|
|
293
293
|
minimumReleaseAgeExclude:
|
|
294
294
|
- '<name@version from the error>'
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
+
Host checks cover installation, startup, shared modules and removal on DSH `0.1.2-rc.1` and `0.1.3-alpha.2`. `0.1.3-alpha.1` remains unknown because its official npm version is unavailable. See the [compatibility record](docs/host-compatibility-v1.7.14.md) for the environment and limits.
|
|
298
|
+
|
|
297
299
|
### Update / Uninstall
|
|
298
300
|
|
|
299
301
|
```sh
|
|
@@ -320,7 +322,7 @@ dsh plugin --profile web add link:./dsh-cost-meter # symlink; edit lib/client.j
|
|
|
320
322
|
- **Historical billing correctness**: calls before 2026-08-16 16:00 UTC (the peak-era boundary) are billed at the base prices of that time, and later calls at the two-tier scheme;
|
|
321
323
|
- The ledger always stores amounts in **USD**; currency and FX rate only affect display (default 1 USD = 7.2 CNY, configurable);
|
|
322
324
|
- The session badge is **billed exactly** at the moment each call is made (host-exported per-call cost), just like daily/monthly/cumulative totals and the budget;
|
|
323
|
-
- Billing
|
|
325
|
+
- Billing uses usage blocks reported through the host's `llm/stream`, including sub-agents, compression, title generation and other auxiliary calls in isolated LLM services. Child sessions retain their own `sessionId` and do not contribute to the parent badge; background calls without a `sessionId` contribute only to daily/monthly/lifetime totals. Memory or other plugins that call external APIs directly without reporting usage to the host cannot be tracked;
|
|
324
326
|
- **Peak/off-peak tiers follow the request-initiation moment**: a streaming call can span the tier boundary hour; attributing by completion time would put a request started minutes earlier into the wrong tier;
|
|
325
327
|
- **Peak effective-time anchoring**: the official pricing page no longer lists an effective time, and price sync no longer resets the peak effective moment to "now" — historical recomputes (session projection refolds / per-model backfill) always tier events against the 2026-08-16 16:00 UTC boundary, so peak-hour history is no longer re-costed at half price; ledgers polluted earlier are clamped back automatically on upgrade (idempotent migration);
|
|
326
328
|
- **Switching pricing currency re-bases the whole history**: after the pricing-currency setting flips and re-syncs, historical entries are re-costed on the new price table in the background (days fully covered by session logs are replaced wholesale; sessions whose logs were cleaned keep their original basis), so history and the official bill share one basis, with a notice on completion; on upgrading to this version, existing ledgers that had switched currency and ended up with mixed bases are recomputed once automatically;
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
本会话费用 · 当日费用 · OpenCode Go 订阅额度显示 · 预算与已用百分比 · 官方账户余额 · 自定义 Provider 余额查询(可配任意 HTTP 端点) · 余额三段进度条 · 历史记录 · 峰谷计价时段显示(UTC 01:00–04:00、06:00–10:00 为峰时段;2026-08-23 起周末全天按谷价,显示「周末时段——全谷价」) · 峰/谷切换前弹窗与系统通知提醒(位置/提前量/提醒类型可配) · 官方价格一键同步 · 类 Codex Token 用量热图 · 多厂商多模型价格计费(内置 90+ 模型价格目录与自动匹配) · 主流 Coding Plan 额度查询与显示(Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / CommandCode / SCNet / 火山方舟 九家,含 Volcano Ark AK/SK 签名) · Plan/API 双轨计费(订阅额度与按量金额分离统计,每 1% 额度与满窗的 token/等值金额估算及日/周/月曲线) · 输入框上方额度横条(预算/Go/Coding Plan 用量一条横排显示,可开关)
|
|
8
8
|
|
|
9
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
10
10
|
[](https://www.npmjs.com/package/dsh-cost-meter)
|
|
11
11
|
[](LICENSE)
|
|
12
12
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
@@ -256,22 +256,22 @@
|
|
|
256
256
|
dsh plugin --profile web add dsh-cost-meter
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
-
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.7.
|
|
259
|
+
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.7.14`**,建议先下载审阅再运行):
|
|
260
260
|
|
|
261
261
|
```powershell
|
|
262
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.7.
|
|
262
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.7.14/install.ps1 | iex
|
|
263
263
|
```
|
|
264
264
|
|
|
265
265
|
**或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
|
|
266
266
|
|
|
267
267
|
```sh
|
|
268
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.7.
|
|
268
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.7.14
|
|
269
269
|
```
|
|
270
270
|
|
|
271
271
|
没有 git 时可用 GitHub tag 打包直链:
|
|
272
272
|
|
|
273
273
|
```sh
|
|
274
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.7.
|
|
274
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.7.14.tar.gz
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
|
|
@@ -288,14 +288,16 @@ dsh web
|
|
|
288
288
|
|
|
289
289
|
处理:
|
|
290
290
|
|
|
291
|
-
1.
|
|
292
|
-
2.
|
|
291
|
+
1. **升级插件并使用宿主插件安装器**:独立运行依赖 `zod` 保持精确锁版;`@deepseek-ai/dsh-credentials`、`@deepseek-ai/dsh-home-paths` 改由宿主通过 peer dependency 提供,避免另装旧版宿主包触发依赖预检(issue #106)。精确锁版能防止版本漂移,但不能保证满足任意年龄阈值;
|
|
292
|
+
2. 若仍出现年龄限制,可等待该版本达到阈值,或在核实报错中的具体包与版本后,由你决定是否在 profile 的 `pnpm-workspace.yaml`(默认 `$DSH_HOME/profiles/web/pnpm-workspace.yaml`)加入单项排除:
|
|
293
293
|
|
|
294
294
|
```yaml
|
|
295
295
|
minimumReleaseAgeExclude:
|
|
296
296
|
- '<报错中的包名>@<版本>'
|
|
297
297
|
```
|
|
298
298
|
|
|
299
|
+
宿主适配验证覆盖 DSH `0.1.2-rc.1`、`0.1.3-alpha.2` 的安装、启动、模块复用和卸载;`0.1.3-alpha.1` 无可获取的官方 npm 版本,暂标记为未知。验证环境及边界见[兼容记录](docs/host-compatibility-v1.7.14.md)。
|
|
300
|
+
|
|
299
301
|
### 更新 / 卸载
|
|
300
302
|
|
|
301
303
|
```sh
|
|
@@ -322,7 +324,7 @@ dsh plugin --profile web add link:./dsh-cost-meter # 符号链接,改 lib/clien
|
|
|
322
324
|
- **历史计费正确性**:2026-08-16 16:00 UTC(峰谷时代分界)之前的调用按当时的基础价计费,之后的调用按峰谷两档;
|
|
323
325
|
- 账本金额恒以**美元**存储,币种/汇率仅影响显示(默认 1 USD = 7.2 CNY,可改);
|
|
324
326
|
- 会话徽章与当日/月度/累计、预算一样,按每次调用的**实际时刻精确计费**(宿主导出的逐次成本);
|
|
325
|
-
-
|
|
327
|
+
- 计费来源为通过宿主 `llm/stream` 上报的 usage 块,包含隔离 LLM 服务中的子代理、压缩、标题等辅助调用。子会话按自己的 `sessionId` 记录,不并入父会话徽章;无 `sessionId` 的后台调用只计入日/月/累计总额。记忆等插件若直接请求外部 API、未向宿主上报 usage,本插件无法统计该部分消耗;
|
|
326
328
|
- **峰谷档位按请求发起时刻判定**:流式调用可能跨峰谷边界整点,以完成时刻归档会把数分钟前发起的请求算进另一个峰位;
|
|
327
329
|
- **峰谷生效时刻锚定**:官方价格页已不再标注生效时间,价格同步不再把峰谷生效时刻重置为「同步时刻」——历史重算(会话投影回放 / 按模型回填)一律按 2026-08-16 16:00 UTC 分界判档,峰时历史事件不再被按谷价半价重算;此前被污染的存量账本升级时自动钳制修复(幂等迁移);
|
|
328
330
|
- **币种切换即全量换基准**:「价格币种」切换并同步后,历史账目按新价目在后台整体重算(会话日志覆盖完整的日子整体替换,日志已清理的会话保持原口径),历史与官方账单同基准,完成后有提示;升级到本版时,此前切换过币种而新旧口径并存的存量账本自动重算一次;
|