@kenz1117/dsh-ui-usage-billing 1.0.18 → 1.0.19
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 +3 -13
- package/README.md +5 -15
- package/lib/client.js +5 -5
- package/lib/index.js +69 -9
- package/lib/types/aggregate.d.ts +10 -7
- package/lib/types/client/PerfPanel.d.ts +10 -8
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/client/pricing.d.ts +21 -0
- package/lib/types/client/usage-billing-settings.d.ts +20 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -21,16 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
-
> **Custom-price reliability + off-peak bands + Tencent TokenHub (v1.0.13, 2026-08-29)**: fixed the silent no-op of origin-bound (relay) custom prices — origins now compare after normalization (protocol optional, path stripped, case-insensitive), and a missing site grid falls back to the origin-bound price instead of keeping host cost; the model input gains a datalist of catalog keys and probed model ids. Custom prices accept optional off-peak bands (peak/off-peak blended 50/50). The balance table adds Tencent Cloud TokenHub token-plan quota (management API, TC3-signed; credential value `<SecretId>:<SecretKey>`).
|
|
25
|
-
|
|
26
|
-
> **Compatibility floor raised to DSH `0.1.2-alpha.1` (v1.0.12, 2026-08-29)**: the host removed `dsh-client-runtime` and other client-half dependencies in that release; the plugin fully migrated (`dsh-client-store` / `dsh-api-session-controller` / the new LLM remote surface). On older hosts (`0.1.0-rc.8` ~ `0.1.1-rc.2`) stay on v1.0.11.
|
|
27
|
-
|
|
28
|
-
> **Rate-table display update (2026-08-27)**: the models.dev supplement is **no longer rendered in full** — the rate table previously listed all ~5900 models from 158 gateway providers, drowning out the ones actually in use. The table now contains only the built-in catalog plus probed (configured and reachable) models. Billing is unaffected: models outside the catalog but priced on models.dev are still estimated at their official USD prices when hit; they just no longer appear in the table.
|
|
29
|
-
|
|
30
|
-
> **Qwen family pricing update (2026-08-27)**: aligned with the latest Alibaba Cloud Model Studio list prices — **Qwen3.7-Max** corrected to official list price (input ¥12 / explicit-cache hit ¥1.2 / output ¥36, previously recorded at the discounted promo rate). The current official 50%-off promotion has **no announced end date**: the rate table shows the discounted price with a red promo badge (hover for details), and resumes list-price display once an end date is filled in after the announcement. The Qwen family also gains **supplementary pricing reference rows** (Batch File standing half-price tier, Batch Chat, explicit-cache create/hit — display-only, excluded from estimation); Qwen3-Coder Plus officially does not support batch inference, so only the explicit-cache rows are listed.
|
|
31
|
-
|
|
32
|
-
> **Peak/off-peak pricing update (from 2026-08-23 (Sun) 00:00 Beijing)**: DeepSeek models follow the new official rule — **weekdays (Mon–Fri)** keep the original peak/off-peak split (peak 09:00–12:00 / 14:00–18:00, ×2); **weekends (Sat/Sun)** are no longer split and are billed at the **off-peak price** all day. The plugin's billing engine, rate table and per-turn peak/off-peak bands all reflect this.
|
|
33
|
-
|
|
34
24
|
<div align="center">
|
|
35
25
|
<img src="screenshots/demo.png" alt="dsh-ui-usage-billing — billing dashboard overview" width="80%">
|
|
36
26
|
</div>
|
|
@@ -44,7 +34,7 @@
|
|
|
44
34
|
- **Real usage, no fabricated samples** — the server aggregates from persisted session logs and estimates against live multi-provider official prices; it shows an empty snapshot until real data arrives.
|
|
45
35
|
- **Everything on one screen** — a sidebar trigger card plus a full dashboard (Overview / Trends / Providers / Stats / Rates / Settings) across six tabs: month / today / projection / heatmap / trend.
|
|
46
36
|
- **Subscriptions · balance · quota · reconcile** — plan quota, multi-provider balance, relay-station quota, declared endpoints and balance-delta reconciliation form a cross-verifiable billing loop.
|
|
47
|
-
- **Peak/off-peak pricing + switch alerts** — weekday peak split and weekend all-day off-peak, with a popover / system notification before a tier switch, configurable lead time.
|
|
37
|
+
- **Peak/off-peak pricing + switch alerts** — weekday peak split and weekend all-day off-peak, **priced per official change boundary** (base price before 08-17, weekend peak hours 08-17~08-23, weekend all-day off-peak from 08-23), with a popover / system notification before a tier switch, configurable lead time.
|
|
48
38
|
- **Offline & self-contained** — no chart library, no external CDN, pure design tokens; lightweight and ready to use.
|
|
49
39
|
- **Multi-language + dual currency** — Chinese / English, ¥/$ toggle that only affects this plugin.
|
|
50
40
|
|
|
@@ -80,7 +70,7 @@
|
|
|
80
70
|
## 📈 Usage visualizations
|
|
81
71
|
|
|
82
72
|
- **Session detail + cost spikes + heatmap**: sessions sorted by cost (title / project / calls / cost / last active); per-turn cost bars (peak/off-peak background bands, >2× spike flagged with attribution); month / year calendar heatmap (5-color scale, hover detail; the year view is ~52 weeks, GitHub-style), with active-day and streak counts on top.
|
|
83
|
-
- **Performance metrics**: per-model first-token latency (TTFT) mean / P50 / P90, generation speed (tokens/s), total-latency mean
|
|
73
|
+
- **Performance metrics**: per-model first-token latency (TTFT) mean / P50 / P90, generation speed (tokens/s), total-latency mean; per-hour × per-model comparison curve — metric tabs (TTFT / tok/s), clickable model chips (top-5 by samples lit by default, one-click select-all), hover snapping to the nearest hour with a crosshair and per-model tooltip, broken lines for missing-sample hours (never fabricated); view preferences persist locally.
|
|
84
74
|
- **Token insights**: a dedicated "Tokens" tab — the daily token chart switches between two views: "Structure" stacks "input (cache miss) / input (cache hit) / output" (including reasoning), while "By model" stacks each day by model (same per-model colors as the trends tab; the toggle hides itself when the snapshot carries no per-day-per-model detail); the hover tooltip shows the day's exact breakdown (per-bucket in structure view, per-model "hit / miss / output" in model view, thousand-separated); clicking a legend swatch or a model-table row focuses that model (other segments dim, y-axis unchanged, click again to release); per-model totals and share, structural KPIs (cache-hit rate / reasoning share / input-output ratio / peak day); per-day token CSV and JSON export (JSON includes the per-day-per-model detail).
|
|
85
75
|
|
|
86
76
|

