@kenz1117/dsh-ui-usage-billing 1.4.4 → 1.4.6

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 CHANGED
@@ -103,7 +103,7 @@ The billing channel is detected from the current session's model: DeepSeek meter
103
103
 
104
104
  - **Real usage aggregation**: incremental server-side aggregation (only written sessions recompute), per-session corruption tolerance, snapshot fallback; the optional `usage_stats` tool queries today / month / current session / cumulative spend, plus `bySite` (relay-attributed) and `relay` (relay-only) summaries.
105
105
  - **Model health + uncatalogued annotation**: provider connection dots (green / red / grey); uncatalogued models are marked and priced at the fallback, with the provider inferred (e.g. `mi-mimo-2.5` → Xiaomi); estimated-price models are labeled "estimated".
106
- - **Multi-language + dual currency**: the ¥/$ switch is bilingual (USD→English, CNY→Chinese, this plugin only — it never leaks into the host UI); the rate table, the sidebar card and the composer capsule all convert to the selected currency, and the choice is persisted locally (it survives reopening the dashboard).
106
+ - **Multi-language + three currencies**: language (EN / 中) and currency (¥ CNY / $ USD / € EUR) switch **independently**, both plugin-only — neither leaks into the host UI. The rate table, the sidebar card and the composer capsule all convert to the selected currency, and both choices persist locally. On first upgrade the language is seeded once from the stored currency (“$” → English), so no existing user’s interface language changes silently.
107
107
  - **Security hardening**: every HTTP endpoint enforces loopback-only access via a dual check of the peer socket address and an exact Host-header match, rejecting `127.0.0.1.evil.com`-style DNS-rebinding names (reverse-proxy deployments can allow specific names with `trustedHosts`; the peer-socket check stays mandatory); write paths additionally validate a loopback Origin and Content-Type with a body-size cap against cross-site rewrites; balance / subscription / pricing fetches carry bounded retries with per-upstream circuit breaking (auth failures are config issues and do not trip the breaker).
108
108
  - **Export injection guard**: CSV cells starting with `=` / `+` / `-` / `@` get a leading single quote and full escaping, so they cannot execute as formulas in Excel / WPS.
109
109
  - **Privacy baseline**: a pure UI surface — registers no tools, injects no system prompt, writes no model-visible events; it only aggregates from existing session logs, whose content is owned by other packages.
