@kenz1117/dsh-ui-usage-billing 0.6.0 → 0.7.0
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 +13 -5
- package/lib/client.js +566 -268
- package/lib/index.js +269 -11
- package/lib/types/balance.d.ts +17 -1
- package/lib/types/client/UsageBilling.d.ts +3 -0
- package/lib/types/client/budget-store.d.ts +3 -0
- package/lib/types/client/live-cost.d.ts +27 -1
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/client/pricing.d.ts +53 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/types/pricing-fetch.d.ts +9 -1
- package/lib/types/pricing-shared.d.ts +50 -0
- package/package.json +1 -1
|
@@ -21,6 +21,22 @@ export interface LivePricing {
|
|
|
21
21
|
rate?: number;
|
|
22
22
|
/** Overrides keyed by built-in catalog key (present when router matches succeeded). */
|
|
23
23
|
prices?: Record<string, LivePrice>;
|
|
24
|
+
/**
|
|
25
|
+
* models.dev 补充的目录外模型价(USD / 1M tokens):与宿主预制提供方对齐——
|
|
26
|
+
* pi-ai 预制目录的上游就是 models.dev,补进来的条目让「提供方支持但我们的
|
|
27
|
+
* 内置目录未收录」的模型也能计价并出现在费率表。
|
|
28
|
+
*/
|
|
29
|
+
extraModels?: readonly ExtraModelPrice[];
|
|
30
|
+
}
|
|
31
|
+
/** models.dev 补充的目录外模型价(USD / 1M tokens)。 */
|
|
32
|
+
export interface ExtraModelPrice {
|
|
33
|
+
/** 归一化模型 id(计费键,如 `deepseek-v4.5-flash`)。 */
|
|
34
|
+
key: string;
|
|
35
|
+
/** 显示名。 */
|
|
36
|
+
name: string;
|
|
37
|
+
/** 厂商显示名(与仪表盘厂商组同口径)。 */
|
|
38
|
+
provider: string;
|
|
39
|
+
price: LivePrice;
|
|
24
40
|
}
|
|
25
41
|
/** 余额查询失败的原因,前端据此显示文案。 */
|
|
26
42
|
export type BalanceError = 'unconfigured' | 'unauthorized' | 'unreachable';
|
|
@@ -86,4 +102,38 @@ export interface SubscriptionPlanConfig {
|
|
|
86
102
|
/** Z.ai region override; defaults to the settings-namespace `zaiRegion`. */
|
|
87
103
|
region?: 'global' | 'bigmodel-cn';
|
|
88
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* 余额提取规则:从响应 JSON 取数。
|
|
107
|
+
* - `const`:数字常量;
|
|
108
|
+
* - `path`:点路径取值(如 `data.total_available`);
|
|
109
|
+
* - `op: 'add' | 'subtract'` + `paths`:多路径加 / 减;
|
|
110
|
+
* - `op: 'divide'` + `path` + `by`:按除数缩放(适配 NewApi 等 quota 端点,
|
|
111
|
+
* 如 1 USD = 500000 quota)。
|
|
112
|
+
*/
|
|
113
|
+
export interface CustomBalanceExtract {
|
|
114
|
+
const?: number;
|
|
115
|
+
path?: string;
|
|
116
|
+
op?: 'add' | 'subtract' | 'divide';
|
|
117
|
+
paths?: readonly string[];
|
|
118
|
+
by?: number;
|
|
119
|
+
}
|
|
120
|
+
/** 一个自定义 Provider 余额查询配置(插件 config 的 `customBalances` 条目)。 */
|
|
121
|
+
export interface CustomBalanceConfig {
|
|
122
|
+
/** 显示名(中文)。 */
|
|
123
|
+
label: string;
|
|
124
|
+
/** 显示名(英文);缺省用 label。 */
|
|
125
|
+
labelEn?: string;
|
|
126
|
+
/** 余额币种(如 CNY / USD);缺省 CNY。 */
|
|
127
|
+
unit?: string;
|
|
128
|
+
/** 查询端点(完整 URL)。 */
|
|
129
|
+
url: string;
|
|
130
|
+
/** HTTP 方法;缺省 GET。 */
|
|
131
|
+
method?: string;
|
|
132
|
+
/** 请求头;值支持 `{{ENV_NAME}}` 占位符,经凭据 seam 解析(仅请求头支持)。 */
|
|
133
|
+
headers?: Record<string, string>;
|
|
134
|
+
/** 余额提取规则。 */
|
|
135
|
+
extract: {
|
|
136
|
+
remaining: CustomBalanceExtract;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
89
139
|
//# sourceMappingURL=pricing-shared.d.ts.map
|
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
|
+
"version": "0.7.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|