|
|
@@ -154,7 +144,7 @@ cost (CNY) = (missInput × p_input + cacheHit × p_cacheHit + output × p_output
|
|
|
154
144
|
|
|
155
145
|
| Provider | Models |
|
|
156
146
|
| -------- | ------------------------------------------------------------------------------------------- |
|
|
157
|
-
| DeepSeek | V4 Flash, V4 Flash Vision (Exp), V4 Pro (
|
|
147
|
+
| DeepSeek | V4 Flash, V4 Flash Vision (Exp), V4 Pro (priced per official change boundary: base tier → peak/off-peak v1 → weekend off-peak) |
|
|
158
148
|
| 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 |
|
|
159
149
|
| Aliyun | Qwen3.8 Max, Qwen3.7-Max, Qwen3.5-Plus, Qwen3.5-Flash |
|
|
160
150
|
| Doubao | Seed-2.0 Pro, Seed-2.0 Mini, Seed-1.6 |
|
package/README.md
CHANGED
|
@@ -21,16 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
-
> **自定义单价可靠性 + 峰谷价 + 腾讯云 TokenHub(v1.0.13,2026-08-29)**:修复带「来源(中转站)」的自定义价静默失效——来源现按规范化 origin(补协议 / 去路径 / 忽略大小写)宽松比对,三维站点数据缺失时回落为该价重估;模型输入新增下拉候选(目录键 + 探活模型 id)。自定义价新增可选「低谷价」三栏(峰/谷 50% 比例混合估算)。余额表接入腾讯云 TokenHub Token Plan 余量(云 API 管控面 TC3 签名,凭据填 `<SecretId>:<SecretKey>`)。
|
|
25
|
-
|
|
26
|
-
> **兼容底线提升至 DSH `0.1.2-alpha.1`(v1.0.12,2026-08-29)**:宿主在该版本移除了 `dsh-client-runtime` 等客户端半区依赖,插件已完整迁移(`dsh-client-store` / `dsh-api-session-controller` / 新 LLM Remote 面);旧宿主(`0.1.0-rc.8` ~ `0.1.1-rc.2`)请停留在 v1.0.11。
|
|
27
|
-
|
|
28
|
-
> **费率表展示规则更新(2026-08-27)**:models.dev 聚合的补充价目**不再整表渲染**——此前费率表会把 158 个网关厂商的全部约 5900 个模型一并铺出,淹没实际在用的条目;现在表格只包含内置目录与系统探活命中的模型。计费能力不受影响:目录外但 models.dev 有价的模型命中时仍按其官方 USD 价正常估算,只是不再出现在表格里。
|
|
29
|
-
|
|
30
|
-
> **千问(Qwen)系列价格更新(2026-08-27)**:对齐阿里云百炼最新官方刊例——**Qwen3.7-Max** 更正为官方原价(输入 ¥12 / 显式缓存命中 ¥1.2 / 输出 ¥36,此前误录活动折后价),当前官方限时 5 折且**未公布截止时间**,费率表按折后价显示并挂红色促销徽章(悬停提示活动性质),公告截止后补填日期即自动恢复原价展示;Qwen 全系补充**附加计价参考行**(Batch File 长期半价档、Batch Chat、显式缓存创建/命中,纯展示不参与估算计费);Qwen3-Coder Plus 官方明确不支持批量推理,仅列显式缓存两行。
|
|
31
|
-
|
|
32
|
-
> **峰谷计费规则更新(自 2026-08-23(周日)00:00 起)**:DeepSeek 模型按官方新规计费——**工作日(周一至周五)** 继续执行原峰谷分段计费(高峰 09:00–12:00 / 14:00–18:00,×2);**周末(周六、周日)** 全天不再区分峰谷时段,统一按**低谷价**计费。插件计费引擎、费率表与每轮费用峰谷分带均已同步生效。
|
|
33
|
-
|
|
34
24
|
<div align="center">
|
|
35
25
|
<img src="screenshots/demo.png" alt="dsh-ui-usage-billing — 计费仪表盘总览" width="80%">
|
|
36
26
|
</div>
|
|
@@ -42,9 +32,9 @@
|
|
|
42
32
|
## ✨ 核心亮点
|
|
43
33
|
|
|
44
34
|
- **真实用量,不伪造样本** — 服务端从持久化会话日志实时聚合,按实时多厂商官方价估算;数据到达前显示空快照,绝不展示假数据。
|
|
45
|
-
- **一屏看懂一切** — 侧边栏触发卡 + 全屏仪表盘(概览 /
|
|
35
|
+
- **一屏看懂一切** — 侧边栏触发卡 + 全屏仪表盘(概览 / Token / 用量 / 趋势 / 费率 / 设置)六区,本月/今日/预计/热力图/趋势全在。
|
|
46
36
|
- **订阅 · 余额 · 额度 · 对账** — 订阅套餐额度、多厂商余额、中转站额度、声明端点、余额差对账,形成可交叉验证的计费闭环。
|
|
47
|
-
- **峰谷计价 + 切换提醒** —
|
|
37
|
+
- **峰谷计价 + 切换提醒** — 工作日峰谷分时、周末全天低谷,**按官方变更节点分段计价**(8-17 前基础价、8-17~8-23 周末计峰、8-23 起周末全谷),切档前弹窗/系统通知,提前量可配。
|
|
48
38
|
- **离线自包含** — 无图表库、无外部 CDN、纯设计令牌;依赖极轻,随装随用。
|
|
49
39
|
- **多语种 + 双币种** — 中文/English、¥/≈$ 切换,只对本插件生效。
|
|
50
40
|
|
|
@@ -60,7 +50,7 @@
|
|
|
60
50
|
|
|
61
51
|
## 💰 计费引擎
|
|
62
52
|
|
|
63
|
-
- **实时定价费率表**:models.dev 抓价 + 探活模型对标——系统实际配置模型全纳入;峰谷分时(工作日 9-12 / 14-18 高峰 ×2
|
|
53
|
+
- **实时定价费率表**:models.dev 抓价 + 探活模型对标——系统实际配置模型全纳入;峰谷分时(工作日 9-12 / 14-18 高峰 ×2,周末全天低谷;历史费用按官方变更节点分段计价,见下方「计费细节」)+ 实时汇率(USD→CNY),每 6 小时刷新。
|
|
64
54
|
- **自定义单价**:设置面板为未收录或变价模型填入实付价(未命中 / 缓存命中 / 输出,可选 USD 与低谷价三栏),总览与日趋势按用户价重估显示;支持按中转站来源绑定同模型不同价(origin 规范化宽松匹配),目录外模型填价即生效。
|
|
65
55
|
|
|
66
56
|

|
|
@@ -81,7 +71,7 @@
|
|
|
81
71
|
## 📈 用量可视化
|
|
82
72
|
|
|
83
73
|
- **会话明细 + 成本突增 + 热力图**:按会话费用倒序(标题 / 项目 / 调用 / 费用 / 最后活跃);每轮费用柱状图(峰谷背景分带、超 2 倍红标归因);月 / 年日历热力图(5 档色阶、悬停明细;年视图近 52 周、GitHub 风格),头部显示活跃天数 / 连续使用天数。
|
|
84
|
-
- **性能指标**:每个模型首字延时(TTFT)均值 / P50 / P90、生成速度(tokens/s
|
|
74
|
+
- **性能指标**:每个模型首字延时(TTFT)均值 / P50 / P90、生成速度(tokens/s)、总延迟均值;按小时×模型对比曲线——指标 tab 切换(首字延时 / 生成速度),模型 chip 点击开/关曲线(默认点亮样本数前 5,全选一键),悬停吸附最近小时显示十字线与逐模型数值,缺失样本小时断线不造假;视图偏好本地持久化。
|
|
85
75
|
- **Token 统计洞察**:独立「Token」分区——每日 token 堆叠双视角切换:「按结构」按「输入(缓存未命中)/ 输入(缓存命中)/ 输出」三桶分色(含 reasoning 思考),「按模型」每天按模型堆叠(分色与趋势页一致,旧快照缺按日×模型明细时自动隐藏切换);悬停柱状图显示当日精确明细(结构视角给三桶逐项,模型视角给逐模型「命中/未命中/输出」,千分位不缩写);点击图例色块或模型 Token 表行可聚焦单个模型(其余段弱化、y 轴不变,再点解除),模型 token 总量与占比,结构 KPI(缓存命中率 / 思考占比 / 输入输出比 / 峰值日);按日 token CSV 与 JSON 导出(JSON 含按日×模型明细)。
|
|
86
76
|
|
|
87
77
|

|
|
@@ -161,7 +151,7 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
|
|
|
161
151
|
|
|
162
152
|
| 厂商 | 代表模型 |
|
|
163
153
|
| -------- | -------------------------------------------- |
|
|
164
|
-
| DeepSeek | V4 Flash、V4 Pro(等 3
|
|
154
|
+
| DeepSeek | V4 Flash、V4 Pro(等 3 款;按官方变更节点分段计价:基础价 → 峰谷 v1 → 周末全谷) |
|
|
165
155
|
| 智谱 AI | GLM-5.3、GLM-5.2(等 10 款) |
|
|
166
156
|
| 阿里通义 | Qwen3.8 Max、Qwen3-Coder 480B(等 7 款) |
|
|
167
157
|
| 字节豆包 | Doubao Seed-2.1 Pro、Doubao-Seed-Evolving(等 8 款) |
|