@kenz1117/dsh-ui-usage-billing 0.9.5 → 0.9.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 +2 -1
- package/README.md +3 -1
- package/lib/client.js +1257 -641
- package/lib/index.js +565 -254
- package/lib/types/aggregate.d.ts +7 -0
- package/lib/types/balance.d.ts +5 -6
- package/lib/types/client/PerfPanel.d.ts +45 -0
- package/lib/types/client/PluginInfoCard.d.ts +12 -0
- package/lib/types/client/TokenPanel.d.ts +24 -0
- package/lib/types/client/UsageBilling.d.ts +107 -1
- package/lib/types/client/heatmap.d.ts +4 -2
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/client/plan-knowledge.d.ts +24 -5
- package/lib/types/client/plugin-info.d.ts +20 -0
- package/lib/types/client/usage-billing-settings.d.ts +20 -0
- package/lib/types/index.d.ts +4 -1
- package/lib/types/pricing-shared.d.ts +4 -2
- package/lib/types/resilience.d.ts +49 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|

|
|
45
45
|
- **Custom provider balance**: configure any HTTP endpoint for balance (`extract` supports constant / dot-path / add-subtract / divide, header `{{ENV}}` via the credentials seam); DeepSeek / Kimi / StepFun / SiliconFlow have built-in official balances, and the balance column estimates "≈N days" from the 7-day daily burn.
|
|
46
|
-
- **Real usage aggregation**: the server aggregates from session logs on demand (incremental cache recomputes only written sessions), with per-session corruption tolerance and snapshot fallback;
|
|
46
|
+
- **Real usage aggregation**: the server aggregates from session logs on demand (incremental cache recomputes only written sessions), with per-session corruption tolerance and snapshot fallback; an optional `usage_stats` tool lets the model query today / month spend (**off by default** — toggle it in the Settings tab; takes effect after a reload).
|
|
47
47
|
- **Multi-language + dual currency**: the ¥/$ switch is bilingual (USD→English, CNY→Chinese, this plugin only); the rate table converts to the selected currency.
|
|
48
48
|
- **Model health + uncatalogued annotation**: provider connection dots (green / red / grey); a model id not in the catalog is marked "uncatalogued" priced at the fallback, with provider inferred (e.g. `mi-mimo-2.5` → Xiaomi); estimated-price models are marked "estimated".
|
|
49
49
|
- **Session detail + cost spikes + heatmap**: sessions sorted by cost (title / project / calls / cost / last active); per-turn cost bars (last 40 turns, amount at bar top, peak/off-peak background bands, >2× spike flagged with attribution); a monthly calendar heatmap (5-color scale, hover detail).
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|

|
|
52
52
|
|
|
53
53
|
- **Export + offline self-contained**: the Stats tab exports daily / per-session CSV and full JSON; no chart library, no external CDN, pure design tokens.
|
|
54
|
+
- **Stability & reliability**: official-interface shape drift degrades with an explicit `invalid` status (distinct from network-unreachable); balance / subscription / pricing upstreams share a unified timeout budget, exponential-backoff retry and per-platform circuit-breaker cooldown; the stats snapshot is written with a `.bak` backup and auto-recovers from corruption; session-log reads re-check freshness to avoid half-line misreads; auth failures warn per provider with cooldown; the per-session fold cache is bounded by LRU to keep long-running memory stable.
|
|
54
55
|
|
|
55
56
|

|
|
56
57
|
|
package/README.md
CHANGED
|
@@ -43,15 +43,17 @@
|
|
|
43
43
|
|
|
44
44
|

|
|
45
45
|
- **自定义 Provider 余额**:配置任意 HTTP 端点查余额(`extract` 支持常量 / 点路径 / add-subtract / divide,请求头 `{{ENV}}` 经凭据 seam);DeepSeek / Kimi / 阶跃星辰 / 硅基流动内置官方余额,余额列按近 7 天日均折算「约可撑 N 天」。
|
|
46
|
-
-
|
|
46
|
+
- **真实用量聚合**:服务端从会话日志实时聚合(增量缓存只重算写过的会话),单会话损坏容错、快照落盘回退;内置 `usage_stats` 工具可让模型自查今天 / 本月花费(**默认关闭**,可在「设置」Tab 一键开关,重启应用后生效)。
|
|
47
47
|
- **多语种 + 双币种**:¥ / $ 切换随币种双语(USD→英文、CNY→中文,仅本插件生效);费率表按所选币种换算。
|
|
48
48
|
- **模型健康 + 未收录标注**:厂商接入状态圆点(绿 / 红 / 灰);模型 id 不在目录时标「未收录」按兜底价估算、厂商自动推断(如 `mi-mimo-2.5` → 小米);估算价模型标注「估算价」。
|
|
49
49
|
- **会话明细 + 成本突增 + 热力图**:按会话费用倒序(标题 / 项目 / 调用 / 费用 / 最后活跃);每轮费用柱状图(最近 40 轮、金额贴柱顶、峰谷背景分带、超 2 倍红标归因);月 / 年日历热力图(5 档色阶、悬停明细;年视图近 52 周、GitHub 风格),头部显示活跃天数 / 连续使用天数。
|
|
50
50
|
- **性能指标**:每个模型首字延时(TTFT)均值 / P50 / P90、生成速度(tokens/s)、总延迟均值,另按北京时间小时聚合 TTFT 与速度曲线;请求从头到首个内容 chunk 测 TTFT,工具续写步骤无独立请求头时以 step/start 估算并标 estimated。统计 Tab 渲染为按模型性能表 + 按小时 TTFT/速度双折线。
|
|
51
|
+
- **Token 统计洞察**:独立「Token」分区——每日 token 堆叠(未命中输入 / 缓存命中 / 输出,含 reasoning 思考),模型 token 总量与占比,结构 KPI(缓存命中率 / 思考占比 / 输入输出比 / 峰值日);按日 token CSV 与 JSON 导出。
|
|
51
52
|
|
|
52
53
|

|
|
53
54
|
|
|
54
55
|
- **数据导出 + 离线自包含**:统计 Tab 导出按日 / 按会话 CSV 与全量 JSON;无图表库、无外部 CDN、纯设计令牌。
|
|
56
|
+
- **系统稳定性与可靠性**:官方接口结构偏移自动降级告警(`invalid` 与网络不可达区分);余额 / 订阅 / 定价三类上游请求带统一超时预算、指数退避重试与每平台熔断冷却,避免瞬时故障反复打满轮询;统计快照写前 `.bak` 备份、损坏自动回退;会话日志读取前后校验变更避免半行误读;鉴权失败按 provider 分类冷却告警;每会话折叠缓存按 LRU 设上限,长期运行内存平稳。
|
|
55
57
|
- **插件信息卡**:设置 Tab 常驻「关于」卡——插件名、描述、作者(可跳 GitHub)、源码仓库、npm、许可证 MIT、版本号(服务端读自包 `package.json`,单一来源,发布自动正确)。
|
|
56
58
|
|
|
57
59
|

|