@kenz1117/dsh-ui-usage-billing 0.2.4 → 0.2.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.md +3 -2
- package/lib/client.js +80 -81
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ DeepSeek Harness 计费仪表盘插件。从持久化会话日志实时聚合模
|
|
|
13
13
|
- **计费仪表盘**:Hero 按 **当年 / 当月 / 当日** 三维展示费用,KPI 指标(缓存命中率 / Token 总量 / 单次平均成本 / 调用次数)、按模型分色的**堆叠趋势图**、按模型计费明细、可展开的单价表。
|
|
14
14
|
- **真实用量**:服务端从会话日志实时聚合,无需手工维护统计文件。
|
|
15
15
|
- **模型健康探测**:模型行的圆点反映各厂商接入状态(正常绿 / 异常红 / 未接入灰)。
|
|
16
|
-
- **订阅计划豁免**:走 coding/token
|
|
16
|
+
- **订阅计划豁免**:走 coding / token plan / opencode 订阅通道的模型照常统计 token、费用记 0(按**通道**判定,同一模型走按量通道时正常计费)。
|
|
17
17
|
- **余额查询**:模型计费明细按厂商显示「余额」列,DeepSeek 通过官方余额 API 实时查询;未配置 / Key 无效 / 服务不可达均有状态提示,扩展点可接更多厂商。
|
|
18
18
|
- **实时汇率与定价**:启动时自动拉取腾讯财经行情(USD→CNY)与 OpenRouter 官方模型价,失败自动降级内置默认值;此后每 6 小时自动刷新,单价表标注「今日汇率」与实时 / 内置徽标。
|
|
19
19
|
- **动态刷新**:侧边栏入口与仪表盘每 30 秒自动更新,无需重启或手动刷新。
|
|
@@ -87,6 +87,7 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
|
|
|
87
87
|
| 阿里通义 | Qwen3.8 Max、Qwen3.7-Max、Qwen3.5-Plus、Qwen3.5-Flash |
|
|
88
88
|
| 字节豆包 | Doubao Seed-2.0 Pro、Seed-2.0 Mini、Seed-1.6 |
|
|
89
89
|
| 月之暗面 | Kimi K3、K2.7 Code、K2.7 Code HighSpeed、K2.6 |
|
|
90
|
+
| 小米 | MiMo V2.5(走 token plan 订阅通道时豁免计费)¹ |
|
|
90
91
|
| MiniMax | MiniMax-M3 |
|
|
91
92
|
| 百度 | ERNIE-5.1 |
|
|
92
93
|
| 腾讯 | 混元 T1、混元 Hy3 |
|
|
@@ -101,7 +102,7 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
|
|
|
101
102
|
| Meta | Llama 4 Maverick、Scout |
|
|
102
103
|
| 其他 | 未收录模型的统一回退定价 |
|
|
103
104
|
|
|
104
|
-
> ¹
|
|
105
|
+
> ¹ 讯飞、商汤、小米未公布按量单价,表内为估算价;这些模型走订阅通道(coding / token plan / opencode)时费用记 0,正式定价公布后自动校准。订阅通道与 pi-ai 内置提供方对齐(kimi-coding、zai-coding-cn、opencode、opencode-go、qwen/xiaomi 的 token-plan 各区域变体),可按 `subscriptionProviders` 配置覆盖。
|
|
105
106
|
|
|
106
107
|
新增模型:在 `MODEL_CATALOG` 追加条目,并在 `src/aggregate.ts` 的 `MODEL_KEY_ALIASES` 中映射真实模型 id。
|
|
107
108
|
|
package/lib/client.js
CHANGED
|
@@ -33,93 +33,93 @@ window.__ModuleLoader__.load({
|
|
|
33
33
|
document.head.appendChild(tag);
|
|
34
34
|
}
|
|
35
35
|
var UsageBilling_module_css_default = {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"dashboardModal": "VWh0dG_dashboardModal",
|
|
39
|
-
"emptyRow": "VWh0dG_emptyRow",
|
|
36
|
+
"chartAxisLabel": "VWh0dG_chartAxisLabel",
|
|
37
|
+
"delta": "VWh0dG_delta",
|
|
40
38
|
"heroValue": "VWh0dG_heroValue",
|
|
41
|
-
"
|
|
39
|
+
"emptyRow": "VWh0dG_emptyRow",
|
|
42
40
|
"chartLegendBar": "VWh0dG_chartLegendBar",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"triggerAmountSub": "VWh0dG_triggerAmountSub",
|
|
47
|
-
"healthIdle": "VWh0dG_healthIdle",
|
|
41
|
+
"na": "VWh0dG_na",
|
|
42
|
+
"triggerIcon": "VWh0dG_triggerIcon",
|
|
43
|
+
"chartBar": "VWh0dG_chartBar",
|
|
48
44
|
"chartGrid": "VWh0dG_chartGrid",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
45
|
+
"kpiTile": "VWh0dG_kpiTile",
|
|
46
|
+
"dashboard": "VWh0dG_dashboard",
|
|
47
|
+
"heroSideLabel": "VWh0dG_heroSideLabel",
|
|
48
|
+
"triggerDivider": "VWh0dG_triggerDivider",
|
|
49
|
+
"dashboardModal": "VWh0dG_dashboardModal",
|
|
53
50
|
"heroSide": "VWh0dG_heroSide",
|
|
54
51
|
"chartDot": "VWh0dG_chartDot",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
52
|
+
"healthOk": "VWh0dG_healthOk",
|
|
53
|
+
"deltaUp": "VWh0dG_deltaUp",
|
|
54
|
+
"chartSvg": "VWh0dG_chartSvg",
|
|
55
|
+
"chartLegend": "VWh0dG_chartLegend",
|
|
56
|
+
"kpiGrid": "VWh0dG_kpiGrid",
|
|
59
57
|
"pricingChevron": "VWh0dG_pricingChevron",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"modelTable": "VWh0dG_modelTable",
|
|
64
|
-
"chartBar": "VWh0dG_chartBar",
|
|
65
|
-
"modelProvider": "VWh0dG_modelProvider",
|
|
66
|
-
"dashboardBody": "VWh0dG_dashboardBody",
|
|
67
|
-
"chartCrosshair": "VWh0dG_chartCrosshair",
|
|
68
|
-
"triggerAmount": "VWh0dG_triggerAmount",
|
|
69
|
-
"chartTooltip": "VWh0dG_chartTooltip",
|
|
70
|
-
"pricingToggleText": "VWh0dG_pricingToggleText",
|
|
71
|
-
"closeButton": "VWh0dG_closeButton",
|
|
58
|
+
"chartLegendLine": "VWh0dG_chartLegendLine",
|
|
59
|
+
"chartStack": "VWh0dG_chartStack",
|
|
60
|
+
"chartTooltipSwatch": "VWh0dG_chartTooltipSwatch",
|
|
72
61
|
"costCol": "VWh0dG_costCol",
|
|
73
|
-
"
|
|
74
|
-
"
|
|
62
|
+
"heroLabel": "VWh0dG_heroLabel",
|
|
63
|
+
"kpiValue": "VWh0dG_kpiValue",
|
|
75
64
|
"heroMain": "VWh0dG_heroMain",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
65
|
+
"triggerMonth": "VWh0dG_triggerMonth",
|
|
66
|
+
"rateBadge": "VWh0dG_rateBadge",
|
|
67
|
+
"rateBadgeBuiltin": "VWh0dG_rateBadgeBuiltin",
|
|
68
|
+
"heroSideValue": "VWh0dG_heroSideValue",
|
|
69
|
+
"dashboardSubtitle": "VWh0dG_dashboardSubtitle",
|
|
70
|
+
"dashboardHead": "VWh0dG_dashboardHead",
|
|
71
|
+
"panelHead": "VWh0dG_panelHead",
|
|
78
72
|
"kpiDetail": "VWh0dG_kpiDetail",
|
|
73
|
+
"trigger": "VWh0dG_trigger",
|
|
74
|
+
"chartWrap": "VWh0dG_chartWrap",
|
|
79
75
|
"pricingChevronOpen": "VWh0dG_pricingChevronOpen",
|
|
80
|
-
"dashboardTitle": "VWh0dG_dashboardTitle",
|
|
81
76
|
"healthDot": "VWh0dG_healthDot",
|
|
77
|
+
"triggerAmount": "VWh0dG_triggerAmount",
|
|
78
|
+
"healthBad": "VWh0dG_healthBad",
|
|
79
|
+
"healthBadgeBad": "VWh0dG_healthBadgeBad",
|
|
80
|
+
"heroSideItem": "VWh0dG_heroSideItem",
|
|
81
|
+
"kpiGreen": "VWh0dG_kpiGreen",
|
|
82
|
+
"panelTitle": "VWh0dG_panelTitle",
|
|
83
|
+
"modelName": "VWh0dG_modelName",
|
|
84
|
+
"rateBadgeLive": "VWh0dG_rateBadgeLive",
|
|
85
|
+
"chartLine": "VWh0dG_chartLine",
|
|
82
86
|
"planTag": "VWh0dG_planTag",
|
|
83
|
-
"
|
|
84
|
-
"pricingToggle": "VWh0dG_pricingToggle",
|
|
85
|
-
"triggerDivider": "VWh0dG_triggerDivider",
|
|
87
|
+
"heroMeta": "VWh0dG_heroMeta",
|
|
86
88
|
"panelHint": "VWh0dG_panelHint",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
89
|
+
"bandPrice": "VWh0dG_bandPrice",
|
|
90
|
+
"closeButton": "VWh0dG_closeButton",
|
|
91
|
+
"modelTable": "VWh0dG_modelTable",
|
|
92
|
+
"modelDot": "VWh0dG_modelDot",
|
|
93
|
+
"chartCrosshair": "VWh0dG_chartCrosshair",
|
|
94
|
+
"numCol": "VWh0dG_numCol",
|
|
95
|
+
"bandTagOff": "VWh0dG_bandTagOff",
|
|
96
|
+
"triggerMeta": "VWh0dG_triggerMeta",
|
|
97
|
+
"hero": "VWh0dG_hero",
|
|
98
|
+
"healthIdle": "VWh0dG_healthIdle",
|
|
99
|
+
"dashboardTitle": "VWh0dG_dashboardTitle",
|
|
100
|
+
"chartTooltipRow": "VWh0dG_chartTooltipRow",
|
|
101
|
+
"healthBadge": "VWh0dG_healthBadge",
|
|
102
|
+
"chartTooltipDate": "VWh0dG_chartTooltipDate",
|
|
90
103
|
"bandTag": "VWh0dG_bandTag",
|
|
91
|
-
"
|
|
104
|
+
"chartTooltip": "VWh0dG_chartTooltip",
|
|
105
|
+
"dashboardBody": "VWh0dG_dashboardBody",
|
|
92
106
|
"flatTag": "VWh0dG_flatTag",
|
|
93
|
-
"
|
|
94
|
-
"pricingTable": "VWh0dG_pricingTable",
|
|
107
|
+
"healthBadgeOk": "VWh0dG_healthBadgeOk",
|
|
95
108
|
"kpiLabel": "VWh0dG_kpiLabel",
|
|
96
|
-
"numCol": "VWh0dG_numCol",
|
|
97
109
|
"tableScroll": "VWh0dG_tableScroll",
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"rateBadgeBuiltin": "VWh0dG_rateBadgeBuiltin",
|
|
102
|
-
"kpiTile": "VWh0dG_kpiTile",
|
|
110
|
+
"pricingToggle": "VWh0dG_pricingToggle",
|
|
111
|
+
"pricingToggleText": "VWh0dG_pricingToggleText",
|
|
112
|
+
"chartEmpty": "VWh0dG_chartEmpty",
|
|
103
113
|
"panel": "VWh0dG_panel",
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"chartLine": "VWh0dG_chartLine",
|
|
108
|
-
"chartTooltipRow": "VWh0dG_chartTooltipRow",
|
|
109
|
-
"triggerMonth": "VWh0dG_triggerMonth",
|
|
110
|
-
"healthBadgeBad": "VWh0dG_healthBadgeBad",
|
|
114
|
+
"pricingTable": "VWh0dG_pricingTable",
|
|
115
|
+
"modelCell": "VWh0dG_modelCell",
|
|
116
|
+
"dashboardRight": "VWh0dG_dashboardRight",
|
|
111
117
|
"railButton": "VWh0dG_railButton",
|
|
112
|
-
"triggerIcon": "VWh0dG_triggerIcon",
|
|
113
|
-
"healthBadge": "VWh0dG_healthBadge",
|
|
114
|
-
"chartSvg": "VWh0dG_chartSvg",
|
|
115
|
-
"panelHead": "VWh0dG_panelHead",
|
|
116
|
-
"heroMeta": "VWh0dG_heroMeta",
|
|
117
|
-
"delta": "VWh0dG_delta",
|
|
118
|
-
"chartTooltipDate": "VWh0dG_chartTooltipDate",
|
|
119
118
|
"triggerToday": "VWh0dG_triggerToday",
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
119
|
+
"triggerAmountSub": "VWh0dG_triggerAmountSub",
|
|
120
|
+
"modelProvider": "VWh0dG_modelProvider",
|
|
121
|
+
"bandPriceOff": "VWh0dG_bandPriceOff",
|
|
122
|
+
"deltaDown": "VWh0dG_deltaDown"
|
|
123
123
|
};
|
|
124
124
|
/** 运行时实时覆盖:undefined = 用内置目录与内置汇率(默认值降级)。 */
|
|
125
125
|
let liveRate;
|
|
@@ -150,18 +150,6 @@ window.__ModuleLoader__.load({
|
|
|
150
150
|
/** Default share of traffic assumed to fall in the peak band (0..1). */
|
|
151
151
|
const DEFAULT_PEAK_SHARE = .5;
|
|
152
152
|
/**
|
|
153
|
-
* Model keys served through a subscription plan (e.g. a coding plan or topic
|
|
154
|
-
* plan) instead of metered per-token API billing. Usage through these routes
|
|
155
|
-
* costs no tokens: the estimator treats them as ¥0 and the billing table
|
|
156
|
-
* labels them 订阅包含. Add any model key your deployment serves through a
|
|
157
|
-
* plan here; leave empty when every route is pay-as-you-go.
|
|
158
|
-
*/
|
|
159
|
-
const SUBSCRIPTION_PLAN_KEYS = [];
|
|
160
|
-
/** Whether one stats model key is billed through a subscription plan. */
|
|
161
|
-
function isSubscriptionPlan(key) {
|
|
162
|
-
return SUBSCRIPTION_PLAN_KEYS.includes(key);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
153
|
* Built-in catalog of current mainstream models as of 2026-08-16, priced from
|
|
166
154
|
* each provider's official price page. Domestic providers are OpenAI-API
|
|
167
155
|
* compatible and publish RMB prices directly; overseas providers publish USD
|
|
@@ -381,6 +369,18 @@ window.__ModuleLoader__.load({
|
|
|
381
369
|
output: 100
|
|
382
370
|
}
|
|
383
371
|
},
|
|
372
|
+
{
|
|
373
|
+
key: "mimo-v2.5",
|
|
374
|
+
name: "MiMo V2.5",
|
|
375
|
+
provider: "小米",
|
|
376
|
+
colorVar: "dsw-static-green-400",
|
|
377
|
+
price: {
|
|
378
|
+
currency: "CNY",
|
|
379
|
+
input: 4,
|
|
380
|
+
cacheHit: .4,
|
|
381
|
+
output: 12
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
384
|
{
|
|
385
385
|
key: "minimax",
|
|
386
386
|
name: "MiniMax-M3",
|
|
@@ -677,7 +677,6 @@ window.__ModuleLoader__.load({
|
|
|
677
677
|
* @returns the estimated cost in CNY.
|
|
678
678
|
*/
|
|
679
679
|
function computeCost(entry, buckets, peakShare = DEFAULT_PEAK_SHARE) {
|
|
680
|
-
if (isSubscriptionPlan(entry.key)) return 0;
|
|
681
680
|
const peak = priceBandCost(entry.price, buckets, entry.price.currency);
|
|
682
681
|
const off = entry.price.offPeak === void 0 ? peak : priceBandCost(entry.price.offPeak, buckets, entry.price.currency);
|
|
683
682
|
return peak * peakShare + off * (1 - peakShare);
|
|
@@ -1326,7 +1325,7 @@ window.__ModuleLoader__.load({
|
|
|
1326
1325
|
output: data.output,
|
|
1327
1326
|
cacheHitRate: data.cacheHit + data.cacheMiss > 0 ? data.cacheHit / (data.cacheHit + data.cacheMiss) * 100 : 0,
|
|
1328
1327
|
estimated: computeCost(entry, buckets),
|
|
1329
|
-
plan:
|
|
1328
|
+
plan: data.plan === true,
|
|
1330
1329
|
...data.cost > 0 ? { actual: data.cost } : {}
|
|
1331
1330
|
};
|
|
1332
1331
|
}).sort((a, b) => (b.actual ?? b.estimated) - (a.actual ?? a.estimated)).map((row, index) => ({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenz1117/dsh-ui-usage-billing",
|
|
3
3
|
"description": "Usage billing dashboard for DeepSeek Harness: sidebar cost metrics plus a full dashboard modal, priced from a current multi-provider catalog with real usage aggregated from session logs.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.6",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|