@kenz1117/dsh-ui-usage-billing 1.7.0 → 1.7.1
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 +17 -17
- package/README.md +18 -18
- package/lib/index.js +1806 -239
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -40,7 +40,7 @@ Most billing plugins stop at "token count × unit price". dsh-ui-usage-billing t
|
|
|
40
40
|
Usage is aggregated live from persisted session logs — never fabricated (an empty snapshot shows until real data arrives); daily official-balance deltas are cross-checked against the local ledger, and deviations beyond the threshold prompt a review — a bill that survives scrutiny.
|
|
41
41
|
|
|
42
42
|
### Live prices, history never rewritten
|
|
43
|
-
A live models.dev catalog + a built-in catalog of
|
|
43
|
+
A live models.dev catalog + a built-in catalog of 239 models across 25 vendors + user-defined prices in the settings panel (bindable per relay origin) mean new models never wait for a release; DeepSeek time-of-day prices are **segmented by official change boundaries** (base price before 08-17, weekend peak hours 08-17~08-23, weekend all-day off-peak from 08-23) and later price changes never rewrite old bills.
|
|
44
44
|
|
|
45
45
|
### Peak/off-peak aware, alerts follow the model
|
|
46
46
|
The billing channel is detected from the current session's model: DeepSeek metered uses time-of-day prices (weekday 9-12 / 14-18 peak ×2, weekend all-day off-peak), Zhipu Coding Plan uses credit windows (weekday 14-18 peak at full rate, off-peak at **50% of base credits**) — the channel layer is extensible for more providers; a popover / system notification fires automatically before each switch, and only sessions whose current model actually involves peak/off-peak get alerted or show the tier section — no watching the clock.
|
|
@@ -184,34 +184,34 @@ cost (CNY) = (missInput × p_input + cacheHit × p_cacheHit + output × p_output
|
|
|
184
184
|
|
|
185
185
|
`input` in the stats is total input (cacheHit + cacheMiss); estimation splits it into hit / miss to avoid double counting. Models with two-band billing are mixed by `DEFAULT_PEAK_SHARE` (default 0.5); weekends (Beijing Sat/Sun) are charged at the off-peak rate all day.
|
|
186
186
|
|
|
187
|
-
### Supported models (2026-10 lineup, OpenAI-compatible series,
|
|
187
|
+
### Supported models (2026-10 lineup, OpenAI-compatible series, 239 models)
|
|
188
188
|
|
|
189
|
-
The full catalog lives in the Rates tab and in `BUILTIN_MODEL_CATALOG` of `src/builtin-catalog.ts` (
|
|
189
|
+
The full catalog lives in the Rates tab and in `BUILTIN_MODEL_CATALOG` of `src/builtin-catalog.ts` (238 active + 1 retired model kept for historical repricing); representative models per vendor below.
|
|
190
190
|
|
|
191
191
|
| Provider | Representatives |
|
|
192
192
|
| -------- | -------------------------------------------- |
|
|
193
193
|
| DeepSeek | V4.1 Flash, V4 Pro (3 models; priced per official change boundary: base tier → peak/off-peak v1 → weekend off-peak) |
|
|
194
|
-
| Zhipu AI | GLM-5.3, GLM-5.2 (
|
|
195
|
-
| Aliyun | Qwen3.8 Max, Qwen3-Coder 480B (
|
|
196
|
-
| Doubao | Doubao Seed-2.1 Pro, Doubao Seed-2.0 Pro (
|
|
197
|
-
| Moonshot | Kimi K3, Kimi K2.7 Code (
|
|
198
|
-
| Xiaomi | MiMo V2.6 Pro (
|
|
199
|
-
| MiniMax | MiniMax-M3, MiniMax-M2.7 (
|
|
194
|
+
| Zhipu AI | GLM-5.3, GLM-5.2 (17 models) |
|
|
195
|
+
| Aliyun | Qwen3.8 Max, Qwen3-Coder 480B (27 models) |
|
|
196
|
+
| Doubao | Doubao Seed-2.1 Pro, Doubao Seed-2.0 Pro (13 models) |
|
|
197
|
+
| Moonshot | Kimi K3, Kimi K2.7 Code (16 models) |
|
|
198
|
+
| Xiaomi | MiMo V2.6 Pro (6 models) |
|
|
199
|
+
| MiniMax | MiniMax-M3, MiniMax-M2.7 (8 models) |
|
|
200
200
|
| Unisound | U2 Flash, Unisound U2 (3 models) |
|
|
201
201
|
| Baidu | ERNIE-5.1, ERNIE-4.5 300B (2 models) |
|
|
202
202
|
| Tencent | Hunyuan Hy3, Hunyuan T1 (3 models) |
|
|
203
|
-
| Anthropic | Claude Opus
|
|
204
|
-
| Mistral AI | Mistral Large 3, Mistral Small 4 (
|
|
205
|
-
| Cohere | Command A, Command R (
|
|
206
|
-
| OpenAI | GPT-6 Astra, GPT-5.6 Sol / Terra / Luna (
|
|
207
|
-
| Google | Gemini 3.1 Pro, Gemini 3.6 Flash (
|
|
208
|
-
| xAI | Grok 4.7, Grok 4.
|
|
209
|
-
| Meta | Llama 4 Maverick (
|
|
203
|
+
| Anthropic | Claude Opus 5, Claude Sonnet 5 (14 models) |
|
|
204
|
+
| Mistral AI | Mistral Large 3, Mistral Small 4 (30 models) |
|
|
205
|
+
| Cohere | Command A, Command R (7 models) |
|
|
206
|
+
| OpenAI | GPT-6 Astra, GPT-5.6 Sol / Terra / Luna (38 models) |
|
|
207
|
+
| Google | Gemini 3.1 Pro, Gemini 3.6 Flash (25 models) |
|
|
208
|
+
| xAI | Grok 4.7, Grok 4.20 (8 models) |
|
|
209
|
+
| Meta | Llama 4 Maverick, Muse Spark 1.3 (8 models) |
|
|
210
210
|
| Meituan | LongCat 2.0 (estimated) |
|
|
211
211
|
| ModelBest | MiniCPM-V 4.5 (estimated) |
|
|
212
212
|
| Xiaohongshu | Dots3-Note Preview (estimated) |
|
|
213
213
|
| 01.AI | Yi-Lightning |
|
|
214
|
-
| StepFun | Step 3.7 Flash |
|
|
214
|
+
| StepFun | Step 3.7 Flash, Step 5 Preview (3 models) |
|
|
215
215
|
| iFlytek | Spark 4.0 Ultra (plan-based)¹ |
|
|
216
216
|
| SenseTime | SenseNova 6.5 (beta)¹ |
|
|
217
217
|
| Baichuan | Baichuan M3-Plus |
|
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
用量从持久化会话日志实时聚合,绝不伪造样本(数据到达前显示空快照);官方余额当日变动与本地账本交叉对账,偏差超阈值主动提示核对——账单经得起质疑。
|
|
41
41
|
|
|
42
42
|
### 价格是活的,历史不重算
|
|
43
|
-
models.dev 实时目录 + 内置 25 厂商
|
|
43
|
+
models.dev 实时目录 + 内置 25 厂商 239 款模型 + 设置面板自定义单价(可按中转站绑定同模型不同价),新模型无需等发版;DeepSeek 分时价按官方变更节点**分段计价**(8-17 前基础价、8-17~8-23 周末计峰、8-23 起周末全谷),价格调整永不回写旧账。
|
|
44
44
|
|
|
45
45
|
### 峰谷全感知,提醒跟着模型走
|
|
46
46
|
计费通道按当前会话使用的模型自动识别:DeepSeek 按量走分时价(工作日 9-12 / 14-18 高峰 ×2、周末全天低谷),智谱 Coding Plan 走积分峰谷(工作日 14-18 高峰全额、非高峰**积分 5 折**),通道层可扩展、更多厂商逐步接入;切档前弹窗 / 系统通知自动提醒,且只有当前模型真正涉及峰谷才会提醒、费用条才显示档位——不用你盯时间表。
|
|
@@ -193,34 +193,34 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
|
|
|
193
193
|
|
|
194
194
|
**自定义单价(设置 Tab,issue #16)**:结构化条目表(模型 + 可选来源 + 输入/缓存命中/输出 + 币种),不再手编 JSON。来源(中转站域名)留空 = 该模型默认价;填入中转站域名(如 `https://api.my-relay.com`)= 仅该来源的同名模型用此价(同名模型可同时存在默认价与多个来源价,互不覆盖)。显示层按「模型 × 来源」精确匹配重算,命中不到来源时回落该模型默认价,再无则用内置目录价。
|
|
195
195
|
|
|
196
|
-
### 支持模型(2026-10 主流阵容,OpenAI 兼容系列,共
|
|
196
|
+
### 支持模型(2026-10 主流阵容,OpenAI 兼容系列,共 239 款)
|
|
197
197
|
|
|
198
|
-
完整目录见费率 Tab 及源码 `src/builtin-catalog.ts` 的 `BUILTIN_MODEL_CATALOG`(
|
|
198
|
+
完整目录见费率 Tab 及源码 `src/builtin-catalog.ts` 的 `BUILTIN_MODEL_CATALOG`(238 款在售 + 1 款退役型号保留历史回算),此处每厂商仅列代表型号。
|
|
199
199
|
|
|
200
200
|
| 厂商 | 代表模型 |
|
|
201
201
|
| -------- | -------------------------------------------- |
|
|
202
202
|
| DeepSeek | V4.1 Flash、V4 Pro(等 3 款;按官方变更节点分段计价:基础价 → 峰谷 v1 → 周末全谷) |
|
|
203
|
-
| 智谱 AI | GLM-5.3、GLM-5.2(等
|
|
204
|
-
| 阿里通义 | Qwen3.8 Max、Qwen3-Coder 480B(等
|
|
205
|
-
| 字节豆包 | Doubao Seed-2.1 Pro、Doubao Seed-2.0 Pro(等
|
|
206
|
-
| 月之暗面 | Kimi K3、Kimi K2.7 Code(等
|
|
207
|
-
| 小米 | MiMo V2.6 Pro(等
|
|
208
|
-
| MiniMax | MiniMax-M3、MiniMax-M2.7(等
|
|
203
|
+
| 智谱 AI | GLM-5.3、GLM-5.2(等 17 款) |
|
|
204
|
+
| 阿里通义 | Qwen3.8 Max、Qwen3-Coder 480B(等 27 款) |
|
|
205
|
+
| 字节豆包 | Doubao Seed-2.1 Pro、Doubao Seed-2.0 Pro(等 13 款) |
|
|
206
|
+
| 月之暗面 | Kimi K3、Kimi K2.7 Code(等 16 款) |
|
|
207
|
+
| 小米 | MiMo V2.6 Pro(等 6 款) |
|
|
208
|
+
| MiniMax | MiniMax-M3、MiniMax-M2.7(等 8 款) |
|
|
209
209
|
| 云知声 | U2 Flash、Unisound U2(等 3 款) |
|
|
210
210
|
| 百度文心 | ERNIE-5.1、ERNIE-4.5 300B(等 2 款) |
|
|
211
211
|
| 腾讯混元 | 混元 Hy3、混元 T1(等 3 款) |
|
|
212
|
-
| Anthropic | Claude Opus
|
|
213
|
-
| Mistral AI | Mistral Large 3、Mistral Small 4(等
|
|
214
|
-
| Cohere | Command A、Command R(等
|
|
215
|
-
| OpenAI | GPT-6 Astra、GPT-5.6 Sol / Terra / Luna(等
|
|
216
|
-
| Google | Gemini 3.1 Pro、Gemini 3.6 Flash(等
|
|
217
|
-
| xAI | Grok 4.7、Grok 4.
|
|
218
|
-
| Meta | Llama 4 Maverick(等
|
|
212
|
+
| Anthropic | Claude Opus 5、Claude Sonnet 5(等 14 款) |
|
|
213
|
+
| Mistral AI | Mistral Large 3、Mistral Small 4(等 30 款) |
|
|
214
|
+
| Cohere | Command A、Command R(等 7 款) |
|
|
215
|
+
| OpenAI | GPT-6 Astra、GPT-5.6 Sol / Terra / Luna(等 38 款) |
|
|
216
|
+
| Google | Gemini 3.1 Pro、Gemini 3.6 Flash(等 25 款) |
|
|
217
|
+
| xAI | Grok 4.7、Grok 4.20(等 8 款) |
|
|
218
|
+
| Meta | Llama 4 Maverick、Muse Spark 1.3(等 8 款) |
|
|
219
219
|
| 美团 | LongCat 2.0(估算价) |
|
|
220
220
|
| 面壁智能 | MiniCPM-V 4.5(估算价) |
|
|
221
221
|
| 小红书 | Dots3-Note Preview(估算价) |
|
|
222
222
|
| 零一万物 | Yi-Lightning |
|
|
223
|
-
| 阶跃星辰 | Step 3.7 Flash |
|
|
223
|
+
| 阶跃星辰 | Step 3.7 Flash、Step 5 Preview(等 3 款) |
|
|
224
224
|
| 科大讯飞 | Spark 4.0 Ultra(套餐制)¹ |
|
|
225
225
|
| 商汤 | SenseNova 6.5(公测中)¹ |
|
|
226
226
|
| 百川智能 | Baichuan M3-Plus |
|
|
@@ -228,7 +228,7 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
|
|
|
228
228
|
|
|
229
229
|
> ¹ 讯飞、商汤及美团 / 面壁智能 / 小红书等未公布官方按量单价的模型,表内为估算价(`estimated`);这些模型走订阅通道(coding / token plan / opencode)时费用记 0。订阅通道与 pi-ai 内置提供方对齐(kimi-coding、zai-coding-cn、opencode、opencode-go、qwen / xiaomi 的 token-plan 各区域变体),可按 `subscriptionProviders` 配置覆盖。
|
|
230
230
|
|
|
231
|
-
新增模型:在 `src/builtin-catalog.ts` 的 `BUILTIN_MODEL_CATALOG` 追加条目(别名表 `BUILTIN_MODEL_KEY_ALIASES` 同文件维护;目录只随 node 半构建,经 `/api/billing/pricing`
|
|
231
|
+
新增模型:在 `src/builtin-catalog.ts` 的 `BUILTIN_MODEL_CATALOG` 追加条目(别名表 `BUILTIN_MODEL_KEY_ALIASES` 同文件维护;目录只随 node 半构建,经 `/api/billing/pricing` 由宿主下发注入客户端)。**价源口径**:海外厂商取 models.dev 实时目录原生 USD;国内厂商优先取官方 CN 价(models.dev 的 `-cn` 目录),该目录缺项时按 USD 价 × 汇率折算并在条目注释标注。存量条目的价格更正走独立的调价节点,不与扩容混在一起。
|
|
232
232
|
|
|
233
233
|
## 🔌 HTTP API
|
|
234
234
|
|