@kenz1117/dsh-ui-usage-billing 0.4.1 → 0.4.2

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 CHANGED
@@ -18,7 +18,7 @@ DeepSeek Harness 计费仪表盘插件。从持久化会话日志实时聚合模
18
18
  - **真实用量**:服务端从会话日志实时聚合,无需手工维护统计文件;增量缓存保证只有写过的日志会被重新折叠,重度使用下轮询依然轻量。
19
19
  - **模型健康探测**:模型行的圆点反映各厂商接入状态(正常绿 / 异常红 / 未接入灰)。
20
20
  - **订阅计划豁免**:走 coding / token plan / opencode 订阅通道的模型照常统计 token、费用记 0(按**通道**判定,同一模型走按量通道时正常计费)。
21
- - **余额查询**:厂商组头部显示该厂商余额(只显示一次,不再随每行重复)。DeepSeek 用官方余额 API、月之暗面(Kimi)用 Moonshot 余额接口**实时查询**;API Key 复用 `llm-pi-ai` 设置的 `apiKeyEnv`(DeepSeek 另有 `balanceApiKeyEnv` 特例),未配置 / Key 无效 / 服务不可达均有状态提示,扩展点可接更多厂商。
21
+ - **余额查询**:厂商组头部显示该厂商余额(只显示一次,不再随每行重复)。DeepSeek、月之暗面(Kimi)、阶跃星辰(StepFun)用官方余额接口**实时查询**;API Key 复用 `llm-pi-ai` 设置的 `apiKeyEnv`(DeepSeek 另有 `balanceApiKeyEnv` 特例),未配置 / Key 无效 / 服务不可达均有状态提示,扩展点可接更多厂商。
22
22
  - **可用天数估算**:余额列按最近 7 天日均消耗折算「约可撑 N 天」,剩余不足 3 天红色强调。
23
23
  - **余额不足告警**:任一厂商余额(折算人民币)低于阈值时每天弹一次系统通知;阈值经宿主配置 `lowBalanceThreshold`(人民币元)下发,未配置默认 50 元。
24
24
  - **未收录模型标注**:真实模型 id 不在计费目录时,明细行显示真实 id 并标注「未收录」,费用按兜底档估算;厂商可从模型 id 自动推断(如 `mi-mimo-2.5` → 小米),健康圆点据此点亮。
@@ -164,6 +164,14 @@ cost(CNY)= (missInput × p_input + cacheHit × p_cacheHit + output × p_outp
164
164
  "totalBalance": 49.59,
165
165
  "grantedBalance": 46.59,
166
166
  "toppedUpBalance": 3.0
167
+ },
168
+ {
169
+ "provider": "阶跃星辰",
170
+ "displayName": "阶跃星辰",
171
+ "currency": "CNY",
172
+ "totalBalance": 150.0,
173
+ "toppedUpBalance": 200.0,
174
+ "grantedBalance": 50.0
167
175
  }
168
176
  ]
169
177
  }
@@ -242,7 +250,7 @@ npm publish --access public
242
250
 
243
251
  ## Known Limitations and Deferred Work
244
252
 
245
- - **余额查询已接入 DeepSeek / 月之暗面(Kimi)**:其他厂商因无公开余额 API 或需非 Bearer 鉴权,暂显示「未配置」;扩展点在 `src/balance.ts`(按厂商余额 API 增加查询器)。
253
+ - **余额查询已接入 DeepSeek / 月之暗面(Kimi)/ 阶跃星辰(StepFun)**:这三家用标准 Bearer API key 即可查询。其余厂商因无公开余额接口或需非 Bearer 鉴权(小米 MiMo 走控制台 Cookie、商汤走 AccessKey 签名、MiniMax/字节豆包走额度制或 AK/SK),暂显示「未配置」;扩展点在 `src/balance.ts`(按厂商余额 API 增加查询器)。
246
254
  - **超支通知依赖浏览器 Notification**:权限被拒绝或平台不支持时只有界面红色脉冲兜底,没有宿主级通知通道;通知上限为每天一次。
