@kenz1117/dsh-ui-usage-billing 1.2.5 → 1.2.7
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 +6 -6
- package/README.md +9 -9
- package/lib/client.js +5 -5
- package/lib/index.js +365 -86
- package/lib/types/aggregate.d.ts +60 -4
- package/lib/types/client/pricing.d.ts +11 -13
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|
Peer plugins (cost-meter, usage-stats, dsh-bill, …) each have their strengths; this plugin's positioning:
|
|
45
45
|
|
|
46
|
-
- **Live pricing sources** — a real-time models.dev catalog + a built-in catalog of
|
|
46
|
+
- **Live pricing sources** — a real-time models.dev catalog + a built-in catalog of 77 models across 24 vendors + user-defined prices in the settings panel (bindable per relay origin); new models don't wait for a hand-edited price table.
|
|
47
47
|
- **History is never recomputed** — every call is priced at its own moment, segmented by official change boundaries (base price before 08-17 → peak/off-peak v1 → weekend all-day off-peak from 08-23); pre-install history is backfilled from existing session logs, and later price changes never rewrite old bills.
|
|
48
48
|
- **Not just "how much" but "on what"** — input split by cache hit/miss (including reasoning), official vs third-party buckets, drill-down by workspace/session/relay site, per-turn cost-spike attribution; plus a performance panel few peers offer (per-model TTFT mean/P50/P90 and generation speed).
|
|
49
49
|
- **Subscription & balance loop** — 7 official provider balances + Coding Plan quotas + relay-station balances and rolling quota windows + self-declared endpoints + cross-reconciliation between official balance deltas and the local ledger.
|
|
@@ -110,7 +110,7 @@ Check your host generation first (`dsh --version`), then pick the matching insta
|
|
|
110
110
|
dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@latest
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
- **DSH 0.1.0-rc.8 ~ 0.1.1-rc.2** (legacy hosts):
|
|
113
|
+
- **DSH 0.1.0-rc.8 ~ 0.1.1-rc.2** (legacy hosts; **this line is frozen** — `stable` points permanently at the final v1.1.17, so existing installs keep working but receive no further releases; rationale and the formal EOL trigger are in [COMPATIBILITY.md](COMPATIBILITY.md)):
|
|
114
114
|
|
|
115
115
|
```sh
|
|
116
116
|
dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@stable
|
|
@@ -165,11 +165,11 @@ cost (CNY) = (missInput × p_input + cacheHit × p_cacheHit + output × p_output
|
|
|
165
165
|
|
|
166
166
|
| Provider | Models |
|
|
167
167
|
| -------- | ------------------------------------------------------------------------------------------- |
|
|
168
|
-
| DeepSeek | V4 Flash, V4
|
|
168
|
+
| DeepSeek | V4.1 Flash, V4 Pro (priced per official change boundary: base tier → peak/off-peak v1 → weekend off-peak) |
|
|
169
169
|
| Zhipu AI | GLM-5.3, GLM-5.2, GLM-5.1, GLM-5-Turbo, GLM-4.7, GLM-4.6, GLM-4.5-Air, GLM-5V-Turbo |
|
|
170
170
|
| Aliyun | Qwen3.8 Max, Qwen3.7-Max, Qwen3.5-Plus, Qwen3.5-Flash |
|
|
171
171
|
| Doubao | Seed-2.0 Pro, Seed-2.0 Mini, Seed-1.6 |
|
|
172
|
-
| Moonshot | Kimi K3, K2.7 Code, K2.7 Code HighSpeed, K2.6
|
|
172
|
+
| Moonshot | Kimi K3, K2.7 Code, K2.7 Code HighSpeed, K2.6, K2.8 Preview |
|
|
173
173
|
| Xiaomi | MiMo V2.5 (exempt when billed via a token-plan subscription channel)¹ |
|
|
174
174
|
| MiniMax | MiniMax-M3, MiniMax-M2.7, MiniMax-M2.7-highspeed |
|
|
175
175
|
| Baidu | ERNIE-5.1 |
|
|
@@ -179,7 +179,7 @@ cost (CNY) = (missInput × p_input + cacheHit × p_cacheHit + output × p_output
|
|
|
179
179
|
| iFlytek | Spark 4.0 Ultra (plan-based)¹ |
|
|
180
180
|
| SenseTime | SenseNova 6.5 (beta)¹ |
|
|
181
181
|
| Baichuan | Baichuan M3-Plus |
|
|
182
|
-
| OpenAI | GPT-5.6 Sol / Terra / Luna
|
|
182
|
+
| OpenAI | GPT-6 Astra, GPT-5.6 Sol / Terra / Luna |
|
|
183
183
|
| Google | Gemini 3.1 Pro, 3.6 Flash (Standard / Flex two-band, Flex = −50%) |
|
|
184
184
|
| xAI | Grok 4.6, Grok 4.3 |
|
|
185
185
|
| Meta | Llama 4 Maverick, Scout |
|
|
@@ -233,7 +233,7 @@ The host discovers the browser side automatically via the `dsh.client` declarati
|
|
|
233
233
|
|
|
234
234
|
- **Permission level: high**: reads durable session logs (files), calls official multi-vendor / subscription / balance / pricing APIs (network), reads `apiKeyEnv` via the credentials seam (credentials), writes the ledger under `~/.dsh` (persistent state); **no** command execution / shell.
|
|
235
235
|
- **Update channel: `user-reviewed`**: with file / network / credential capabilities, DSH STORE requires local manual confirmation on every install; review the repo, pinned commit, lifecycle scripts, and impact scope before installing.
|
|
236
|
-
- **Compatibility**: the preview line (npm `latest`/`alpha`, 1.2.x — kept above the stable line to kill the version inversion) targets DSH `0.1.2` ~ `0.1.5` (host `latest` currently at 0.1.5-rc.1, verified on real hardware); the stable line (npm `stable`, 1.1.x) targets legacy hosts `0.1.0-rc.8` ~ `0.1.1-rc.2`. Per-version declarations live in `package.json` under `dsh.compatibility`; the two-line mapping and monitoring mechanism are documented in [COMPATIBILITY.md](COMPATIBILITY.md). Node.js `^22.19.0 || >=24.0.0`.
|
|
236
|
+
- **Compatibility**: the preview line (npm `latest`/`alpha`, 1.2.x — kept above the stable line to kill the version inversion) targets DSH `0.1.2` ~ `0.1.5` (host `latest` currently at 0.1.5-rc.1, verified on real hardware); the stable line (npm `stable`, 1.1.x, **frozen**, final v1.1.17) targets legacy hosts `0.1.0-rc.8` ~ `0.1.1-rc.2`. Per-version declarations live in `package.json` under `dsh.compatibility`; the two-line mapping and monitoring mechanism are documented in [COMPATIBILITY.md](COMPATIBILITY.md). Node.js `^22.19.0 || >=24.0.0`.
|
|
237
237
|
- **Lifecycle**: no `preinstall` / `install` / `postinstall` / `prepare` (ready on install).
|
|
238
238
|
- **No impersonation**: adds only its own entry id `ui-usage-billing`; `@deepseek-ai/dsh-*` packages are `peerDependencies` only (no reinstall / replace / shadowing of official components); the package uses the third-party namespace `@kenz1117/*`.
|
|
239
239
|
- **Build artifacts**: runtime files `lib/*` and `cordis.patch.yml` are committed at the pinned commit and declared in `files`.
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
同类插件(cost-meter、usage-stats、dsh-bill 等)各有所长,本插件的定位差异如下:
|
|
44
44
|
|
|
45
|
-
- **价格来源是活的** — models.dev 实时目录 + 内置 24 厂商
|
|
45
|
+
- **价格来源是活的** — models.dev 实时目录 + 内置 24 厂商 77 款模型目录 + 设置面板自定义单价(可按中转站来源绑定同模型不同价),新模型无需等待手填价表。
|
|
46
46
|
- **历史永不重算** — 费用按事件发生时刻的价格计价,并按官方变更节点分段(8-17 前基础价 → 峰谷 v1 → 8-23 起周末全谷);安装前的历史用量从既有会话日志自动回填,价格调整不回写旧账。
|
|
47
47
|
- **不止「花了多少」,还答「花在哪」** — 输入按缓存命中/未命中分桶(含 reasoning)、官方/三方分桶、按工作区/会话/中转站下钻、每轮成本突增归因;还有同类少有的性能面板(各模型 TTFT 均值/P50/P90 与生成速度)。
|
|
48
48
|
- **订阅与余额闭环** — 7 家官方余额 + Coding Plan 额度 + 中转站余额与滚动额度窗口 + 自声明端点 + 官方余额变动与本地账本的交叉对账。
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@latest
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
- **DSH 0.1.0-rc.8 ~ 0.1.1-rc.2
|
|
113
|
+
- **DSH 0.1.0-rc.8 ~ 0.1.1-rc.2**(旧宿主,**该线已冻结**——`stable` 永久指向终版 v1.1.17,存量用户照常安装使用,但不再有新版本;冻结依据与正式停用时机见 [COMPATIBILITY.md](COMPATIBILITY.md)):
|
|
114
114
|
|
|
115
115
|
```sh
|
|
116
116
|
dsh plugin --profile web add npm:@kenz1117/dsh-ui-usage-billing@stable
|
|
@@ -165,17 +165,17 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
|
|
|
165
165
|
|
|
166
166
|
**自定义单价(设置 Tab,issue #16)**:结构化条目表(模型 + 可选来源 + 输入/缓存命中/输出 + 币种),不再手编 JSON。来源(中转站域名)留空 = 该模型默认价;填入中转站域名(如 `https://api.my-relay.com`)= 仅该来源的同名模型用此价(同名模型可同时存在默认价与多个来源价,互不覆盖)。显示层按「模型 × 来源」精确匹配重算,命中不到来源时回落该模型默认价,再无则用内置目录价。
|
|
167
167
|
|
|
168
|
-
### 支持模型(2026-
|
|
168
|
+
### 支持模型(2026-09 主流阵容,OpenAI 兼容系列,共 77 款)
|
|
169
169
|
|
|
170
170
|
完整目录见费率 Tab 及源码 `src/client/pricing.ts` 的 `MODEL_CATALOG`,此处每厂商仅列代表型号。
|
|
171
171
|
|
|
172
172
|
| 厂商 | 代表模型 |
|
|
173
173
|
| -------- | -------------------------------------------- |
|
|
174
|
-
| DeepSeek | V4 Flash、V4 Pro(等 3 款;按官方变更节点分段计价:基础价 → 峰谷 v1 → 周末全谷) |
|
|
175
|
-
| 智谱 AI | GLM-5.3、GLM-5.2(等
|
|
176
|
-
| 阿里通义 | Qwen3.8 Max、Qwen3-Coder 480B(等
|
|
174
|
+
| DeepSeek | V4.1 Flash、V4 Pro(等 3 款;按官方变更节点分段计价:基础价 → 峰谷 v1 → 周末全谷) |
|
|
175
|
+
| 智谱 AI | GLM-5.3、GLM-5.2(等 11 款) |
|
|
176
|
+
| 阿里通义 | Qwen3.8 Max、Qwen3-Coder 480B(等 8 款) |
|
|
177
177
|
| 字节豆包 | Doubao Seed-2.1 Pro、Doubao-Seed-Evolving(等 8 款) |
|
|
178
|
-
| 月之暗面 | Kimi K3、Kimi K2.7 Code(等
|
|
178
|
+
| 月之暗面 | Kimi K3、Kimi K2.7 Code(等 10 款) |
|
|
179
179
|
| 小米 | MiMo V2.5(等 2 款)¹ |
|
|
180
180
|
| MiniMax | MiniMax-M3、MiniMax-M2.7(等 3 款) |
|
|
181
181
|
| 百度文心 | ERNIE-5.1、ERNIE-4.5 300B(等 2 款) |
|
|
@@ -183,7 +183,7 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
|
|
|
183
183
|
| Anthropic | Claude Opus 4.6、Claude Sonnet 4.6(等 5 款) |
|
|
184
184
|
| Mistral AI | Mistral Large 3、Mistral Small 4(等 3 款) |
|
|
185
185
|
| Cohere | Command A、Command R(等 2 款) |
|
|
186
|
-
| OpenAI | GPT-5.6 Sol / Terra / Luna(等
|
|
186
|
+
| OpenAI | GPT-6 Astra、GPT-5.6 Sol / Terra / Luna(等 4 款) |
|
|
187
187
|
| Google | Gemini 3.1 Pro、Gemini 3.6 Flash(等 2 款) |
|
|
188
188
|
| xAI | Grok 4.6(等 2 款) |
|
|
189
189
|
| Meta | Llama 4 Maverick(等 2 款) |
|
|
@@ -246,7 +246,7 @@ npm publish --access public
|
|
|
246
246
|
|
|
247
247
|
- **权限等级:high**:读取持久会话日志(文件)、访问多厂商官方 / 订阅 / 余额 / 定价 API(网络)、经凭据 seam 读取 `apiKeyEnv`(凭据)、写入 `~/.dsh` 账本(持久状态);**不含**命令执行 / Shell。
|
|
248
248
|
- **更新通道:`user-reviewed`**:本插件具备文件 / 网络 / 凭据能力,DSH STORE 采用每次安装需本机人工确认的通道;安装前请复核仓库、固定 Commit、生命周期脚本与影响范围。
|
|
249
|
-
- **兼容范围**:预览线(npm `latest`/`alpha`,1.2.x,自 v1.2.0 起恒高于稳定线以消除版本号倒挂)适配 DSH `0.1.2` ~ `0.1.5` 系(宿主 `latest` 现指向 0.1.5-rc.1,已真机验证);稳定线(npm `stable`,1.1.x)适配旧宿主 `0.1.0-rc.8` ~ `0.1.1-rc.2`。逐版本声明见 `package.json` 的 `dsh.compatibility`,双线对照与监控机制见 [COMPATIBILITY.md](COMPATIBILITY.md)。Node.js `^22.19.0 || >=24.0.0`。
|
|
249
|
+
- **兼容范围**:预览线(npm `latest`/`alpha`,1.2.x,自 v1.2.0 起恒高于稳定线以消除版本号倒挂)适配 DSH `0.1.2` ~ `0.1.5` 系(宿主 `latest` 现指向 0.1.5-rc.1,已真机验证);稳定线(npm `stable`,1.1.x,**已冻结**,终版 v1.1.17)适配旧宿主 `0.1.0-rc.8` ~ `0.1.1-rc.2`。逐版本声明见 `package.json` 的 `dsh.compatibility`,双线对照与监控机制见 [COMPATIBILITY.md](COMPATIBILITY.md)。Node.js `^22.19.0 || >=24.0.0`。
|
|
250
250
|
- **生命周期**:无 `preinstall` / `install` / `postinstall` / `prepare`(安装即用)。
|
|
251
251
|
- **不冒用官方**:仅新增自有 entry id `ui-usage-billing`;对 `@deepseek-ai/dsh-*` 仅为 `peerDependencies` 依赖(不重复安装 / 不替换 / 不遮蔽官方组件),包名使用第三方命名空间 `@kenz1117/*`。
|
|
252
252
|
- **打包产物**:运行文件 `lib/*` 与 `cordis.patch.yml` 已随固定 Commit 提交并声明在 `files`。
|