dsh-model-allowance 1.0.1 → 1.0.3
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 +1 -0
- package/README.zh.md +1 -0
- package/client.js +24 -12
- package/lib/balance.js +31 -4
- package/lib/providers/deepseek.js +41 -3
- package/lib/providers/{kimi.js → kimi_coding.js} +2 -2
- package/lib/providers/{minimax.js → minimax_cn.js} +5 -5
- package/lib/providers/{opencode.js → opencode_go.js} +2 -2
- package/lib/providers/placeholder.js +580 -0
- package/lib/providers/{zhipu.js → zai.js} +5 -5
- package/lib/providers.js +85 -9
- package/package.json +1 -1
package/README.md
CHANGED
package/README.zh.md
CHANGED
package/client.js
CHANGED
|
@@ -97,8 +97,9 @@ function formatDelta(consumption) {
|
|
|
97
97
|
if (magnitude >= 0.05) return `${magnitude.toFixed(1)}%`;
|
|
98
98
|
return "";
|
|
99
99
|
}
|
|
100
|
+
if (magnitude < 5e-5) return "";
|
|
100
101
|
const value = magnitude >= 0.01 ? magnitude.toFixed(2) : magnitude.toFixed(4);
|
|
101
|
-
return
|
|
102
|
+
return value;
|
|
102
103
|
}
|
|
103
104
|
function formatClock(epochMs) {
|
|
104
105
|
const at = new Date(epochMs);
|
|
@@ -289,7 +290,8 @@ var zh = {
|
|
|
289
290
|
"badge.quotaPercent": "\u5269\u4F59 {percent}%",
|
|
290
291
|
"badge.quotaRatio": "{remaining} / {total}",
|
|
291
292
|
"badge.quotaDuration": "\u5269\u4F59 {duration}",
|
|
292
|
-
"badge.unsupported": "\u65E0\u4F59\u989D\u63A5\u53E3",
|
|
293
|
+
"badge.unsupported": "\u76EE\u524D\u65E0\u4F59\u989D\u63A5\u53E3",
|
|
294
|
+
"badge.unsupportedWithName": "{name} \u76EE\u524D\u65E0\u4F59\u989D\u63A5\u53E3",
|
|
293
295
|
"badge.unconfigured": "\u672A\u914D\u7F6E\u51ED\u8BC1",
|
|
294
296
|
"badge.failed": "\u65E0\u6CD5\u83B7\u53D6",
|
|
295
297
|
"detail.title": "\u5382\u5546\u4F59\u989D",
|
|
@@ -340,6 +342,7 @@ var en = {
|
|
|
340
342
|
"badge.quotaRatio": "{remaining} / {total}",
|
|
341
343
|
"badge.quotaDuration": "{duration} left",
|
|
342
344
|
"badge.unsupported": "No balance API",
|
|
345
|
+
"badge.unsupportedWithName": "{name} has no balance API",
|
|
343
346
|
"badge.unconfigured": "No credential",
|
|
344
347
|
"badge.failed": "Unavailable",
|
|
345
348
|
"detail.title": "Provider balance",
|
|
@@ -978,8 +981,11 @@ function BalanceBadge(props) {
|
|
|
978
981
|
const [directory, setDirectory] = React.useState([]);
|
|
979
982
|
const lastModelProvider = React.useRef(null);
|
|
980
983
|
const available = directory.filter((entry) => entry.configured);
|
|
981
|
-
const entryOf =
|
|
982
|
-
|
|
984
|
+
const entryOf = React.useCallback(
|
|
985
|
+
(route) => directory.find((entry) => entry.route === route),
|
|
986
|
+
[directory]
|
|
987
|
+
);
|
|
988
|
+
const nameOf = React.useCallback((route) => pickName(entryOf(route), route), [entryOf]);
|
|
983
989
|
const markFor = (route) => markOf(entryOf(route), route);
|
|
984
990
|
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
985
991
|
const [stripWidth, setStripWidth] = React.useState(0);
|
|
@@ -1281,10 +1287,13 @@ function BalanceBadge(props) {
|
|
|
1281
1287
|
}
|
|
1282
1288
|
return t("badge.noData");
|
|
1283
1289
|
}
|
|
1284
|
-
if (view.status === "unsupported")
|
|
1290
|
+
if (view.status === "unsupported") {
|
|
1291
|
+
const name = nameOf(activeProvider);
|
|
1292
|
+
return t("badge.unsupportedWithName", { name });
|
|
1293
|
+
}
|
|
1285
1294
|
if (view.status === "unconfigured") return t("badge.unconfigured");
|
|
1286
1295
|
return t("badge.failed");
|
|
1287
|
-
}, [view, provider, t]);
|
|
1296
|
+
}, [view, provider, activeProvider, nameOf, t]);
|
|
1288
1297
|
if (!provider) return null;
|
|
1289
1298
|
const serviceState = providerStatus && providerStatus.provider === activeProvider ? providerStatus.state : "unknown";
|
|
1290
1299
|
const MARK_SIZE = 26;
|
|
@@ -1501,11 +1510,10 @@ function BalanceBadge(props) {
|
|
|
1501
1510
|
style: { width: `${String(filled)}%` }
|
|
1502
1511
|
})
|
|
1503
1512
|
),
|
|
1504
|
-
// A window
|
|
1505
|
-
//
|
|
1506
|
-
//
|
|
1507
|
-
|
|
1508
|
-
typeof window.resetAt === "number" ? (0, import_react3.createElement)(
|
|
1513
|
+
// A window with zero usage has not started its rolling timer
|
|
1514
|
+
// yet, so the countdown would be misleading. Hide it until
|
|
1515
|
+
// consumption begins.
|
|
1516
|
+
typeof window.resetAt === "number" && (typeof window.remainingPercent !== "number" || window.remainingPercent < 100) ? (0, import_react3.createElement)(
|
|
1509
1517
|
"div",
|
|
1510
1518
|
{ className: "dsh-model-allowance-foot" },
|
|
1511
1519
|
(0, import_react3.createElement)(
|
|
@@ -1546,7 +1554,11 @@ function BalanceBadge(props) {
|
|
|
1546
1554
|
// turns "it does not work" into something actionable.
|
|
1547
1555
|
view.error ? (0, import_react3.createElement)("div", { className: "dsh-model-allowance-reason" }, view.error) : null
|
|
1548
1556
|
) : null,
|
|
1549
|
-
view?.status === "unsupported" ? (0, import_react3.createElement)(
|
|
1557
|
+
view?.status === "unsupported" ? (0, import_react3.createElement)(
|
|
1558
|
+
"div",
|
|
1559
|
+
{ className: "dsh-model-allowance-reason" },
|
|
1560
|
+
t("badge.unsupportedWithName", { name: nameOf(activeProvider) })
|
|
1561
|
+
) : null,
|
|
1550
1562
|
view?.status === "unconfigured" ? (0, import_react3.createElement)("div", { className: "dsh-model-allowance-reason" }, t("badge.unconfigured")) : null,
|
|
1551
1563
|
// A vendor that prices by the wall clock gets its phase and
|
|
1552
1564
|
// countdown here, above the footer.
|
package/lib/balance.js
CHANGED
|
@@ -13,6 +13,33 @@ import { findAdapter, KIND_AMOUNT, KIND_QUOTA, PROVIDER_ADAPTERS } from './provi
|
|
|
13
13
|
/** Default lifetime of one cached reading, in milliseconds. */
|
|
14
14
|
const DEFAULT_TTL_MS = 5 * 60 * 1000
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Round a monetary amount to avoid floating-point precision artifacts.
|
|
18
|
+
*
|
|
19
|
+
* Amounts are rounded to 4 decimal places (0.0001), which is sufficient for
|
|
20
|
+
* currency values while eliminating IEEE 754 noise like -0.00002 that arises
|
|
21
|
+
* from subtraction of nearly equal floats.
|
|
22
|
+
*
|
|
23
|
+
* @param {number} value The raw computed value.
|
|
24
|
+
* @returns {number} The rounded value.
|
|
25
|
+
*/
|
|
26
|
+
function roundAmount(value) {
|
|
27
|
+
return Math.round(value * 10000) / 10000
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Round a percentage delta to avoid floating-point precision artifacts.
|
|
32
|
+
*
|
|
33
|
+
* Percentages are rounded to 2 decimal places, which is appropriate for
|
|
34
|
+
* plan window remaining percentages.
|
|
35
|
+
*
|
|
36
|
+
* @param {number} value The raw computed value.
|
|
37
|
+
* @returns {number} The rounded value.
|
|
38
|
+
*/
|
|
39
|
+
function roundPercent(value) {
|
|
40
|
+
return Math.round(value * 100) / 100
|
|
41
|
+
}
|
|
42
|
+
|
|
16
43
|
/** Timeout for one provider request, in milliseconds. */
|
|
17
44
|
const REQUEST_TIMEOUT_MS = 15 * 1000
|
|
18
45
|
|
|
@@ -85,7 +112,7 @@ function withConsumption(view, before) {
|
|
|
85
112
|
if (typeof view.amount !== 'number' || typeof before.amount !== 'number') return view
|
|
86
113
|
return {
|
|
87
114
|
...view,
|
|
88
|
-
consumption: { kind: 'amount', delta: view.amount - before.amount, at: Date.now() },
|
|
115
|
+
consumption: { kind: 'amount', delta: roundAmount(view.amount - before.amount), at: Date.now() },
|
|
89
116
|
}
|
|
90
117
|
}
|
|
91
118
|
// A plan meters several windows at once, and the one the badge speaks for is
|
|
@@ -94,12 +121,12 @@ function withConsumption(view, before) {
|
|
|
94
121
|
// changed, so the largest movement wins.
|
|
95
122
|
const moved = largestWindowMove(view, before)
|
|
96
123
|
if (moved !== undefined) {
|
|
97
|
-
return { ...view, consumption: { kind: 'percent', delta: moved, at: Date.now() } }
|
|
124
|
+
return { ...view, consumption: { kind: 'percent', delta: roundPercent(moved), at: Date.now() } }
|
|
98
125
|
}
|
|
99
126
|
if (typeof view.percent !== 'number' || typeof before.percent !== 'number') return view
|
|
100
127
|
return {
|
|
101
128
|
...view,
|
|
102
|
-
consumption: { kind: 'percent', delta: view.percent - before.percent, at: Date.now() },
|
|
129
|
+
consumption: { kind: 'percent', delta: roundPercent(view.percent - before.percent), at: Date.now() },
|
|
103
130
|
}
|
|
104
131
|
}
|
|
105
132
|
|
|
@@ -119,7 +146,7 @@ function largestWindowMove(view, before) {
|
|
|
119
146
|
for (const window of Array.isArray(view.windows) ? view.windows : []) {
|
|
120
147
|
const was = previous.get(window.id)
|
|
121
148
|
if (was === undefined || typeof window.remainingPercent !== 'number') continue
|
|
122
|
-
const delta = window.remainingPercent - was
|
|
149
|
+
const delta = roundPercent(window.remainingPercent - was)
|
|
123
150
|
if (largest === undefined || Math.abs(delta) > Math.abs(largest)) largest = delta
|
|
124
151
|
}
|
|
125
152
|
return largest
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
* Where DeepSeek's own console shows the same wallet this plugin reads.
|
|
23
23
|
* Verified 2026-11-06.
|
|
24
24
|
*/
|
|
25
|
-
const CONSOLE = 'https://platform.deepseek.com/
|
|
25
|
+
const CONSOLE = 'https://platform.deepseek.com/usage'
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* DeepSeek publishes its live platform status on a FlashCat status page.
|
|
@@ -48,8 +48,9 @@ const STATUS = Object.freeze({
|
|
|
48
48
|
* statutory holidays are off-peak all day; a working weekend stays a weekend
|
|
49
49
|
* under the rule, which names Monday to Friday.
|
|
50
50
|
*
|
|
51
|
-
* The holiday list
|
|
52
|
-
* 〔2025〕7号). Extend it when
|
|
51
|
+
* The holiday list covers the State Council's 2026 arrangement (国办发明电
|
|
52
|
+
* 〔2025〕7号) and 2027 arrangement (国办发明电〔2026〕10号). Extend it when
|
|
53
|
+
* the next year's notice is published.
|
|
53
54
|
*/
|
|
54
55
|
const SCHEDULE = defineSchedule({
|
|
55
56
|
timezone: 'Asia/Shanghai',
|
|
@@ -100,6 +101,43 @@ const SCHEDULE = defineSchedule({
|
|
|
100
101
|
'2026-10-05',
|
|
101
102
|
'2026-10-06',
|
|
102
103
|
'2026-10-07',
|
|
104
|
+
// ===== 2027年(国办发明电〔2026〕10号)=====
|
|
105
|
+
// 元旦
|
|
106
|
+
'2027-01-01',
|
|
107
|
+
'2027-01-02',
|
|
108
|
+
'2027-01-03',
|
|
109
|
+
// 春节
|
|
110
|
+
'2027-02-05',
|
|
111
|
+
'2027-02-06',
|
|
112
|
+
'2027-02-07',
|
|
113
|
+
'2027-02-08',
|
|
114
|
+
'2027-02-09',
|
|
115
|
+
'2027-02-10',
|
|
116
|
+
'2027-02-11',
|
|
117
|
+
'2027-02-12',
|
|
118
|
+
'2027-02-13',
|
|
119
|
+
// 清明节
|
|
120
|
+
'2027-04-03',
|
|
121
|
+
'2027-04-04',
|
|
122
|
+
'2027-04-05',
|
|
123
|
+
// 劳动节
|
|
124
|
+
'2027-05-01',
|
|
125
|
+
'2027-05-02',
|
|
126
|
+
'2027-05-03',
|
|
127
|
+
'2027-05-04',
|
|
128
|
+
'2027-05-05',
|
|
129
|
+
// 端午节
|
|
130
|
+
'2027-06-09',
|
|
131
|
+
// 中秋节
|
|
132
|
+
'2027-09-15',
|
|
133
|
+
// 国庆节
|
|
134
|
+
'2027-10-01',
|
|
135
|
+
'2027-10-02',
|
|
136
|
+
'2027-10-03',
|
|
137
|
+
'2027-10-04',
|
|
138
|
+
'2027-10-05',
|
|
139
|
+
'2027-10-06',
|
|
140
|
+
'2027-10-07',
|
|
103
141
|
],
|
|
104
142
|
note: { zh: '低谷时段 API 价格减半', en: 'API prices are halved off-peak' },
|
|
105
143
|
})
|
|
@@ -24,7 +24,7 @@ import { statuspageView } from './status.js'
|
|
|
24
24
|
* Kimi's plan usage lives under 我的 → 设置 → 订阅 in the web app, which is
|
|
25
25
|
* this route. Verified 2026-11-06.
|
|
26
26
|
*/
|
|
27
|
-
const CONSOLE = 'https://www.kimi.com/settings'
|
|
27
|
+
const CONSOLE = 'https://www.kimi.com/settings/subscription'
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Moonshot — the platform behind Kimi — publishes its live status on an
|
|
@@ -266,7 +266,7 @@ function readUsage({ route, body }) {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
/** Kimi for Coding's route. */
|
|
269
|
-
export const
|
|
269
|
+
export const kimiCodingAdapters = [
|
|
270
270
|
defineAdapter({
|
|
271
271
|
id: 'kimi-coding',
|
|
272
272
|
routes: ['kimi-coding'],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MiniMax adapter.
|
|
2
|
+
* MiniMax (CN) adapter.
|
|
3
3
|
*
|
|
4
4
|
* The coding plan answers a GET with bearer auth; a POST with a `key` body is
|
|
5
5
|
* the pay-as-you-go shape and returns 404 for a plan key, so the GET is the
|
|
@@ -218,10 +218,10 @@ function readTokenPlan({ route, body, model }) {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
/** MiniMax's coding-plan route. */
|
|
222
|
-
export const
|
|
221
|
+
/** MiniMax (CN)'s coding-plan route. */
|
|
222
|
+
export const minimaxCnAdapters = [
|
|
223
223
|
defineAdapter({
|
|
224
|
-
id: 'minimax-
|
|
224
|
+
id: 'minimax-cn',
|
|
225
225
|
routes: ['minimax-cn'],
|
|
226
226
|
kind: KIND_QUOTA,
|
|
227
227
|
modelScoped: true,
|
|
@@ -232,7 +232,7 @@ export const minimaxAdapters = [
|
|
|
232
232
|
consoleUrl: CONSOLE,
|
|
233
233
|
status: STATUS,
|
|
234
234
|
display: {
|
|
235
|
-
name: { zh: 'MiniMax', en: 'MiniMax' },
|
|
235
|
+
name: { zh: 'MiniMax (国内)', en: 'MiniMax (CN)' },
|
|
236
236
|
mark: { icon: 'minimax', color: '#e21680' },
|
|
237
237
|
},
|
|
238
238
|
fixtures: [
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import { normalizeState, STATUS_OPERATIONAL, STATUS_UNKNOWN } from './status.js'
|
|
19
19
|
|
|
20
20
|
/** The Go plan page, where the plan itself is managed. Verified 2026-11-06. */
|
|
21
|
-
const CONSOLE = 'https://opencode.ai/
|
|
21
|
+
const CONSOLE = 'https://opencode.ai/console/workspace'
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* OpenCode published its own status API, and it names Go as a component —
|
|
@@ -117,7 +117,7 @@ function readUsage({ route, body }) {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/** OpenCode Go's route. */
|
|
120
|
-
export const
|
|
120
|
+
export const opencodeGoAdapters = [
|
|
121
121
|
defineAdapter({
|
|
122
122
|
id: 'opencode-go',
|
|
123
123
|
routes: ['opencode-go'],
|
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Placeholder adapters for platforms without balance API support.
|
|
3
|
+
*
|
|
4
|
+
* These adapters declare the routes they serve but return `unsupported` status,
|
|
5
|
+
* indicating that no balance or quota reading is available for these providers.
|
|
6
|
+
* This allows the plugin to recognize the routes without attempting queries
|
|
7
|
+
* that would fail.
|
|
8
|
+
*
|
|
9
|
+
* When a platform adds a balance API, replace its placeholder with a real
|
|
10
|
+
* adapter following the patterns in deepseek.js, minimax_cn.js, or zai.js.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { defineAdapter, KIND_AMOUNT } from './shared.js'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create a placeholder adapter for a platform without balance support.
|
|
17
|
+
* @param {object} spec Adapter specification.
|
|
18
|
+
* @param {string} spec.id Adapter identity.
|
|
19
|
+
* @param {readonly string[]} spec.routes Provider routes this adapter serves.
|
|
20
|
+
* @param {{zh: string, en: string}} spec.name Display name.
|
|
21
|
+
* @param {string} spec.color Brand color.
|
|
22
|
+
* @param {string} [spec.icon] Optional icon hint.
|
|
23
|
+
* @param {string} [spec.consoleUrl] Provider console URL.
|
|
24
|
+
* @returns {import('../providers.js').ProviderAdapter} The placeholder adapter.
|
|
25
|
+
*/
|
|
26
|
+
function placeholderAdapter({ id, routes, name, color, icon, consoleUrl }) {
|
|
27
|
+
const safeConsole =
|
|
28
|
+
typeof consoleUrl === 'string' && consoleUrl.startsWith('https://')
|
|
29
|
+
? consoleUrl
|
|
30
|
+
: 'https://example.com'
|
|
31
|
+
|
|
32
|
+
return defineAdapter({
|
|
33
|
+
id,
|
|
34
|
+
routes,
|
|
35
|
+
kind: KIND_AMOUNT,
|
|
36
|
+
readWithEnv: async ({ route }) => ({
|
|
37
|
+
provider: route,
|
|
38
|
+
status: 'unsupported',
|
|
39
|
+
kind: KIND_AMOUNT,
|
|
40
|
+
}),
|
|
41
|
+
consoleUrl: safeConsole,
|
|
42
|
+
display: {
|
|
43
|
+
name: { zh: name.zh, en: name.en },
|
|
44
|
+
mark: { ...(typeof icon === 'string' ? { icon } : {}), color },
|
|
45
|
+
},
|
|
46
|
+
fixtures: [
|
|
47
|
+
{
|
|
48
|
+
name: 'placeholder returns unsupported',
|
|
49
|
+
services: {},
|
|
50
|
+
expect: { status: 'unsupported', kind: KIND_AMOUNT },
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// AWS Bedrock
|
|
58
|
+
// ============================================================================
|
|
59
|
+
export const amazonBedrockAdapters = [
|
|
60
|
+
placeholderAdapter({
|
|
61
|
+
id: 'amazon-bedrock',
|
|
62
|
+
routes: ['amazon-bedrock'],
|
|
63
|
+
name: { zh: 'AWS Bedrock', en: 'AWS Bedrock' },
|
|
64
|
+
color: '#ff9900',
|
|
65
|
+
icon: 'aws',
|
|
66
|
+
consoleUrl: 'https://console.aws.amazon.com/bedrock/',
|
|
67
|
+
}),
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
// ============================================================================
|
|
71
|
+
// Ant Ling (蚂蚁灵光)
|
|
72
|
+
// ============================================================================
|
|
73
|
+
export const antLingAdapters = [
|
|
74
|
+
placeholderAdapter({
|
|
75
|
+
id: 'ant-ling',
|
|
76
|
+
routes: ['ant-ling'],
|
|
77
|
+
name: { zh: '蚂蚁灵光', en: 'Ant Ling' },
|
|
78
|
+
color: '#1677ff',
|
|
79
|
+
icon: 'ant',
|
|
80
|
+
consoleUrl: 'https://www.ant-ling.com/',
|
|
81
|
+
}),
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// Anthropic (Claude)
|
|
86
|
+
// ============================================================================
|
|
87
|
+
export const anthropicAdapters = [
|
|
88
|
+
placeholderAdapter({
|
|
89
|
+
id: 'anthropic',
|
|
90
|
+
routes: ['anthropic'],
|
|
91
|
+
name: { zh: 'Anthropic (Claude)', en: 'Anthropic (Claude)' },
|
|
92
|
+
color: '#d4a574',
|
|
93
|
+
icon: 'anthropic',
|
|
94
|
+
consoleUrl: 'https://console.anthropic.com/',
|
|
95
|
+
}),
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// Azure OpenAI
|
|
100
|
+
// ============================================================================
|
|
101
|
+
export const azureAdapters = [
|
|
102
|
+
placeholderAdapter({
|
|
103
|
+
id: 'azure',
|
|
104
|
+
routes: ['azure'],
|
|
105
|
+
name: { zh: 'Azure OpenAI', en: 'Azure OpenAI' },
|
|
106
|
+
color: '#0078d4',
|
|
107
|
+
icon: 'azure',
|
|
108
|
+
consoleUrl: 'https://portal.azure.com/',
|
|
109
|
+
}),
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
// ============================================================================
|
|
113
|
+
// Baseten
|
|
114
|
+
// ============================================================================
|
|
115
|
+
export const basetenAdapters = [
|
|
116
|
+
placeholderAdapter({
|
|
117
|
+
id: 'baseten',
|
|
118
|
+
routes: ['baseten'],
|
|
119
|
+
name: { zh: 'Baseten', en: 'Baseten' },
|
|
120
|
+
color: '#6366f1',
|
|
121
|
+
icon: 'baseten',
|
|
122
|
+
consoleUrl: 'https://app.baseten.co/',
|
|
123
|
+
}),
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
// ============================================================================
|
|
127
|
+
// Cerebras
|
|
128
|
+
// ============================================================================
|
|
129
|
+
export const cerebrasAdapters = [
|
|
130
|
+
placeholderAdapter({
|
|
131
|
+
id: 'cerebras',
|
|
132
|
+
routes: ['cerebras'],
|
|
133
|
+
name: { zh: 'Cerebras', en: 'Cerebras' },
|
|
134
|
+
color: '#f97316',
|
|
135
|
+
icon: 'cerebras',
|
|
136
|
+
consoleUrl: 'https://cloud.cerebras.ai/',
|
|
137
|
+
}),
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
// ============================================================================
|
|
141
|
+
// Cloudflare AI Gateway
|
|
142
|
+
// ============================================================================
|
|
143
|
+
export const cloudflareAiGatewayAdapters = [
|
|
144
|
+
placeholderAdapter({
|
|
145
|
+
id: 'cloudflare-ai-gateway',
|
|
146
|
+
routes: ['cloudflare-ai-gateway'],
|
|
147
|
+
name: { zh: 'Cloudflare AI Gateway', en: 'Cloudflare AI Gateway' },
|
|
148
|
+
color: '#f38020',
|
|
149
|
+
icon: 'cloudflare',
|
|
150
|
+
consoleUrl: 'https://dash.cloudflare.com/',
|
|
151
|
+
}),
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
// ============================================================================
|
|
155
|
+
// Cloudflare Workers AI
|
|
156
|
+
// ============================================================================
|
|
157
|
+
export const cloudflareWorkersAiAdapters = [
|
|
158
|
+
placeholderAdapter({
|
|
159
|
+
id: 'cloudflare-workers-ai',
|
|
160
|
+
routes: ['cloudflare-workers-ai'],
|
|
161
|
+
name: { zh: 'Cloudflare Workers AI', en: 'Cloudflare Workers AI' },
|
|
162
|
+
color: '#f38020',
|
|
163
|
+
icon: 'cloudflare',
|
|
164
|
+
consoleUrl: 'https://dash.cloudflare.com/',
|
|
165
|
+
}),
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
// ============================================================================
|
|
169
|
+
// DeepSeek (already implemented in deepseek.js)
|
|
170
|
+
// This is just a re-export placeholder for completeness
|
|
171
|
+
// ============================================================================
|
|
172
|
+
// Note: DeepSeek has full implementation in deepseek.js
|
|
173
|
+
|
|
174
|
+
// ============================================================================
|
|
175
|
+
// Fireworks AI
|
|
176
|
+
// ============================================================================
|
|
177
|
+
export const fireworksAdapters = [
|
|
178
|
+
placeholderAdapter({
|
|
179
|
+
id: 'fireworks',
|
|
180
|
+
routes: ['fireworks'],
|
|
181
|
+
name: { zh: 'Fireworks AI', en: 'Fireworks AI' },
|
|
182
|
+
color: '#f43f5e',
|
|
183
|
+
icon: 'fireworks',
|
|
184
|
+
consoleUrl: 'https://app.fireworks.ai/',
|
|
185
|
+
}),
|
|
186
|
+
]
|
|
187
|
+
|
|
188
|
+
// ============================================================================
|
|
189
|
+
// GitHub Copilot
|
|
190
|
+
// ============================================================================
|
|
191
|
+
export const githubCopilotAdapters = [
|
|
192
|
+
placeholderAdapter({
|
|
193
|
+
id: 'github-copilot',
|
|
194
|
+
routes: ['github-copilot'],
|
|
195
|
+
name: { zh: 'GitHub Copilot', en: 'GitHub Copilot' },
|
|
196
|
+
color: '#1f2328',
|
|
197
|
+
icon: 'github',
|
|
198
|
+
consoleUrl: 'https://github.com/settings/copilot',
|
|
199
|
+
}),
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
// ============================================================================
|
|
203
|
+
// Google (Gemini)
|
|
204
|
+
// ============================================================================
|
|
205
|
+
export const googleAdapters = [
|
|
206
|
+
placeholderAdapter({
|
|
207
|
+
id: 'google',
|
|
208
|
+
routes: ['google'],
|
|
209
|
+
name: { zh: 'Google (Gemini)', en: 'Google (Gemini)' },
|
|
210
|
+
color: '#4285f4',
|
|
211
|
+
icon: 'google',
|
|
212
|
+
consoleUrl: 'https://aistudio.google.com/',
|
|
213
|
+
}),
|
|
214
|
+
]
|
|
215
|
+
|
|
216
|
+
// ============================================================================
|
|
217
|
+
// Google Vertex AI
|
|
218
|
+
// ============================================================================
|
|
219
|
+
export const googleVertexAdapters = [
|
|
220
|
+
placeholderAdapter({
|
|
221
|
+
id: 'google-vertex',
|
|
222
|
+
routes: ['google-vertex'],
|
|
223
|
+
name: { zh: 'Google Vertex AI', en: 'Google Vertex AI' },
|
|
224
|
+
color: '#4285f4',
|
|
225
|
+
icon: 'google-cloud',
|
|
226
|
+
consoleUrl: 'https://console.cloud.google.com/vertex-ai',
|
|
227
|
+
}),
|
|
228
|
+
]
|
|
229
|
+
|
|
230
|
+
// ============================================================================
|
|
231
|
+
// Groq
|
|
232
|
+
// ============================================================================
|
|
233
|
+
export const groqAdapters = [
|
|
234
|
+
placeholderAdapter({
|
|
235
|
+
id: 'groq',
|
|
236
|
+
routes: ['groq'],
|
|
237
|
+
name: { zh: 'Groq', en: 'Groq' },
|
|
238
|
+
color: '#f55036',
|
|
239
|
+
icon: 'groq',
|
|
240
|
+
consoleUrl: 'https://console.groq.com/',
|
|
241
|
+
}),
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
// ============================================================================
|
|
245
|
+
// Hugging Face
|
|
246
|
+
// ============================================================================
|
|
247
|
+
export const huggingfaceAdapters = [
|
|
248
|
+
placeholderAdapter({
|
|
249
|
+
id: 'huggingface',
|
|
250
|
+
routes: ['huggingface'],
|
|
251
|
+
name: { zh: 'Hugging Face', en: 'Hugging Face' },
|
|
252
|
+
color: '#ffd21e',
|
|
253
|
+
icon: 'huggingface',
|
|
254
|
+
consoleUrl: 'https://huggingface.co/settings/billing',
|
|
255
|
+
}),
|
|
256
|
+
]
|
|
257
|
+
|
|
258
|
+
// ============================================================================
|
|
259
|
+
// Kimi Coding (already implemented in kimi_coding.js)
|
|
260
|
+
// Note: Kimi Coding has full implementation in kimi_coding.js
|
|
261
|
+
|
|
262
|
+
// ============================================================================
|
|
263
|
+
// Meta (Llama)
|
|
264
|
+
// ============================================================================
|
|
265
|
+
export const metaAdapters = [
|
|
266
|
+
placeholderAdapter({
|
|
267
|
+
id: 'meta',
|
|
268
|
+
routes: ['meta'],
|
|
269
|
+
name: { zh: 'Meta (Llama)', en: 'Meta (Llama)' },
|
|
270
|
+
color: '#0668e1',
|
|
271
|
+
icon: 'meta',
|
|
272
|
+
consoleUrl: 'https://llama.meta.com/',
|
|
273
|
+
}),
|
|
274
|
+
]
|
|
275
|
+
|
|
276
|
+
// ============================================================================
|
|
277
|
+
// MiniMax (International)
|
|
278
|
+
// ============================================================================
|
|
279
|
+
export const minimaxAdapters = [
|
|
280
|
+
placeholderAdapter({
|
|
281
|
+
id: 'minimax',
|
|
282
|
+
routes: ['minimax'],
|
|
283
|
+
name: { zh: 'MiniMax (国际)', en: 'MiniMax (International)' },
|
|
284
|
+
color: '#e21680',
|
|
285
|
+
icon: 'minimax',
|
|
286
|
+
consoleUrl: 'https://platform.minimax.io/console/usage',
|
|
287
|
+
}),
|
|
288
|
+
]
|
|
289
|
+
|
|
290
|
+
// ============================================================================
|
|
291
|
+
// MiniMax CN (already implemented in minimax_cn.js)
|
|
292
|
+
// Note: MiniMax CN has full implementation in minimax_cn.js
|
|
293
|
+
|
|
294
|
+
// ============================================================================
|
|
295
|
+
// Mistral AI
|
|
296
|
+
// ============================================================================
|
|
297
|
+
export const mistralAdapters = [
|
|
298
|
+
placeholderAdapter({
|
|
299
|
+
id: 'mistral',
|
|
300
|
+
routes: ['mistral'],
|
|
301
|
+
name: { zh: 'Mistral AI', en: 'Mistral AI' },
|
|
302
|
+
color: '#f97316',
|
|
303
|
+
icon: 'mistral',
|
|
304
|
+
consoleUrl: 'https://console.mistral.ai/',
|
|
305
|
+
}),
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
// ============================================================================
|
|
309
|
+
// Moonshot AI (International)
|
|
310
|
+
// ============================================================================
|
|
311
|
+
export const moonshotaiAdapters = [
|
|
312
|
+
placeholderAdapter({
|
|
313
|
+
id: 'moonshotai',
|
|
314
|
+
routes: ['moonshotai'],
|
|
315
|
+
name: { zh: 'Moonshot AI (国际)', en: 'Moonshot AI (International)' },
|
|
316
|
+
color: '#636ff6',
|
|
317
|
+
icon: 'moonshot',
|
|
318
|
+
consoleUrl: 'https://platform.moonshot.ai/',
|
|
319
|
+
}),
|
|
320
|
+
]
|
|
321
|
+
|
|
322
|
+
// ============================================================================
|
|
323
|
+
// Moonshot AI CN
|
|
324
|
+
// ============================================================================
|
|
325
|
+
export const moonshotaiCnAdapters = [
|
|
326
|
+
placeholderAdapter({
|
|
327
|
+
id: 'moonshotai-cn',
|
|
328
|
+
routes: ['moonshotai-cn'],
|
|
329
|
+
name: { zh: 'Moonshot AI (国内)', en: 'Moonshot AI (CN)' },
|
|
330
|
+
color: '#636ff6',
|
|
331
|
+
icon: 'moonshot',
|
|
332
|
+
consoleUrl: 'https://platform.moonshot.cn/',
|
|
333
|
+
}),
|
|
334
|
+
]
|
|
335
|
+
|
|
336
|
+
// ============================================================================
|
|
337
|
+
// NVIDIA NIM
|
|
338
|
+
// ============================================================================
|
|
339
|
+
export const nvidiaAdapters = [
|
|
340
|
+
placeholderAdapter({
|
|
341
|
+
id: 'nvidia',
|
|
342
|
+
routes: ['nvidia'],
|
|
343
|
+
name: { zh: 'NVIDIA NIM', en: 'NVIDIA NIM' },
|
|
344
|
+
color: '#76b900',
|
|
345
|
+
icon: 'nvidia',
|
|
346
|
+
consoleUrl: 'https://build.nvidia.com/',
|
|
347
|
+
}),
|
|
348
|
+
]
|
|
349
|
+
|
|
350
|
+
// ============================================================================
|
|
351
|
+
// OpenAI
|
|
352
|
+
// ============================================================================
|
|
353
|
+
export const openaiAdapters = [
|
|
354
|
+
placeholderAdapter({
|
|
355
|
+
id: 'openai',
|
|
356
|
+
routes: ['openai'],
|
|
357
|
+
name: { zh: 'OpenAI', en: 'OpenAI' },
|
|
358
|
+
color: '#10a37f',
|
|
359
|
+
icon: 'openai',
|
|
360
|
+
consoleUrl: 'https://platform.openai.com/usage',
|
|
361
|
+
}),
|
|
362
|
+
]
|
|
363
|
+
|
|
364
|
+
// ============================================================================
|
|
365
|
+
// OpenAI Codex
|
|
366
|
+
// ============================================================================
|
|
367
|
+
export const openaiCodexAdapters = [
|
|
368
|
+
placeholderAdapter({
|
|
369
|
+
id: 'openai-codex',
|
|
370
|
+
routes: ['openai-codex'],
|
|
371
|
+
name: { zh: 'OpenAI Codex', en: 'OpenAI Codex' },
|
|
372
|
+
color: '#10a37f',
|
|
373
|
+
icon: 'openai',
|
|
374
|
+
consoleUrl: 'https://platform.openai.com/',
|
|
375
|
+
}),
|
|
376
|
+
]
|
|
377
|
+
|
|
378
|
+
// ============================================================================
|
|
379
|
+
// OpenCode
|
|
380
|
+
// ============================================================================
|
|
381
|
+
export const opencodeAdapters = [
|
|
382
|
+
placeholderAdapter({
|
|
383
|
+
id: 'opencode',
|
|
384
|
+
routes: ['opencode'],
|
|
385
|
+
name: { zh: 'OpenCode', en: 'OpenCode' },
|
|
386
|
+
color: '#3b82f6',
|
|
387
|
+
icon: 'opencode',
|
|
388
|
+
consoleUrl: 'https://opencode.ai/',
|
|
389
|
+
}),
|
|
390
|
+
]
|
|
391
|
+
|
|
392
|
+
// ============================================================================
|
|
393
|
+
// OpenCode Go (already implemented in opencode_go.js)
|
|
394
|
+
// Note: OpenCode Go has full implementation in opencode_go.js
|
|
395
|
+
|
|
396
|
+
// ============================================================================
|
|
397
|
+
// OpenRouter
|
|
398
|
+
// ============================================================================
|
|
399
|
+
export const openrouterAdapters = [
|
|
400
|
+
placeholderAdapter({
|
|
401
|
+
id: 'openrouter',
|
|
402
|
+
routes: ['openrouter'],
|
|
403
|
+
name: { zh: 'OpenRouter', en: 'OpenRouter' },
|
|
404
|
+
color: '#6366f1',
|
|
405
|
+
icon: 'openrouter',
|
|
406
|
+
consoleUrl: 'https://openrouter.ai/activity',
|
|
407
|
+
}),
|
|
408
|
+
]
|
|
409
|
+
|
|
410
|
+
// ============================================================================
|
|
411
|
+
// Qwen Token Plan
|
|
412
|
+
// ============================================================================
|
|
413
|
+
export const qwenTokenPlanAdapters = [
|
|
414
|
+
placeholderAdapter({
|
|
415
|
+
id: 'qwen-token-plan',
|
|
416
|
+
routes: ['qwen-token-plan'],
|
|
417
|
+
name: { zh: '通义千问 Token Plan', en: 'Qwen Token Plan' },
|
|
418
|
+
color: '#ff6a00',
|
|
419
|
+
icon: 'qwen',
|
|
420
|
+
consoleUrl: 'https://platform.qianwenai.com/home/analytics/token-plan/individual',
|
|
421
|
+
}),
|
|
422
|
+
]
|
|
423
|
+
|
|
424
|
+
// ============================================================================
|
|
425
|
+
// Qwen Token Plan CN
|
|
426
|
+
// ============================================================================
|
|
427
|
+
export const qwenTokenPlanCnAdapters = [
|
|
428
|
+
placeholderAdapter({
|
|
429
|
+
id: 'qwen-token-plan-cn',
|
|
430
|
+
routes: ['qwen-token-plan-cn'],
|
|
431
|
+
name: { zh: '通义千问 Token Plan (国内)', en: 'Qwen Token Plan (CN)' },
|
|
432
|
+
color: '#ff6a00',
|
|
433
|
+
icon: 'qwen',
|
|
434
|
+
consoleUrl: 'https://platform.qianwenai.com/home/analytics/token-plan/individual',
|
|
435
|
+
}),
|
|
436
|
+
]
|
|
437
|
+
|
|
438
|
+
// ============================================================================
|
|
439
|
+
// Qwen Token Plan Individual
|
|
440
|
+
// ============================================================================
|
|
441
|
+
export const qwenTokenPlanIndividualAdapters = [
|
|
442
|
+
placeholderAdapter({
|
|
443
|
+
id: 'qwen-token-plan-individual',
|
|
444
|
+
routes: ['qwen-token-plan-individual'],
|
|
445
|
+
name: { zh: '通义千问个人版', en: 'Qwen Token Plan Individual' },
|
|
446
|
+
color: '#ff6a00',
|
|
447
|
+
icon: 'qwen',
|
|
448
|
+
consoleUrl: 'https://platform.qianwenai.com/home/analytics/token-plan/individual',
|
|
449
|
+
}),
|
|
450
|
+
]
|
|
451
|
+
|
|
452
|
+
// ============================================================================
|
|
453
|
+
// Radius
|
|
454
|
+
// ============================================================================
|
|
455
|
+
export const radiusAdapters = [
|
|
456
|
+
placeholderAdapter({
|
|
457
|
+
id: 'radius',
|
|
458
|
+
routes: ['radius'],
|
|
459
|
+
name: { zh: 'Radius', en: 'Radius' },
|
|
460
|
+
color: '#8b5cf6',
|
|
461
|
+
icon: 'radius',
|
|
462
|
+
consoleUrl: 'https://radius.ai/',
|
|
463
|
+
}),
|
|
464
|
+
]
|
|
465
|
+
|
|
466
|
+
// ============================================================================
|
|
467
|
+
// Together AI
|
|
468
|
+
// ============================================================================
|
|
469
|
+
export const togetherAdapters = [
|
|
470
|
+
placeholderAdapter({
|
|
471
|
+
id: 'together',
|
|
472
|
+
routes: ['together'],
|
|
473
|
+
name: { zh: 'Together AI', en: 'Together AI' },
|
|
474
|
+
color: '#0f766e',
|
|
475
|
+
icon: 'together',
|
|
476
|
+
consoleUrl: 'https://api.together.xyz/settings/billing',
|
|
477
|
+
}),
|
|
478
|
+
]
|
|
479
|
+
|
|
480
|
+
// ============================================================================
|
|
481
|
+
// TypeSafe
|
|
482
|
+
// ============================================================================
|
|
483
|
+
export const typesafeAdapters = [
|
|
484
|
+
placeholderAdapter({
|
|
485
|
+
id: 'typesafe',
|
|
486
|
+
routes: ['typesafe'],
|
|
487
|
+
name: { zh: 'TypeSafe', en: 'TypeSafe' },
|
|
488
|
+
color: '#3178c6',
|
|
489
|
+
icon: 'typescript',
|
|
490
|
+
consoleUrl: 'https://typesafe.io/',
|
|
491
|
+
}),
|
|
492
|
+
]
|
|
493
|
+
|
|
494
|
+
// ============================================================================
|
|
495
|
+
// Vercel AI Gateway
|
|
496
|
+
// ============================================================================
|
|
497
|
+
export const vercelAiGatewayAdapters = [
|
|
498
|
+
placeholderAdapter({
|
|
499
|
+
id: 'vercel-ai-gateway',
|
|
500
|
+
routes: ['vercel-ai-gateway'],
|
|
501
|
+
name: { zh: 'Vercel AI Gateway', en: 'Vercel AI Gateway' },
|
|
502
|
+
color: '#000000',
|
|
503
|
+
icon: 'vercel',
|
|
504
|
+
consoleUrl: 'https://vercel.com/dashboard',
|
|
505
|
+
}),
|
|
506
|
+
]
|
|
507
|
+
|
|
508
|
+
// ============================================================================
|
|
509
|
+
// xAI (Grok)
|
|
510
|
+
// ============================================================================
|
|
511
|
+
export const xaiAdapters = [
|
|
512
|
+
placeholderAdapter({
|
|
513
|
+
id: 'xai',
|
|
514
|
+
routes: ['xai'],
|
|
515
|
+
name: { zh: 'xAI (Grok)', en: 'xAI (Grok)' },
|
|
516
|
+
color: '#000000',
|
|
517
|
+
icon: 'xai',
|
|
518
|
+
consoleUrl: 'https://console.x.ai/',
|
|
519
|
+
}),
|
|
520
|
+
]
|
|
521
|
+
|
|
522
|
+
// ============================================================================
|
|
523
|
+
// Xiaomi (小米)
|
|
524
|
+
// ============================================================================
|
|
525
|
+
export const xiaomiAdapters = [
|
|
526
|
+
placeholderAdapter({
|
|
527
|
+
id: 'xiaomi',
|
|
528
|
+
routes: ['xiaomi'],
|
|
529
|
+
name: { zh: '小米', en: 'Xiaomi' },
|
|
530
|
+
color: '#ff6700',
|
|
531
|
+
icon: 'xiaomi',
|
|
532
|
+
consoleUrl: 'https://ai.xiaomi.com/',
|
|
533
|
+
}),
|
|
534
|
+
]
|
|
535
|
+
|
|
536
|
+
// ============================================================================
|
|
537
|
+
// Xiaomi Token Plan AMS
|
|
538
|
+
// ============================================================================
|
|
539
|
+
export const xiaomiTokenPlanAmsAdapters = [
|
|
540
|
+
placeholderAdapter({
|
|
541
|
+
id: 'xiaomi-token-plan-ams',
|
|
542
|
+
routes: ['xiaomi-token-plan-ams'],
|
|
543
|
+
name: { zh: '小米 Token Plan (阿姆斯特丹)', en: 'Xiaomi Token Plan (AMS)' },
|
|
544
|
+
color: '#ff6700',
|
|
545
|
+
icon: 'xiaomi',
|
|
546
|
+
consoleUrl: 'https://ai.xiaomi.com/',
|
|
547
|
+
}),
|
|
548
|
+
]
|
|
549
|
+
|
|
550
|
+
// ============================================================================
|
|
551
|
+
// Xiaomi Token Plan CN
|
|
552
|
+
// ============================================================================
|
|
553
|
+
export const xiaomiTokenPlanCnAdapters = [
|
|
554
|
+
placeholderAdapter({
|
|
555
|
+
id: 'xiaomi-token-plan-cn',
|
|
556
|
+
routes: ['xiaomi-token-plan-cn'],
|
|
557
|
+
name: { zh: '小米 Token Plan (国内)', en: 'Xiaomi Token Plan (CN)' },
|
|
558
|
+
color: '#ff6700',
|
|
559
|
+
icon: 'xiaomi',
|
|
560
|
+
consoleUrl: 'https://ai.xiaomi.com/',
|
|
561
|
+
}),
|
|
562
|
+
]
|
|
563
|
+
|
|
564
|
+
// ============================================================================
|
|
565
|
+
// Xiaomi Token Plan SGP
|
|
566
|
+
// ============================================================================
|
|
567
|
+
export const xiaomiTokenPlanSgpAdapters = [
|
|
568
|
+
placeholderAdapter({
|
|
569
|
+
id: 'xiaomi-token-plan-sgp',
|
|
570
|
+
routes: ['xiaomi-token-plan-sgp'],
|
|
571
|
+
name: { zh: '小米 Token Plan (新加坡)', en: 'Xiaomi Token Plan (SGP)' },
|
|
572
|
+
color: '#ff6700',
|
|
573
|
+
icon: 'xiaomi',
|
|
574
|
+
consoleUrl: 'https://ai.xiaomi.com/',
|
|
575
|
+
}),
|
|
576
|
+
]
|
|
577
|
+
|
|
578
|
+
// ============================================================================
|
|
579
|
+
// Zhipu ZAI (already implemented in zai.js)
|
|
580
|
+
// Note: Zhipu ZAI has full implementation in zai.js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Zhipu adapter.
|
|
2
|
+
* Zhipu ZAI adapter.
|
|
3
3
|
*
|
|
4
4
|
* Zhipu reports credit limits; it publishes no monetary balance. A limit
|
|
5
5
|
* carries `unit` (a length code) and `number` (how many of them), so
|
|
@@ -103,10 +103,10 @@ function readQuota({ route, body }) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
/** Zhipu's coding-plan routes: the CN plan and the international route. */
|
|
107
|
-
export const
|
|
106
|
+
/** Zhipu ZAI's coding-plan routes: the CN plan and the international route. */
|
|
107
|
+
export const zaiAdapters = [
|
|
108
108
|
defineAdapter({
|
|
109
|
-
id: '
|
|
109
|
+
id: 'zai-coding-cn',
|
|
110
110
|
routes: ['zai', 'zai-coding-cn'],
|
|
111
111
|
kind: KIND_QUOTA,
|
|
112
112
|
endpoint: 'https://open.bigmodel.cn/api/monitor/usage/quota/limit',
|
|
@@ -116,7 +116,7 @@ export const zhipuAdapters = [
|
|
|
116
116
|
consoleUrl: CONSOLE,
|
|
117
117
|
schedule: SCHEDULE,
|
|
118
118
|
display: {
|
|
119
|
-
name: { zh: '智谱
|
|
119
|
+
name: { zh: '智谱 ZAI', en: 'Zhipu ZAI' },
|
|
120
120
|
mark: { icon: 'zhipu', color: '#5668f5' },
|
|
121
121
|
},
|
|
122
122
|
fixtures: [
|
package/lib/providers.js
CHANGED
|
@@ -8,17 +8,55 @@
|
|
|
8
8
|
* module only collects them and answers "which adapter serves this route".
|
|
9
9
|
*
|
|
10
10
|
* The quantity a provider reports is not always money. DeepSeek reports a
|
|
11
|
-
* currency balance; MiniMax, Zhipu, Kimi, and OpenCode
|
|
12
|
-
* allowance. The `kind` field keeps the two apart so
|
|
13
|
-
* thing.
|
|
11
|
+
* currency balance; MiniMax (CN), Zhipu ZAI, Kimi Coding, and OpenCode Go
|
|
12
|
+
* report a subscription allowance. The `kind` field keeps the two apart so
|
|
13
|
+
* the UI can say the right thing.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { deepseekAdapters } from './providers/deepseek.js'
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { kimiCodingAdapters } from './providers/kimi_coding.js'
|
|
18
|
+
import { minimaxCnAdapters } from './providers/minimax_cn.js'
|
|
19
|
+
import { opencodeGoAdapters } from './providers/opencode_go.js'
|
|
20
|
+
import {
|
|
21
|
+
amazonBedrockAdapters,
|
|
22
|
+
anthropicAdapters,
|
|
23
|
+
antLingAdapters,
|
|
24
|
+
azureAdapters,
|
|
25
|
+
basetenAdapters,
|
|
26
|
+
cerebrasAdapters,
|
|
27
|
+
cloudflareAiGatewayAdapters,
|
|
28
|
+
cloudflareWorkersAiAdapters,
|
|
29
|
+
fireworksAdapters,
|
|
30
|
+
githubCopilotAdapters,
|
|
31
|
+
googleAdapters,
|
|
32
|
+
googleVertexAdapters,
|
|
33
|
+
groqAdapters,
|
|
34
|
+
huggingfaceAdapters,
|
|
35
|
+
metaAdapters,
|
|
36
|
+
minimaxAdapters,
|
|
37
|
+
mistralAdapters,
|
|
38
|
+
moonshotaiAdapters,
|
|
39
|
+
moonshotaiCnAdapters,
|
|
40
|
+
nvidiaAdapters,
|
|
41
|
+
openaiAdapters,
|
|
42
|
+
openaiCodexAdapters,
|
|
43
|
+
opencodeAdapters,
|
|
44
|
+
openrouterAdapters,
|
|
45
|
+
qwenTokenPlanAdapters,
|
|
46
|
+
qwenTokenPlanCnAdapters,
|
|
47
|
+
qwenTokenPlanIndividualAdapters,
|
|
48
|
+
radiusAdapters,
|
|
49
|
+
togetherAdapters,
|
|
50
|
+
typesafeAdapters,
|
|
51
|
+
vercelAiGatewayAdapters,
|
|
52
|
+
xaiAdapters,
|
|
53
|
+
xiaomiAdapters,
|
|
54
|
+
xiaomiTokenPlanAmsAdapters,
|
|
55
|
+
xiaomiTokenPlanCnAdapters,
|
|
56
|
+
xiaomiTokenPlanSgpAdapters,
|
|
57
|
+
} from './providers/placeholder.js'
|
|
20
58
|
import { KIND_AMOUNT, KIND_QUOTA } from './providers/shared.js'
|
|
21
|
-
import {
|
|
59
|
+
import { zaiAdapters } from './providers/zai.js'
|
|
22
60
|
|
|
23
61
|
/**
|
|
24
62
|
* @typedef {object} BalanceView
|
|
@@ -80,11 +118,49 @@ import { zhipuAdapters } from './providers/zhipu.js'
|
|
|
80
118
|
* @type {readonly ProviderAdapter[]}
|
|
81
119
|
*/
|
|
82
120
|
export const PROVIDER_ADAPTERS = Object.freeze([
|
|
121
|
+
// Fully implemented adapters
|
|
83
122
|
...deepseekAdapters,
|
|
123
|
+
...minimaxCnAdapters,
|
|
124
|
+
...zaiAdapters,
|
|
125
|
+
...kimiCodingAdapters,
|
|
126
|
+
...opencodeGoAdapters,
|
|
127
|
+
// Placeholder adapters (unsupported status)
|
|
128
|
+
...amazonBedrockAdapters,
|
|
129
|
+
...antLingAdapters,
|
|
130
|
+
...anthropicAdapters,
|
|
131
|
+
...azureAdapters,
|
|
132
|
+
...basetenAdapters,
|
|
133
|
+
...cerebrasAdapters,
|
|
134
|
+
...cloudflareAiGatewayAdapters,
|
|
135
|
+
...cloudflareWorkersAiAdapters,
|
|
136
|
+
...fireworksAdapters,
|
|
137
|
+
...githubCopilotAdapters,
|
|
138
|
+
...googleAdapters,
|
|
139
|
+
...googleVertexAdapters,
|
|
140
|
+
...groqAdapters,
|
|
141
|
+
...huggingfaceAdapters,
|
|
142
|
+
...metaAdapters,
|
|
84
143
|
...minimaxAdapters,
|
|
85
|
-
...
|
|
86
|
-
...
|
|
144
|
+
...mistralAdapters,
|
|
145
|
+
...moonshotaiAdapters,
|
|
146
|
+
...moonshotaiCnAdapters,
|
|
147
|
+
...nvidiaAdapters,
|
|
148
|
+
...openaiAdapters,
|
|
149
|
+
...openaiCodexAdapters,
|
|
87
150
|
...opencodeAdapters,
|
|
151
|
+
...openrouterAdapters,
|
|
152
|
+
...qwenTokenPlanAdapters,
|
|
153
|
+
...qwenTokenPlanCnAdapters,
|
|
154
|
+
...qwenTokenPlanIndividualAdapters,
|
|
155
|
+
...radiusAdapters,
|
|
156
|
+
...togetherAdapters,
|
|
157
|
+
...typesafeAdapters,
|
|
158
|
+
...vercelAiGatewayAdapters,
|
|
159
|
+
...xaiAdapters,
|
|
160
|
+
...xiaomiAdapters,
|
|
161
|
+
...xiaomiTokenPlanAmsAdapters,
|
|
162
|
+
...xiaomiTokenPlanCnAdapters,
|
|
163
|
+
...xiaomiTokenPlanSgpAdapters,
|
|
88
164
|
])
|
|
89
165
|
|
|
90
166
|
/** Route to the adapter serving it, resolved once at load. */
|