247
255
  - **会话明细不可跳转**:点击会话行不会打开对应会话(跨插件导航需要宿主会话选择通道);会话数封顶 100 行、面板只显示前 20 行。
248
256
  - **费用为目录价估算**:讯飞 / 商汤 / 小米等未公布按量单价的模型使用估算价(特性表脚注 ¹),正式定价以厂商账单为准。
package/lib/client.js CHANGED
@@ -34,160 +34,160 @@ window.__ModuleLoader__.load({
34
34
  document.head.appendChild(tag);
35
35
  }
36
36
  var UsageBilling_module_css_default = {
37
- "budgetInputWrap": "VWh0dG_budgetInputWrap",
38
- "roundsBarLabel": "VWh0dG_roundsBarLabel",
39
- "heatmapLegend": "VWh0dG_heatmapLegend",
40
- "triggerIcon": "VWh0dG_triggerIcon",
41
- "chartLegendBar": "VWh0dG_chartLegendBar",
37
+ "rateBadge": "VWh0dG_rateBadge",
38
+ "balanceCell": "VWh0dG_balanceCell",
39
+ "healthOk": "VWh0dG_healthOk",
40
+ "railButton": "VWh0dG_railButton",
41
+ "trendPanel": "VWh0dG_trendPanel",
42
42
  "pricingChevron": "VWh0dG_pricingChevron",
43
- "heatmapGrid": "VWh0dG_heatmapGrid",
44
- "heroLabel": "VWh0dG_heroLabel",
45
- "headTitleRow": "VWh0dG_headTitleRow",
43
+ "dashboardTitle": "VWh0dG_dashboardTitle",
44
+ "modelProvider": "VWh0dG_modelProvider",
45
+ "bandPrice": "VWh0dG_bandPrice",
46
+ "triggerToday": "VWh0dG_triggerToday",
47
+ "panelTitle": "VWh0dG_panelTitle",
48
+ "modelName": "VWh0dG_modelName",
49
+ "triggerDivider": "VWh0dG_triggerDivider",
50
+ "kpiGreen": "VWh0dG_kpiGreen",
51
+ "switchOn": "VWh0dG_switchOn",
52
+ "chartEmpty": "VWh0dG_chartEmpty",
53
+ "subscriptionReset": "VWh0dG_subscriptionReset",
54
+ "costCol": "VWh0dG_costCol",
55
+ "budgetLabel": "VWh0dG_budgetLabel",
56
+ "roundsFlagBadge": "VWh0dG_roundsFlagBadge",
57
+ "budgetUnit": "VWh0dG_budgetUnit",
58
+ "budgetInput": "VWh0dG_budgetInput",
46
59
  "subscriptionWindow": "VWh0dG_subscriptionWindow",
47
- "modelDot": "VWh0dG_modelDot",
48
- "healthBadgeOk": "VWh0dG_healthBadgeOk",
49
- "providerGroupList": "VWh0dG_providerGroupList",
50
- "subscriptionPlan": "VWh0dG_subscriptionPlan",
51
- "bandPriceOff": "VWh0dG_bandPriceOff",
52
- "triggerMonth": "VWh0dG_triggerMonth",
53
- "dashboardSubtitle": "VWh0dG_dashboardSubtitle",
54
- "rounds": "VWh0dG_rounds",
55
- "bandTag": "VWh0dG_bandTag",
56
- "panelHead": "VWh0dG_panelHead",
57
- "rateBadge": "VWh0dG_rateBadge",
58
- "heroMain": "VWh0dG_heroMain",
59
- "chartWrap": "VWh0dG_chartWrap",
60
+ "heroSideItem": "VWh0dG_heroSideItem",
61
+ "subscriptionHead": "VWh0dG_subscriptionHead",
62
+ "roundsBarFlagged": "VWh0dG_roundsBarFlagged",
63
+ "currencyButton": "VWh0dG_currencyButton",
64
+ "rangeButtonActive": "VWh0dG_rangeButtonActive",
65
+ "heatmapCell": "VWh0dG_heatmapCell",
66
+ "chartSvg": "VWh0dG_chartSvg",
67
+ "roundsBarWrap": "VWh0dG_roundsBarWrap",
68
+ "providerGroupTitle": "VWh0dG_providerGroupTitle",
69
+ "chartTooltipSwatch": "VWh0dG_chartTooltipSwatch",
70
+ "budgetFill": "VWh0dG_budgetFill",
71
+ "chartStack": "VWh0dG_chartStack",
72
+ "currencyToggle": "VWh0dG_currencyToggle",
60
73
  "subscriptionGrid": "VWh0dG_subscriptionGrid",
61
- "switchKnob": "VWh0dG_switchKnob",
62
- "bandTagOff": "VWh0dG_bandTagOff",
74
+ "pricingToggle": "VWh0dG_pricingToggle",
75
+ "chartLegendBar": "VWh0dG_chartLegendBar",
76
+ "balanceDaysLow": "VWh0dG_balanceDaysLow",
63
77
  "modelTable": "VWh0dG_modelTable",
64
- "providerGroupBalanceLabel": "VWh0dG_providerGroupBalanceLabel",
65
- "currencyButton": "VWh0dG_currencyButton",
78
+ "dashboardBody": "VWh0dG_dashboardBody",
79
+ "roundsAxis": "VWh0dG_roundsAxis",
80
+ "dashboardSubtitle": "VWh0dG_dashboardSubtitle",
81
+ "trigger": "VWh0dG_trigger",
82
+ "chartBar": "VWh0dG_chartBar",
83
+ "chartLine": "VWh0dG_chartLine",
84
+ "roundsFlagMark": "VWh0dG_roundsFlagMark",
85
+ "kpiGrid": "VWh0dG_kpiGrid",
86
+ "modelTableScroll": "VWh0dG_modelTableScroll",
87
+ "bandTagOff": "VWh0dG_bandTagOff",
88
+ "closeButton": "VWh0dG_closeButton",
89
+ "headTitleRow": "VWh0dG_headTitleRow",
90
+ "chartWrap": "VWh0dG_chartWrap",
91
+ "chartGrid": "VWh0dG_chartGrid",
92
+ "rateBadgeBuiltin": "VWh0dG_rateBadgeBuiltin",
93
+ "uncataloguedTag": "VWh0dG_uncataloguedTag",
66
94
  "subscriptionPct": "VWh0dG_subscriptionPct",
67
- "budgetControls": "VWh0dG_budgetControls",
95
+ "hero": "VWh0dG_hero",
96
+ "providerGroupBalanceLabel": "VWh0dG_providerGroupBalanceLabel",
97
+ "heroMeta": "VWh0dG_heroMeta",
98
+ "balanceDays": "VWh0dG_balanceDays",
99
+ "emptyRow": "VWh0dG_emptyRow",
100
+ "subscriptionWindowLabel": "VWh0dG_subscriptionWindowLabel",
101
+ "subscriptionTrack": "VWh0dG_subscriptionTrack",
102
+ "panel": "VWh0dG_panel",
103
+ "heatmapLegend": "VWh0dG_heatmapLegend",
104
+ "heroSide": "VWh0dG_heroSide",
105
+ "roundsBarLabel": "VWh0dG_roundsBarLabel",
106
+ "budgetFillOver": "VWh0dG_budgetFillOver",
107
+ "budgetInputWrap": "VWh0dG_budgetInputWrap",
108
+ "triggerMonth": "VWh0dG_triggerMonth",
109
+ "rateBadgeLive": "VWh0dG_rateBadgeLive",
110
+ "heatmapHover": "VWh0dG_heatmapHover",
111
+ "healthBadgeOk": "VWh0dG_healthBadgeOk",
68
112
  "healthBad": "VWh0dG_healthBad",
69
- "heroSideLabel": "VWh0dG_heroSideLabel",
70
- "planTag": "VWh0dG_planTag",
71
- "balanceDaysLow": "VWh0dG_balanceDaysLow",
72
- "bandPrice": "VWh0dG_bandPrice",
113
+ "bandTag": "VWh0dG_bandTag",
114
+ "heatmapGrid": "VWh0dG_heatmapGrid",
115
+ "chartLegend": "VWh0dG_chartLegend",
116
+ "modelDot": "VWh0dG_modelDot",
117
+ "budgetControls": "VWh0dG_budgetControls",
118
+ "panelHint": "VWh0dG_panelHint",
73
119
  "dashboard": "VWh0dG_dashboard",
74
- "closeButton": "VWh0dG_closeButton",
75
- "dashboardRight": "VWh0dG_dashboardRight",
76
- "currencyToggle": "VWh0dG_currencyToggle",
77
- "roundsAxis": "VWh0dG_roundsAxis",
120
+ "currencyButtonActive": "VWh0dG_currencyButtonActive",
121
+ "tableScroll": "VWh0dG_tableScroll",
122
+ "bandPriceOff": "VWh0dG_bandPriceOff",
123
+ "pricingToggleText": "VWh0dG_pricingToggleText",
78
124
  "modelCell": "VWh0dG_modelCell",
79
- "budgetLabel": "VWh0dG_budgetLabel",
80
- "pricingToggle": "VWh0dG_pricingToggle",
81
- "emptyRow": "VWh0dG_emptyRow",
82
- "heatmapFooter": "VWh0dG_heatmapFooter",
83
- "chartLine": "VWh0dG_chartLine",
84
- "hero": "VWh0dG_hero",
85
- "dashboardModal": "VWh0dG_dashboardModal",
86
- "switchOn": "VWh0dG_switchOn",
125
+ "pricingChevronOpen": "VWh0dG_pricingChevronOpen",
126
+ "providerGroupBalance": "VWh0dG_providerGroupBalance",
87
127
  "roundsBars": "VWh0dG_roundsBars",
88
- "triggerToday": "VWh0dG_triggerToday",
89
- "uncataloguedTag": "VWh0dG_uncataloguedTag",
90
- "currencyButtonActive": "VWh0dG_currencyButtonActive",
128
+ "heroSideLabel": "VWh0dG_heroSideLabel",
129
+ "roundsEmpty": "VWh0dG_roundsEmpty",
91
130
  "deltaDown": "VWh0dG_deltaDown",
92
- "chartDot": "VWh0dG_chartDot",
93
131
  "subscriptionFill": "VWh0dG_subscriptionFill",
94
- "roundsBarWrap": "VWh0dG_roundsBarWrap",
95
- "rangeButtonActive": "VWh0dG_rangeButtonActive",
96
- "budget": "VWh0dG_budget",
97
- "heroValue": "VWh0dG_heroValue",
98
- "trendPanel": "VWh0dG_trendPanel",
99
- "budgetUnit": "VWh0dG_budgetUnit",
100
- "kpiTile": "VWh0dG_kpiTile",
101
- "heatmapCell": "VWh0dG_heatmapCell",
102
- "budgetTrack": "VWh0dG_budgetTrack",
103
- "chartLegend": "VWh0dG_chartLegend",
104
- "chartEmpty": "VWh0dG_chartEmpty",
105
- "rateBadgeLive": "VWh0dG_rateBadgeLive",
106
- "subscriptionCard": "VWh0dG_subscriptionCard",
107
- "healthOk": "VWh0dG_healthOk",
108
- "healthDot": "VWh0dG_healthDot",
109
- "kpiGrid": "VWh0dG_kpiGrid",
110
- "modelTableScroll": "VWh0dG_modelTableScroll",
111
- "dashboardHead": "VWh0dG_dashboardHead",
112
- "roundsFlagMark": "VWh0dG_roundsFlagMark",
113
- "heatmapHover": "VWh0dG_heatmapHover",
114
- "chartAxisLabel": "VWh0dG_chartAxisLabel",
115
- "budgetValue": "VWh0dG_budgetValue",
116
- "modelName": "VWh0dG_modelName",
117
132
  "rangeToggle": "VWh0dG_rangeToggle",
118
- "kpiGreen": "VWh0dG_kpiGreen",
133
+ "chartCrosshair": "VWh0dG_chartCrosshair",
119
134
  "chartTooltipRow": "VWh0dG_chartTooltipRow",
120
- "healthIdle": "VWh0dG_healthIdle",
121
- "panelTitle": "VWh0dG_panelTitle",
135
+ "numCol": "VWh0dG_numCol",
136
+ "kpiValue": "VWh0dG_kpiValue",
137
+ "chartTooltipDate": "VWh0dG_chartTooltipDate",
138
+ "triggerAmountSub": "VWh0dG_triggerAmountSub",
139
+ "providerGroupMeta": "VWh0dG_providerGroupMeta",
140
+ "triggerAmount": "VWh0dG_triggerAmount",
141
+ "dashboardModal": "VWh0dG_dashboardModal",
142
+ "kpiDetail": "VWh0dG_kpiDetail",
143
+ "kpiTile": "VWh0dG_kpiTile",
144
+ "subscriptionStatus": "VWh0dG_subscriptionStatus",
122
145
  "budgetOverPulse": "VWh0dG_budgetOverPulse",
146
+ "subscriptionName": "VWh0dG_subscriptionName",
123
147
  "roundsBar": "VWh0dG_roundsBar",
124
- "pricingToggleText": "VWh0dG_pricingToggleText",
125
- "chartTooltipDate": "VWh0dG_chartTooltipDate",
126
- "panel": "VWh0dG_panel",
127
- "tableScroll": "VWh0dG_tableScroll",
128
- "na": "VWh0dG_na",
129
- "chartTooltip": "VWh0dG_chartTooltip",
130
- "healthBadgeBad": "VWh0dG_healthBadgeBad",
148
+ "budgetTrack": "VWh0dG_budgetTrack",
131
149
  "switch": "VWh0dG_switch",
132
- "modelProvider": "VWh0dG_modelProvider",
133
- "trigger": "VWh0dG_trigger",
134
- "railButton": "VWh0dG_railButton",
135
- "budgetHead": "VWh0dG_budgetHead",
150
+ "roundsBarCol": "VWh0dG_roundsBarCol",
151
+ "chartLegendLine": "VWh0dG_chartLegendLine",
152
+ "healthIdle": "VWh0dG_healthIdle",
153
+ "deltaUp": "VWh0dG_deltaUp",
154
+ "panelHead": "VWh0dG_panelHead",
155
+ "dashboardRight": "VWh0dG_dashboardRight",
136
156
  "providerGroupBadge": "VWh0dG_providerGroupBadge",
137
- "healthBadge": "VWh0dG_healthBadge",
138
- "chartStack": "VWh0dG_chartStack",
139
- "subscriptionWindowLabel": "VWh0dG_subscriptionWindowLabel",
140
- "providerGroupBalance": "VWh0dG_providerGroupBalance",
141
- "heroSideItem": "VWh0dG_heroSideItem",
142
- "kpiDetail": "VWh0dG_kpiDetail",
143
- "budgetFillOver": "VWh0dG_budgetFillOver",
144
- "chartBar": "VWh0dG_chartBar",
145
- "rateBadgeBuiltin": "VWh0dG_rateBadgeBuiltin",
146
- "pricingChevronOpen": "VWh0dG_pricingChevronOpen",
147
157
  "pricingTable": "VWh0dG_pricingTable",
148
- "heroSideValue": "VWh0dG_heroSideValue",
149
- "heatmapCellEmpty": "VWh0dG_heatmapCellEmpty",
150
- "costCol": "VWh0dG_costCol",
151
- "providerGroup": "VWh0dG_providerGroup",
152
- "balanceCell": "VWh0dG_balanceCell",
153
158
  "triggerMeta": "VWh0dG_triggerMeta",
154
- "roundsBarCol": "VWh0dG_roundsBarCol",
155
- "roundsEmpty": "VWh0dG_roundsEmpty",
156
- "chartSvg": "VWh0dG_chartSvg",
157
- "subscriptionReset": "VWh0dG_subscriptionReset",
158
- "deltaUp": "VWh0dG_deltaUp",
159
- "providerGroupName": "VWh0dG_providerGroupName",
160
- "flatTag": "VWh0dG_flatTag",
161
- "kpiLabel": "VWh0dG_kpiLabel",
162
- "panelHint": "VWh0dG_panelHint",
163
- "budgetFill": "VWh0dG_budgetFill",
164
- "balanceDays": "VWh0dG_balanceDays",
165
- "chartCrosshair": "VWh0dG_chartCrosshair",
166
- "delta": "VWh0dG_delta",
167
- "budgetInput": "VWh0dG_budgetInput",
168
- "dashboardTitle": "VWh0dG_dashboardTitle",
169
- "triggerAmount": "VWh0dG_triggerAmount",
170
- "dashboardBody": "VWh0dG_dashboardBody",
171
- "kpiValue": "VWh0dG_kpiValue",
172
- "subscriptionName": "VWh0dG_subscriptionName",
173
- "subscriptionStatus": "VWh0dG_subscriptionStatus",
174
- "triggerDivider": "VWh0dG_triggerDivider",
175
- "heroMeta": "VWh0dG_heroMeta",
176
- "triggerAmountSub": "VWh0dG_triggerAmountSub",
177
- "roundsFlagBadge": "VWh0dG_roundsFlagBadge",
178
- "providerGroupTitle": "VWh0dG_providerGroupTitle",
179
- "heatmap": "VWh0dG_heatmap",
180
- "heroSide": "VWh0dG_heroSide",
159
+ "chartAxisLabel": "VWh0dG_chartAxisLabel",
160
+ "rounds": "VWh0dG_rounds",
161
+ "na": "VWh0dG_na",
162
+ "heroValue": "VWh0dG_heroValue",
163
+ "chartDot": "VWh0dG_chartDot",
164
+ "healthBadge": "VWh0dG_healthBadge",
181
165
  "rangeButton": "VWh0dG_rangeButton",
182
- "chartGrid": "VWh0dG_chartGrid",
183
- "chartLegendLine": "VWh0dG_chartLegendLine",
184
- "chartTooltipSwatch": "VWh0dG_chartTooltipSwatch",
185
- "subscriptionTrack": "VWh0dG_subscriptionTrack",
186
- "providerGroupMeta": "VWh0dG_providerGroupMeta",
187
- "roundsBarFlagged": "VWh0dG_roundsBarFlagged",
166
+ "heatmapCellEmpty": "VWh0dG_heatmapCellEmpty",
167
+ "heatmapFooter": "VWh0dG_heatmapFooter",
188
168
  "providerGroupHead": "VWh0dG_providerGroupHead",
189
- "subscriptionHead": "VWh0dG_subscriptionHead",
190
- "numCol": "VWh0dG_numCol"
169
+ "chartTooltip": "VWh0dG_chartTooltip",
170
+ "healthBadgeBad": "VWh0dG_healthBadgeBad",
171
+ "delta": "VWh0dG_delta",
172
+ "providerGroup": "VWh0dG_providerGroup",
173
+ "heatmap": "VWh0dG_heatmap",
174
+ "triggerIcon": "VWh0dG_triggerIcon",
175
+ "dashboardHead": "VWh0dG_dashboardHead",
176
+ "heroSideValue": "VWh0dG_heroSideValue",
177
+ "heroMain": "VWh0dG_heroMain",
178
+ "budgetValue": "VWh0dG_budgetValue",
179
+ "healthDot": "VWh0dG_healthDot",
180
+ "subscriptionCard": "VWh0dG_subscriptionCard",
181
+ "budgetHead": "VWh0dG_budgetHead",
182
+ "planTag": "VWh0dG_planTag",
183
+ "heroLabel": "VWh0dG_heroLabel",
184
+ "budget": "VWh0dG_budget",
185
+ "kpiLabel": "VWh0dG_kpiLabel",
186
+ "switchKnob": "VWh0dG_switchKnob",
187
+ "subscriptionPlan": "VWh0dG_subscriptionPlan",
188
+ "flatTag": "VWh0dG_flatTag",
189
+ "providerGroupName": "VWh0dG_providerGroupName",
190
+ "providerGroupList": "VWh0dG_providerGroupList"
191
191
  };
192
192
  //#endregion
193
193
  //#region src/client/pricing.ts
package/lib/index.js CHANGED
@@ -944,6 +944,8 @@ const FETCH_TIMEOUT_MS$1 = 8e3;
944
944
  const DEEPSEEK_BALANCE_URL = "https://api.deepseek.com/user/balance";
945
945
  /** Moonshot/Kimi 官方余额接口(platform.kimi.com/docs/api/balance)。 */
946
946
  const MOONSHOT_BALANCE_URL = "https://api.moonshot.cn/v1/users/me/balance";
947
+ /** 阶跃星辰 StepFun 官方账户信息接口(platform.stepfun.com/docs/api-reference/accounts/get)。 */
948
+ const STEPFUN_BALANCE_URL = "https://api.stepfun.com/v1/accounts";
947
949
  /** 数字归一化:接口返回的余额是字符串(如 `"110.00"`),统一转 number。 */
948
950
  function toNumber(value) {
949
951
  if (typeof value === "number" && Number.isFinite(value)) return value;
@@ -1050,15 +1052,45 @@ function queryMoonshot(ctx, apiKeyEnv) {
1050
1052
  };
1051
1053
  });