@@ -170,11 +170,11 @@ cost (CNY) = (missInput × p_input + cacheHit × p_cacheHit + output × p_output
170
170
  | Provider | Models |
171
171
  | -------- | ------------------------------------------------------------------------------------------- |
172
172
  | DeepSeek | V4.1 Flash, V4 Pro (priced per official change boundary: base tier → peak/off-peak v1 → weekend off-peak) |
173
- | 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 |
174
- | Aliyun | Qwen3.8 Max, Qwen3.7-Max, Qwen3.5-Plus, Qwen3.5-Flash |
173
+ | Zhipu AI | GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, GLM-5-Turbo, GLM-4.7, GLM-4.6, GLM-4.5-Air, GLM-5V-Turbo |
174
+ | Aliyun | Qwen3.8 Max, Qwen3.7-Max, Qwen3.7-Plus, Qwen3.7-Flash, Qwen3.5-Plus, Qwen3.5-Flash, Qwen3-Coder 480B |
175
175
  | Doubao | Seed-2.0 Pro, Seed-2.0 Mini, Seed-1.6 |
176
176
  | Moonshot | Kimi K3, K2.7 Code, K2.7 Code HighSpeed, K2.6, K2.8 Preview |
177
- | Xiaomi | MiMo V2.5 (exempt when billed via a token-plan subscription channel)¹ |
177
+ | Xiaomi | MiMo V2.6 Pro, MiMo V2.6 Flash, MiMo V2.6 Pro UltraSpeed |
178
178
  | MiniMax | MiniMax-M3, MiniMax-M2.7, MiniMax-M2.7-highspeed |
179
179
  | Baidu | ERNIE-5.1 |
180
180
  | Tencent | Hunyuan T1, Hunyuan Hy3 |
@@ -185,13 +185,13 @@ cost (CNY) = (missInput × p_input + cacheHit × p_cacheHit + output × p_output
185
185
  | Baichuan | Baichuan M3-Plus |
186
186
  | OpenAI | GPT-6 Astra, GPT-5.6 Sol / Terra / Luna |
187
187
  | Google | Gemini 3.1 Pro, 3.6 Flash (Standard / Flex two-band, Flex = −50%) |
188
- | xAI | Grok 4.6, Grok 4.3 |
188
+ | xAI | Grok 4.7, Grok 4.6, Grok 4.3 |
189
189
  | Meta | Llama 4 Maverick, Scout |
190
190
  | Other | Unified fallback pricing for uncatalogued models |
191
191
 
192
- > ¹ iFlytek, SenseTime and Xiaomi have not published per-token prices — the table shows estimates; cost is 0 when these models go through a subscription channel (coding / token plan / opencode), and recalibrates automatically when official pricing is published. Subscription channels align with pi-ai built-in providers (kimi-coding, zai-coding-cn, opencode, opencode-go, qwen/xiaomi token-plan regional variants), overridable via `subscriptionProviders`.
192
+ > ¹ iFlytek and SenseTime have not published per-token prices — the table shows estimates; cost is 0 when these models go through a subscription channel (coding / token plan / opencode), and recalibrates automatically when official pricing is published. Subscription channels align with pi-ai built-in providers (kimi-coding, zai-coding-cn, opencode, opencode-go, qwen/xiaomi token-plan regional variants), overridable via `subscriptionProviders`.
193
193
 
194
- To add a model: append an entry to `MODEL_CATALOG` and map its real id in `MODEL_KEY_ALIASES` in `src/client/pricing.ts` (shared by the aggregation layer and the client renderer).
194
+ To add a model: append an entry to `BUILTIN_MODEL_CATALOG` in `src/builtin-catalog.ts` (key aliases live in `BUILTIN_MODEL_KEY_ALIASES` in the same file; the catalog is built only into the node half and served to the client from the host via `/api/billing/pricing`).
195
195
 
196
196
  ## 🔌 HTTP API
197
197
 
@@ -259,6 +259,8 @@ None. This plugin is a pure UI surface: it registers no tools, injects no system
259
259
 
260
260
  ## ❤️ Contributors
261
261
 
262
+ - [@lucagiftzek](https://github.com/lucagiftzek) — rate-table CSS polish (PR #59), `trustedHosts` reverse-proxy support (PR #60), currency preference persistence (PR #58), rate-table search (PR #67), peak/off-peak indicator dots with pin-to-composer (PR #68), and the EUR display currency with language decoupling (PR #70)
263
+ - [@hwangjunjie](https://github.com/hwangjunjie) — Tencent Cloud TokenHub / Token Plan subscription quota adaptation (`src/tc3.ts`), provider-first channel grouping with gateway badges, and the `routeAliases` / `modelKeyAliases` config (PR #35)
262
264
  - [@ciphoo](https://github.com/ciphoo) — MiniMax CN Token Plan quota support (PR #5), `minimax-cn` subscription key wiring (PR #12), a concurrent-ledger-write `MoveFileExW EPERM` fix on Windows (PR #11)
263
265
  - [@fabulousyuann-tech](https://github.com/fabulousyuann-tech) — durable ledger that retains usage after session deletion (PR #8)
264
266
  - [@hi-fangj](https://github.com/hi-fangj) — hover tooltip with the exact per-day token breakdown on the token daily chart (PR #21), the live-cost capsule toggle (PR #22), the per-model view and legend focus for the token daily chart (PR #23), and the per-model comparison curve in the perf panel (PR #24)
package/README.md CHANGED
@@ -53,7 +53,7 @@ DeepSeek / Kimi / 智谱 GLM / 腾讯云 TokenHub 等 7 家官方余额、Coding
53
53
  - 未收录模型显著标注「未收录」、绝不静默计 0;目录外模型配一条别名即完成识别与计价。
54
54
  - 可选的 `usage_stats` 工具让模型直接回答「今天花了多少」「哪个站点用得最多」。
55
55
  - 纯 UI surface:不注册工具、不注入系统提示、不写模型可见事件。
56
- - 中文 / English、¥ / ≈$ 双语双币切换;无图表库、无外部 CDN、离线自包含。
56
+ - 中文 / English 语言切换,¥ / ≈$ / ≈€ 币种切换(二者独立);无图表库、无外部 CDN、离线自包含。
57
57
 
58
58
  ## 📊 仪表盘
59
59
 
@@ -103,7 +103,7 @@ DeepSeek / Kimi / 智谱 GLM / 腾讯云 TokenHub 等 7 家官方余额、Coding
103
103
 
104
104
  - **真实用量聚合**:服务端增量聚合(只重算写过的会话),单会话损坏容错、快照落盘回退;`usage_stats` 工具让模型自查今天 / 本月 / 当前会话 / 累计费用,还可查 `bySite`(按站点归组)与 `relay`(只看中转站)汇总。
105
105
  - **模型健康 + 未收录标注**:厂商接入状态圆点(绿 / 红 / 灰);未收录模型显著标注、按兜底价估算、厂商自动推断(如 `mi-mimo-2.5` → 小米);估算价模型标注「估算价」。
106
- - **多语种 + 双币种**:¥ / $ 切换随币种双语(USD→英文、CNY→中文,仅本插件生效,不影响宿主全局 UI);费率表、侧边栏卡片与输入框胶囊均按所选币种换算,选择本地持久化(重开仪表盘仍保留)。
106
+ - **多语种 + 三币种**:语言(EN / 中)与币种(¥ CNY / $ USD / € EUR)**各自独立切换**,均仅本插件生效、不影响宿主全局 UI;费率表、侧边栏卡片与输入框胶囊均按所选币种换算,两项选择均本地持久化。老用户首次升级时语言由已存币种播种一次(选 $ 即英文),界面语言不会静默改变。
107
107
  - **安全加固**:全部 HTTP 端点强制回环访问——peer socket 地址 + Host 头精确匹配双重校验,拒绝 `127.0.0.1.evil.com` 形式的 DNS rebinding(反向代理部署可用 `trustedHosts` 显式放行特定主机名,peer socket 校验仍为强制);写操作额外校验 Origin 回环与 Content-Type 并限制 body 上限,杜绝跨站改写;余额 / 订阅 / 定价拉取带有限重试与按上游维度熔断(鉴权失败属配置问题、不计入熔断)。
108
108
  - **导出防注入**:CSV 对 `=` / `+` / `-` / `@` 开头单元格前置单引号并完整转义,防止在 Excel / WPS 中被当作公式执行。
109
109
  - **隐私底线**:纯 UI surface,不注册工具、不注入系统提示、不向会话日志写模型可见事件;仅从既有会话日志聚合,日志内容由其他包负责。
@@ -176,11 +176,11 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
176
176
  | 厂商 | 代表模型 |
177
177
  | -------- | -------------------------------------------- |
178
178
  | DeepSeek | V4.1 Flash、V4 Pro(等 3 款;按官方变更节点分段计价:基础价 → 峰谷 v1 → 周末全谷) |
179
- | 智谱 AI | GLM-5.3、GLM-5.2(等 11 款) |
180
- | 阿里通义 | Qwen3.8 Max、Qwen3-Coder 480B(等 8 款) |
179
+ | 智谱 AI | GLM-5.3、GLM-5.2(等 12 款) |
180
+ | 阿里通义 | Qwen3.8 Max、Qwen3-Coder 480B(等 10 款) |
181
181
  | 字节豆包 | Doubao Seed-2.1 Pro、Doubao-Seed-Evolving(等 8 款) |
182
182
  | 月之暗面 | Kimi K3、Kimi K2.7 Code(等 10 款) |
183
- | 小米 | MiMo V2.5(等 2 款)¹ |
183
+ | 小米 | MiMo V2.6 Pro(等 4 款) |
184
184
  | MiniMax | MiniMax-M3、MiniMax-M2.7(等 3 款) |
185
185
  | 百度文心 | ERNIE-5.1、ERNIE-4.5 300B(等 2 款) |
186
186
  | 腾讯混元 | 混元 T1、混元 Hy3(等 2 款) |
@@ -189,7 +189,7 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
189
189
  | Cohere | Command A、Command R(等 2 款) |
190
190
  | OpenAI | GPT-6 Astra、GPT-5.6 Sol / Terra / Luna(等 4 款) |
191
191
  | Google | Gemini 3.1 Pro、Gemini 3.6 Flash(等 2 款) |
192
- | xAI | Grok 4.6(等 2 款) |
192
+ | xAI | Grok 4.7(等 2 款) |
193
193
  | Meta | Llama 4 Maverick(等 2 款) |
194
194
  | 美团 | LongCat 2.0(估算价) |
195
195
  | 面壁智能 | MiniCPM-V 4.5(估算价) |
@@ -201,9 +201,9 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
201
201
  | 百川智能 | Baichuan M3-Plus |
202
202
  | 其他 | 未收录模型的统一回退定价(费用记 0) |
203
203
 
204
- > ¹ 讯飞、商汤、小米及美团 / 面壁智能 / 小红书等未公布官方按量单价的模型,表内为估算价(`estimated`);这些模型走订阅通道(coding / token plan / opencode)时费用记 0。订阅通道与 pi-ai 内置提供方对齐(kimi-coding、zai-coding-cn、opencode、opencode-go、qwen / xiaomi 的 token-plan 各区域变体),可按 `subscriptionProviders` 配置覆盖。
204
+ > ¹ 讯飞、商汤及美团 / 面壁智能 / 小红书等未公布官方按量单价的模型,表内为估算价(`estimated`);这些模型走订阅通道(coding / token plan / opencode)时费用记 0。订阅通道与 pi-ai 内置提供方对齐(kimi-coding、zai-coding-cn、opencode、opencode-go、qwen / xiaomi 的 token-plan 各区域变体),可按 `subscriptionProviders` 配置覆盖。
205
205
 
206
- 新增模型:在 `MODEL_CATALOG` 追加条目,并在 `src/client/pricing.ts` 的 `MODEL_KEY_ALIASES` 中映射真实模型 id(聚合层与客户端渲染共用同一张表)。
206
+ 新增模型:在 `src/builtin-catalog.ts` 的 `BUILTIN_MODEL_CATALOG` 追加条目(别名表 `BUILTIN_MODEL_KEY_ALIASES` 同文件维护;目录只随 node 半构建,经 `/api/billing/pricing` 由宿主下发注入客户端)。
207
207
 
208
208
  ## 🔌 HTTP API
209
209
 
@@ -273,6 +273,7 @@ npm publish --access public
273
273
 
274
274
  ## ❤️ Contributors
275
275
 
276
+ - [@lucagiftzek](https://github.com/lucagiftzek) — 费率表 CSS 修整(PR #59)、`trustedHosts` 反代支持(PR #60)、币种偏好持久化(PR #58)、费率表搜索(PR #67)、峰谷指示点与固定到输入框(PR #68)、EUR 展示币种与界面语言解耦(PR #70)
276
277
  - [@hwangjunjie](https://github.com/hwangjunjie) — 腾讯云 TokenHub / Token Plan 订阅额度适配(`src/tc3.ts`)、提供商优先通道分组与网关徽标、`routeAliases` / `modelKeyAliases` 配置(PR #35)
277
278
  - [@ciphoo](https://github.com/ciphoo) — MiniMax 国内域 Token Plan 订阅额度支持(PR #5)、`minimax-cn` 订阅凭据接线(PR #12)、Windows 下账本并发写入 `MoveFileExW EPERM` 修复(PR #11)
278
279
  - [@fabulousyuann-tech](https://github.com/fabulousyuann-tech) — 会话删除后用量保留的持久 ledger 功能(PR #8)