1052
1054
  }
1053
- const QUERIERS = [{
1054
- route: "deepseek",
1055
- displayName: "deepseek",
1056
- querier: queryDeepSeek
1057
- }, {
1058
- route: "moonshot",
1059
- displayName: "月之暗面",
1060
- querier: queryMoonshot
1061
- }];
1055
+ /**
1056
+ * Query the StepFun (阶跃星辰) account balance.
1057
+ * @param ctx - host context carrying the credentials seam.
1058
+ * @param apiKeyEnv - credential reference resolving the StepFun API key.
1059
+ * @returns the balance row, or an error row when the key/endpoint misbehaves.
1060
+ */
1061
+ function queryStepFun(ctx, apiKeyEnv) {
1062
+ return queryBearerBalance(ctx, STEPFUN_BALANCE_URL, apiKeyEnv, "阶跃星辰", "阶跃星辰", (data) => {
1063
+ const doc = data;
1064
+ const totalBalance = toNumber(doc.balance);
1065
+ const toppedUpBalance = toNumber(doc.total_cash_balance);
1066
+ const grantedBalance = toNumber(doc.total_voucher_balance);
1067
+ return {
1068
+ provider: "阶跃星辰",
1069
+ displayName: "阶跃星辰",
1070
+ currency: "CNY",
1071
+ ...totalBalance !== void 0 ? { totalBalance } : {},
1072
+ ...toppedUpBalance !== void 0 ? { toppedUpBalance } : {},
1073
+ ...grantedBalance !== void 0 ? { grantedBalance } : {}
1074
+ };
1075
+ });
1076
+ }
1077
+ const QUERIERS = [
1078
+ {
1079
+ route: "deepseek",
1080
+ displayName: "deepseek",
1081
+ querier: queryDeepSeek
1082
+ },
1083
+ {
1084
+ route: "moonshot",
1085
+ displayName: "月之暗面",
1086
+ querier: queryMoonshot
1087
+ },
1088
+ {
1089
+ route: "stepfun",
1090
+ displayName: "阶跃星辰",
1091
+ querier: queryStepFun
1092
+ }
1093
+ ];
1062
1094
  /**
1063
1095
  * Query every configured provider's account balance. A provider is queried only
1064
1096
  * when its llm-pi-ai route has an `apiKeyEnv`; absent routes answer
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.4.1",
4
+ "version": "0.4.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },