dsh-keys-manager 0.2.6 → 0.2.9
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/CHANGELOG.md +52 -0
- package/README.md +219 -269
- package/README.zh-CN.md +142 -136
- package/lib/client/format.d.ts +27 -3
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/types.d.ts +10 -2
- package/lib/client.js +155 -7
- package/lib/domain.d.ts +30 -5
- package/lib/index.d.ts +66 -5
- package/lib/index.js +295 -78
- package/lib/index.js.map +1 -1
- package/lib/quota/cache.d.ts +61 -0
- package/lib/quota/cache.js +88 -0
- package/lib/quota/cache.js.map +1 -0
- package/lib/quota/fetch.d.ts +33 -0
- package/lib/quota/fetch.js +36 -0
- package/lib/quota/fetch.js.map +1 -0
- package/lib/quota/model.d.ts +60 -0
- package/lib/quota/model.js +62 -0
- package/lib/quota/model.js.map +1 -0
- package/lib/quota/providers.d.ts +89 -0
- package/lib/quota/providers.js +533 -0
- package/lib/quota/providers.js.map +1 -0
- package/locale/en.json +7 -1
- package/locale/zh.json +7 -1
- package/package.json +15 -15
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor usage endpoints, one probe per route id.
|
|
3
|
+
*
|
|
4
|
+
* Probes are deliberately lenient: private endpoints drift, fields come back
|
|
5
|
+
* missing or under aliases, and a card must degrade to `absent`/`error`
|
|
6
|
+
* instead of throwing. This release ships Claude, Codex, Z.AI, Kimi, MiniMax,
|
|
7
|
+
* OpenCode Go, Command Code, xAI (SuperGrok) and Cline; any other route id has
|
|
8
|
+
* no probe and resolves to `absent`, never to a guessed endpoint. Nothing here
|
|
9
|
+
* writes cooldown or failure state.
|
|
10
|
+
*
|
|
11
|
+
* @module dsh-keys-manager/quota/providers
|
|
12
|
+
*/
|
|
13
|
+
import { readQuotaJson } from './fetch.js';
|
|
14
|
+
import { fractionFromUsed, resetFrom } from './model.js';
|
|
15
|
+
const CLAUDE_USAGE_URL = 'https://api.anthropic.com/api/oauth/usage';
|
|
16
|
+
const CLAUDE_BETA_HEADER = 'oauth-2025-04-20';
|
|
17
|
+
const CODEX_USAGE_URL = 'https://chatgpt.com/backend-api/wham/usage';
|
|
18
|
+
const ZAI_QUOTA_URL = 'https://api.z.ai/api/monitor/usage/quota/limit';
|
|
19
|
+
const KIMI_USAGE_URL = 'https://api.kimi.com/coding/v1/usages';
|
|
20
|
+
const MINIMAX_QUOTA_URL = 'https://api.minimax.io/v1/api/openplatform/coding_plan/remains';
|
|
21
|
+
const OPENCODE_GO_USAGE_URL = 'https://opencode.ai/zen/go/v1/usage';
|
|
22
|
+
const COMMANDCODE_CREDITS_URL = 'https://api.commandcode.ai/alpha/billing/credits';
|
|
23
|
+
const XAI_BILLING_URL = 'https://cli-chat-proxy.grok.com/v1/billing?format=credits';
|
|
24
|
+
/**
|
|
25
|
+
* The Grok CLI billing proxy sits behind the CLI product gate: without this
|
|
26
|
+
* header the endpoint answers an auth error that would read as `unauthorized`
|
|
27
|
+
* (plan risk R2). The `User-Agent` is part of the same gate.
|
|
28
|
+
*/
|
|
29
|
+
const XAI_CLI_TOKEN_AUTH = 'xai-grok-cli';
|
|
30
|
+
const XAI_CLI_USER_AGENT = 'grok-cli/0.1 (dsh-keys-manager)';
|
|
31
|
+
const CLINE_USAGE_URL = 'https://api.cline.bot/api/v1/users/me/plan/usage-limits';
|
|
32
|
+
/**
|
|
33
|
+
* Cline's desktop client headers, as magpie sends them
|
|
34
|
+
* (`internal/provider/cline.go`): the API gates product-only surfaces on
|
|
35
|
+
* `X-CLIENT-TYPE`, and `X-CLIENT-VERSION` is the desktop release magpie
|
|
36
|
+
* claims. They are vendor constants, not credentials.
|
|
37
|
+
*/
|
|
38
|
+
const CLINE_CLIENT_VERSION = '3.5.54';
|
|
39
|
+
// shortcut: version pinned from magpie 3.5.54; bump it if the endpoint starts version-gating
|
|
40
|
+
const CLINE_CLIENT_HEADERS = Object.freeze({
|
|
41
|
+
Accept: 'application/json',
|
|
42
|
+
'HTTP-Referer': 'https://cline.bot',
|
|
43
|
+
'X-Title': 'Cline',
|
|
44
|
+
'X-IS-MULTIROOT': 'false',
|
|
45
|
+
'X-CLIENT-TYPE': 'cline-desktop',
|
|
46
|
+
'X-CLIENT-VERSION': CLINE_CLIENT_VERSION,
|
|
47
|
+
'User-Agent': `Cline/${CLINE_CLIENT_VERSION}`,
|
|
48
|
+
});
|
|
49
|
+
/** A window longer than three days is the weekly pool; the short one is the session. */
|
|
50
|
+
const WEEK_SECONDS_THRESHOLD = 3 * 24 * 60 * 60;
|
|
51
|
+
function asRecord(value) {
|
|
52
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
53
|
+
? value
|
|
54
|
+
: undefined;
|
|
55
|
+
}
|
|
56
|
+
/** Numbers arrive as numbers or numeric strings depending on the endpoint. */
|
|
57
|
+
function toNumber(value) {
|
|
58
|
+
if (typeof value === 'number')
|
|
59
|
+
return Number.isFinite(value) ? value : undefined;
|
|
60
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
61
|
+
const parsed = Number(value);
|
|
62
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build the snapshot from a classified read. An extraction returns either the
|
|
68
|
+
* windows or a reason string; an empty result is a parse failure, never an
|
|
69
|
+
* "ok" with zero windows.
|
|
70
|
+
*/
|
|
71
|
+
function snapshotFromRead(read, extract) {
|
|
72
|
+
const fetchedAt = Date.now();
|
|
73
|
+
if (!read.ok)
|
|
74
|
+
return { status: read.status, fetchedAt, windows: [], reason: read.reason };
|
|
75
|
+
const extracted = extract(read.body);
|
|
76
|
+
if (typeof extracted === 'string') {
|
|
77
|
+
return { status: 'error', fetchedAt, windows: [], reason: extracted };
|
|
78
|
+
}
|
|
79
|
+
if (extracted.length === 0) {
|
|
80
|
+
return { status: 'error', fetchedAt, windows: [], reason: 'unrecognized usage payload' };
|
|
81
|
+
}
|
|
82
|
+
return { status: 'ok', fetchedAt, windows: extracted };
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Lenient reset-time read across aliases: ISO strings, numeric strings, epoch
|
|
86
|
+
* seconds or epoch milliseconds (the fallback covers count-less payloads).
|
|
87
|
+
*/
|
|
88
|
+
function resetOf(row, keys) {
|
|
89
|
+
for (const key of keys) {
|
|
90
|
+
const value = row[key];
|
|
91
|
+
const direct = resetFrom(value);
|
|
92
|
+
if (direct !== undefined)
|
|
93
|
+
return direct;
|
|
94
|
+
const numeric = toNumber(value);
|
|
95
|
+
if (numeric !== undefined)
|
|
96
|
+
return resetFrom(numeric);
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
/** Used fraction from a used/limit counter pair; `undefined` when unusable. */
|
|
101
|
+
function fractionFromCounts(used, limit) {
|
|
102
|
+
// A negative used count (remaining above the limit) is not "0% used": drop
|
|
103
|
+
// the window instead of rendering a fake empty bar.
|
|
104
|
+
if (used === undefined || limit === undefined || limit <= 0 || used < 0)
|
|
105
|
+
return undefined;
|
|
106
|
+
return Math.min(1, used / limit);
|
|
107
|
+
}
|
|
108
|
+
/** A span under a day is the session window; longer spans are the weekly pool. */
|
|
109
|
+
const SESSION_MAX_MS = 24 * 60 * 60 * 1000;
|
|
110
|
+
function windowIdForSpan(spanMs) {
|
|
111
|
+
return spanMs < SESSION_MAX_MS ? 'session' : 'week';
|
|
112
|
+
}
|
|
113
|
+
/** Window span in milliseconds from a `duration` + unit pair (hours/days/weeks). */
|
|
114
|
+
function spanFromDuration(duration, unit) {
|
|
115
|
+
if (duration === undefined || unit.length === 0)
|
|
116
|
+
return undefined;
|
|
117
|
+
const upper = unit.toUpperCase();
|
|
118
|
+
if (upper.includes('MINUTE'))
|
|
119
|
+
return duration * 60_000;
|
|
120
|
+
if (upper.includes('HOUR'))
|
|
121
|
+
return duration * 3_600_000;
|
|
122
|
+
if (upper.includes('DAY'))
|
|
123
|
+
return duration * 86_400_000;
|
|
124
|
+
if (upper.includes('WEEK'))
|
|
125
|
+
return duration * 7 * 86_400_000;
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
/** Keep the most-binding window per id: several model buckets share one plan quota. */
|
|
129
|
+
function tighterWindow(current, next) {
|
|
130
|
+
return current === undefined || next.usedFraction > current.usedFraction ? next : current;
|
|
131
|
+
}
|
|
132
|
+
/** Claude OAuth plan usage: `five_hour` is the session, `seven_day` the week. */
|
|
133
|
+
export const claudeQuotaProbe = async ({ token, signal, fetch }) => {
|
|
134
|
+
const read = await readQuotaJson(CLAUDE_USAGE_URL, { Authorization: `Bearer ${token}`, 'anthropic-beta': CLAUDE_BETA_HEADER }, { fetch, signal });
|
|
135
|
+
return snapshotFromRead(read, (body) => {
|
|
136
|
+
const windows = [];
|
|
137
|
+
const add = (raw, id) => {
|
|
138
|
+
const row = asRecord(raw);
|
|
139
|
+
if (row === undefined)
|
|
140
|
+
return;
|
|
141
|
+
// Anthropic reports USED percent, so the inversion lives in the normalizer.
|
|
142
|
+
const usedPercent = toNumber(row.utilization);
|
|
143
|
+
const usedFraction = usedPercent === undefined ? undefined : fractionFromUsed(usedPercent);
|
|
144
|
+
const resetsAt = resetFrom(row.resets_at ?? row.reset_at ?? row.resetsAt ?? row.resetAt);
|
|
145
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
146
|
+
return;
|
|
147
|
+
windows.push({ id, usedFraction, resetsAt });
|
|
148
|
+
};
|
|
149
|
+
add(body.five_hour, 'session');
|
|
150
|
+
add(body.seven_day, 'week');
|
|
151
|
+
return windows;
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
/** Codex / ChatGPT plan usage: primary and secondary windows, classified by duration. */
|
|
155
|
+
export const codexQuotaProbe = async ({ token, accountId, signal, fetch }) => {
|
|
156
|
+
const headers = { Authorization: `Bearer ${token}` };
|
|
157
|
+
if (accountId !== undefined && accountId.length > 0)
|
|
158
|
+
headers['chatgpt-account-id'] = accountId;
|
|
159
|
+
const read = await readQuotaJson(CODEX_USAGE_URL, headers, { fetch, signal });
|
|
160
|
+
return snapshotFromRead(read, (body) => {
|
|
161
|
+
const rateLimit = asRecord(body.rate_limit) ?? asRecord(body.rateLimit) ?? {};
|
|
162
|
+
// Both slots can describe the same window (a 5h primary and a 5h
|
|
163
|
+
// secondary), so collapse repeated ids and keep the tighter one.
|
|
164
|
+
const windows = new Map();
|
|
165
|
+
const add = (raw, fallback) => {
|
|
166
|
+
const row = asRecord(raw);
|
|
167
|
+
if (row === undefined)
|
|
168
|
+
return;
|
|
169
|
+
const usedPercent = toNumber(row.used_percent ?? row.usedPercent);
|
|
170
|
+
const usedFraction = usedPercent === undefined ? undefined : fractionFromUsed(usedPercent);
|
|
171
|
+
const resetsAt = resetFrom(row.reset_at ?? row.resets_at ?? row.resetAt ?? row.resetsAt) ??
|
|
172
|
+
resetAfterSeconds(toNumber(row.reset_after_seconds ?? row.resetAfterSeconds));
|
|
173
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
174
|
+
return;
|
|
175
|
+
const seconds = toNumber(row.limit_window_seconds ?? row.limitWindowSeconds);
|
|
176
|
+
const id = seconds === undefined ? fallback : seconds >= WEEK_SECONDS_THRESHOLD ? 'week' : 'session';
|
|
177
|
+
windows.set(id, tighterWindow(windows.get(id), { id, usedFraction, resetsAt }));
|
|
178
|
+
};
|
|
179
|
+
add(rateLimit.primary_window, 'session');
|
|
180
|
+
add(rateLimit.secondary_window, 'week');
|
|
181
|
+
return [...windows.values()];
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
function resetAfterSeconds(seconds) {
|
|
185
|
+
return seconds === undefined || seconds <= 0 ? undefined : Date.now() + seconds * 1000;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Z.AI / Zhipu GLM coding-plan quota. The key is sent verbatim, with no
|
|
189
|
+
* `Bearer` prefix, and `percentage` is USED percent. `unit` 3 = hours,
|
|
190
|
+
* 4 = days, 5 = months, 6 = weeks; `TIME_LIMIT` buckets only map when their
|
|
191
|
+
* unit says hours or weeks (the monthly MCP-call quota stays unmapped).
|
|
192
|
+
*/
|
|
193
|
+
export const zaiQuotaProbe = async ({ token, signal, fetch }) => {
|
|
194
|
+
const read = await readQuotaJson(ZAI_QUOTA_URL, { Authorization: token, 'Content-Type': 'application/json' }, { fetch, signal });
|
|
195
|
+
return snapshotFromRead(read, (body) => {
|
|
196
|
+
if (body.success === false)
|
|
197
|
+
return 'usage request rejected';
|
|
198
|
+
const data = asRecord(body.data) ?? {};
|
|
199
|
+
const limits = Array.isArray(data.limits) ? data.limits : [];
|
|
200
|
+
const windows = new Map();
|
|
201
|
+
for (const raw of limits) {
|
|
202
|
+
const row = asRecord(raw);
|
|
203
|
+
if (row === undefined)
|
|
204
|
+
continue;
|
|
205
|
+
const unit = toNumber(row.unit);
|
|
206
|
+
const id = unit === 3 ? 'session' : unit === 6 ? 'week' : undefined;
|
|
207
|
+
if (id === undefined)
|
|
208
|
+
continue;
|
|
209
|
+
// `percentage` is a server-rounded integer; the counters are exact.
|
|
210
|
+
// A present-but-invalid counter pair (negative spend) drops the window
|
|
211
|
+
// instead of falling back to the rounded percentage — only a MISSING
|
|
212
|
+
// field may fall back.
|
|
213
|
+
const spent = toNumber(row.currentValue);
|
|
214
|
+
const usedFraction = spent !== undefined
|
|
215
|
+
? fractionFromCounts(spent, toNumber(row.usage))
|
|
216
|
+
: fractionFromUsed(toNumber(row.percentage) ?? Number.NaN);
|
|
217
|
+
const resetsAt = resetOf(row, ['nextResetTime', 'next_reset_time']);
|
|
218
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
219
|
+
continue;
|
|
220
|
+
windows.set(id, tighterWindow(windows.get(id), { id, usedFraction, resetsAt }));
|
|
221
|
+
}
|
|
222
|
+
return [...windows.values()];
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Kimi Code quota: the aggregate `usage` object is the weekly window, each
|
|
227
|
+
* `limits[]` row is classified by its `window.duration` + `time_unit`.
|
|
228
|
+
* Numbers arrive as strings.
|
|
229
|
+
*/
|
|
230
|
+
export const kimiQuotaProbe = async ({ token, signal, fetch }) => {
|
|
231
|
+
const read = await readQuotaJson(KIMI_USAGE_URL, { Authorization: `Bearer ${token}` }, { fetch, signal });
|
|
232
|
+
return snapshotFromRead(read, (body) => {
|
|
233
|
+
const windows = new Map();
|
|
234
|
+
const add = (usedFraction, resetsAt, id) => {
|
|
235
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
236
|
+
return;
|
|
237
|
+
windows.set(id, tighterWindow(windows.get(id), { id, usedFraction, resetsAt }));
|
|
238
|
+
};
|
|
239
|
+
const usage = asRecord(body.usage);
|
|
240
|
+
if (usage !== undefined) {
|
|
241
|
+
const limit = toNumber(usage.limit);
|
|
242
|
+
const used = toNumber(usage.used) ??
|
|
243
|
+
(toNumber(usage.remaining) !== undefined && limit !== undefined
|
|
244
|
+
? limit - toNumber(usage.remaining)
|
|
245
|
+
: undefined);
|
|
246
|
+
add(fractionFromCounts(used, limit), resetOf(usage, ['resetTime', 'reset_time']), 'week');
|
|
247
|
+
}
|
|
248
|
+
const limits = Array.isArray(body.limits) ? body.limits : [];
|
|
249
|
+
for (const raw of limits) {
|
|
250
|
+
const row = asRecord(raw);
|
|
251
|
+
if (row === undefined)
|
|
252
|
+
continue;
|
|
253
|
+
const window = asRecord(row.window) ?? {};
|
|
254
|
+
const detail = asRecord(row.detail) ?? row;
|
|
255
|
+
const spanMs = spanFromDuration(toNumber(window.duration), String(window.time_unit ?? window.timeUnit ?? ''));
|
|
256
|
+
if (spanMs === undefined)
|
|
257
|
+
continue;
|
|
258
|
+
const limit = toNumber(detail.limit);
|
|
259
|
+
const used = toNumber(detail.used) ??
|
|
260
|
+
(toNumber(detail.remaining) !== undefined && limit !== undefined
|
|
261
|
+
? limit - toNumber(detail.remaining)
|
|
262
|
+
: undefined);
|
|
263
|
+
add(fractionFromCounts(used, limit), resetOf(detail, ['resetTime', 'reset_time']), windowIdForSpan(spanMs));
|
|
264
|
+
}
|
|
265
|
+
return [...windows.values()];
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* MiniMax coding-plan quota. The vendor answers HTTP 200 even for a rejected
|
|
270
|
+
* credential, so `base_resp.status_code` is the real success signal. Plan-wide
|
|
271
|
+
* buckets repeat the same two windows, so the most-binding row wins.
|
|
272
|
+
*/
|
|
273
|
+
export const minimaxQuotaProbe = async ({ token, signal, fetch }) => {
|
|
274
|
+
const read = await readQuotaJson(MINIMAX_QUOTA_URL, { Authorization: `Bearer ${token}` }, { fetch, signal });
|
|
275
|
+
return snapshotFromRead(read, (body) => {
|
|
276
|
+
const baseResp = asRecord(body.base_resp);
|
|
277
|
+
if (baseResp !== undefined && toNumber(baseResp.status_code) !== 0) {
|
|
278
|
+
return `usage request rejected (${String(baseResp.status_code)})`;
|
|
279
|
+
}
|
|
280
|
+
const rows = Array.isArray(body.model_remains) ? body.model_remains : [];
|
|
281
|
+
const windows = new Map();
|
|
282
|
+
for (const raw of rows) {
|
|
283
|
+
const row = asRecord(raw);
|
|
284
|
+
if (row === undefined)
|
|
285
|
+
continue;
|
|
286
|
+
const add = (id, total, usage, remaining, endTime, remainsTime) => {
|
|
287
|
+
const limit = toNumber(row[total]);
|
|
288
|
+
const used = toNumber(row[usage]);
|
|
289
|
+
const left = toNumber(row[remaining]);
|
|
290
|
+
// The remaining-based fallback is for a MISSING usage counter only: a
|
|
291
|
+
// present-but-negative count is corrupt data, and deriving 0% from it
|
|
292
|
+
// would render a healthy bar for a payload we cannot interpret.
|
|
293
|
+
const usedFraction = used !== undefined
|
|
294
|
+
? fractionFromCounts(used, limit)
|
|
295
|
+
: left !== undefined && limit !== undefined && limit > 0 && left <= limit
|
|
296
|
+
? Math.min(1, 1 - left / limit)
|
|
297
|
+
: undefined;
|
|
298
|
+
const resetsAt = resetOf(row, [endTime]) ?? resetAfterMs(toNumber(row[remainsTime]));
|
|
299
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
300
|
+
return;
|
|
301
|
+
windows.set(id, tighterWindow(windows.get(id), { id, usedFraction, resetsAt }));
|
|
302
|
+
};
|
|
303
|
+
add('session', 'current_interval_total_count', 'current_interval_usage_count', 'current_interval_remaining_count', 'end_time', 'remains_time');
|
|
304
|
+
add('week', 'current_weekly_total_count', 'current_weekly_usage_count', 'current_weekly_remaining_count', 'weekly_end_time', 'weekly_remains_time');
|
|
305
|
+
}
|
|
306
|
+
return [...windows.values()];
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
/** Relative delays are reported in milliseconds; only positives are usable. */
|
|
310
|
+
function resetAfterMs(ms) {
|
|
311
|
+
return ms === undefined || ms <= 0 ? undefined : Date.now() + ms;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* OpenCode Go quota. `percent` is USED percent, `resetsAt` an ISO stamp, and
|
|
315
|
+
* `status: 'rate-limited'` outranks the percent. The monthly window anchors on
|
|
316
|
+
* the subscription anniversary, so it is deliberately not mapped to `week`.
|
|
317
|
+
*/
|
|
318
|
+
export const opencodeGoQuotaProbe = async ({ token, signal, fetch }) => {
|
|
319
|
+
const read = await readQuotaJson(OPENCODE_GO_USAGE_URL, { Authorization: `Bearer ${token}` }, { fetch, signal });
|
|
320
|
+
return snapshotFromRead(read, (body) => {
|
|
321
|
+
const usage = asRecord(body.usage) ?? {};
|
|
322
|
+
const windows = [];
|
|
323
|
+
const add = (raw, id) => {
|
|
324
|
+
const row = asRecord(raw);
|
|
325
|
+
if (row === undefined)
|
|
326
|
+
return;
|
|
327
|
+
const rateLimited = row.status === 'rate-limited';
|
|
328
|
+
const usedFraction = rateLimited ? 1 : fractionFromUsed(toNumber(row.percent) ?? Number.NaN);
|
|
329
|
+
const resetsAt = resetOf(row, ['resetsAt', 'resets_at']);
|
|
330
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
331
|
+
return;
|
|
332
|
+
windows.push({ id, usedFraction, resetsAt });
|
|
333
|
+
};
|
|
334
|
+
add(usage.rolling, 'session');
|
|
335
|
+
add(usage.weekly, 'week');
|
|
336
|
+
return windows;
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Command Code plan windows. The CLI's account route reports a credit balance
|
|
341
|
+
* plus `windowLimits.{fiveHour,weekly}` of `{ used, cap, resetAt }`; a
|
|
342
|
+
* pay-as-you-go account carries only the balance, which has no window at all
|
|
343
|
+
* and therefore no usage the card can render — that case is `error`, never a
|
|
344
|
+
* fabricated 0%.
|
|
345
|
+
*
|
|
346
|
+
* shortcut: the org pool needs `/alpha/whoami` first to learn `orgId`; this
|
|
347
|
+
* probe reads the personal balance only and adds the org query when a managed
|
|
348
|
+
* org account must show its own pool.
|
|
349
|
+
*/
|
|
350
|
+
export const commandcodeQuotaProbe = async ({ token, signal, fetch }) => {
|
|
351
|
+
const read = await readQuotaJson(COMMANDCODE_CREDITS_URL, { Authorization: `Bearer ${token}`, Accept: 'application/json' }, { fetch, signal });
|
|
352
|
+
return snapshotFromRead(read, (rawBody) => {
|
|
353
|
+
// Account routes answer `{ data: … }`; accept an unwrapped body too.
|
|
354
|
+
const body = asRecord(rawBody.data) ?? rawBody;
|
|
355
|
+
const windowLimits = asRecord(body.windowLimits);
|
|
356
|
+
if (windowLimits === undefined)
|
|
357
|
+
return 'credit balance carries no usage window';
|
|
358
|
+
const windows = [];
|
|
359
|
+
const add = (raw, id) => {
|
|
360
|
+
const row = asRecord(raw);
|
|
361
|
+
if (row === undefined)
|
|
362
|
+
return;
|
|
363
|
+
const usedFraction = fractionFromCounts(toNumber(row.used), toNumber(row.cap));
|
|
364
|
+
const resetsAt = resetOf(row, ['resetAt', 'reset_at', 'resetsAt']);
|
|
365
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
366
|
+
return;
|
|
367
|
+
windows.push({ id, usedFraction, resetsAt });
|
|
368
|
+
};
|
|
369
|
+
add(windowLimits.fiveHour, 'session');
|
|
370
|
+
add(windowLimits.weekly, 'week');
|
|
371
|
+
return windows;
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* SuperGrok (xAI OAuth) weekly credits through the Grok CLI billing proxy.
|
|
376
|
+
* The payload is `{ config: { currentPeriod: { start, end, type } ,
|
|
377
|
+
* creditUsagePercent, isUnifiedBillingUser } }`; a fresh weekly period omits
|
|
378
|
+
* the percent, which means 0 % used while that period is still open.
|
|
379
|
+
*
|
|
380
|
+
* Only an explicit WEEK period maps: this UI has `session` and `week` windows,
|
|
381
|
+
* and a monthly included quota is neither. A unified-billing account needs a
|
|
382
|
+
* second (default) billing payload to say which counter gates requests — this
|
|
383
|
+
* probe reads the credits payload alone, so unified is `error` rather than a
|
|
384
|
+
* week that may not apply.
|
|
385
|
+
*/
|
|
386
|
+
export const xaiQuotaProbe = async ({ token, signal, fetch }) => {
|
|
387
|
+
const read = await readQuotaJson(XAI_BILLING_URL, {
|
|
388
|
+
Authorization: `Bearer ${token}`,
|
|
389
|
+
Accept: 'application/json',
|
|
390
|
+
'X-XAI-Token-Auth': XAI_CLI_TOKEN_AUTH,
|
|
391
|
+
'User-Agent': XAI_CLI_USER_AGENT,
|
|
392
|
+
}, { fetch, signal });
|
|
393
|
+
return snapshotFromRead(read, (body) => {
|
|
394
|
+
const config = asRecord(body.config) ?? body;
|
|
395
|
+
const period = asRecord(config.currentPeriod);
|
|
396
|
+
if (period === undefined)
|
|
397
|
+
return 'no weekly credits period';
|
|
398
|
+
const type = typeof period.type === 'string' ? period.type.toUpperCase() : '';
|
|
399
|
+
if (type.length === 0)
|
|
400
|
+
return 'missing billing period type';
|
|
401
|
+
if (!type.includes('WEEK'))
|
|
402
|
+
return `unsupported billing period (${type})`;
|
|
403
|
+
// A unified account keeps a weekly credits pool *and* a monthly included
|
|
404
|
+
// quota; an inferred weekly percent there is not usage this UI can trust
|
|
405
|
+
// (reference: xai-oauth.ts drops it unless the monthly payload proves there
|
|
406
|
+
// is no monthly quota). Never invent 0 % for it.
|
|
407
|
+
if (config.isUnifiedBillingUser === true)
|
|
408
|
+
return 'unified billing hides the weekly window';
|
|
409
|
+
const resetsAt = resetOf(period, ['end']);
|
|
410
|
+
if (resetsAt === undefined)
|
|
411
|
+
return 'no weekly credits reset time';
|
|
412
|
+
const percent = toNumber(config.creditUsagePercent);
|
|
413
|
+
const usedFraction = percent === undefined
|
|
414
|
+
? resetsAt > Date.now() ? 0 : undefined
|
|
415
|
+
: fractionFromUsed(percent);
|
|
416
|
+
if (usedFraction === undefined)
|
|
417
|
+
return 'no usable weekly credits percent';
|
|
418
|
+
return [{ id: 'week', usedFraction, resetsAt }];
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* ClinePass limits, read with the stored Cline API key exactly as Cline's own
|
|
423
|
+
* client reads them (magpie `internal/provider/cline_usage.go`): the endpoint
|
|
424
|
+
* answers a key as it answers an account. `limits[]` carries `type`
|
|
425
|
+
* (`five_hour` / `weekly` / `monthly`), `percentUsed` (USED percent) and an
|
|
426
|
+
* ISO `resetsAt`.
|
|
427
|
+
*
|
|
428
|
+
* The monthly limit has no window in this UI (only `session` and `week`), so
|
|
429
|
+
* it is dropped; an account whose only limit is monthly reads `error`. A 404
|
|
430
|
+
* is Cline's "no ClinePass on this account" and stays `absent`.
|
|
431
|
+
*
|
|
432
|
+
* shortcut: the credit balance needs `/users/me` and then
|
|
433
|
+
* `/users/{id}/balance` (two more calls) and is not a window; add it only if a
|
|
434
|
+
* card must show the remaining dollars.
|
|
435
|
+
*/
|
|
436
|
+
export const clineQuotaProbe = async ({ token, signal, fetch }) => {
|
|
437
|
+
const read = await readQuotaJson(CLINE_USAGE_URL, { ...CLINE_CLIENT_HEADERS, Authorization: `Bearer ${token}` }, { fetch, signal });
|
|
438
|
+
return snapshotFromRead(read, (body) => {
|
|
439
|
+
// Cline wraps every answer in `{ success, error, data }`.
|
|
440
|
+
if (body.success === false)
|
|
441
|
+
return 'usage request rejected';
|
|
442
|
+
const data = asRecord(body.data) ?? body;
|
|
443
|
+
const limits = Array.isArray(data.limits) ? data.limits : [];
|
|
444
|
+
// A plan can list more than one row per window; consumers `find()` the
|
|
445
|
+
// first match, so collapse to the tighter fraction instead of letting a
|
|
446
|
+
// loose row that arrives first win.
|
|
447
|
+
const windows = new Map();
|
|
448
|
+
for (const raw of limits) {
|
|
449
|
+
const row = asRecord(raw);
|
|
450
|
+
if (row === undefined)
|
|
451
|
+
continue;
|
|
452
|
+
const id = row.type === 'five_hour'
|
|
453
|
+
? 'session'
|
|
454
|
+
: row.type === 'weekly' ? 'week' : undefined;
|
|
455
|
+
if (id === undefined)
|
|
456
|
+
continue;
|
|
457
|
+
const usedFraction = fractionFromUsed(toNumber(row.percentUsed) ?? Number.NaN);
|
|
458
|
+
const resetsAt = resetOf(row, ['resetsAt', 'resets_at']);
|
|
459
|
+
if (usedFraction === undefined || resetsAt === undefined)
|
|
460
|
+
continue;
|
|
461
|
+
windows.set(id, tighterWindow(windows.get(id), { id, usedFraction, resetsAt }));
|
|
462
|
+
}
|
|
463
|
+
return [...windows.values()];
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Route id → probe. The ids are the variants this repo and the Host directory
|
|
468
|
+
* actually use (OAuth catalog ids `anthropic`/`openai-codex`/`kimi-coding`, the
|
|
469
|
+
* seed routes in `src/providers.ts`, the sign-in routes in `src/oauth`).
|
|
470
|
+
* Unknown ids have no entry by design and resolve to `absent`.
|
|
471
|
+
*
|
|
472
|
+
* Deliberately absent, each verified against a reference implementation:
|
|
473
|
+
* - `ollama-cloud`: the pinned reference (oh-my-pi `packages/ai/src/usage/ollama.ts`)
|
|
474
|
+
* reports no standalone quota endpoint for Ollama.
|
|
475
|
+
* - `cursor` / `factory-droid`: transport routes (`llm-omp-transports/<route>`).
|
|
476
|
+
* Their grants are read only inside the host service, and both need vendor
|
|
477
|
+
* credential work (Cursor rotates the refresh-token grant on 401 and writes
|
|
478
|
+
* the successor back; Factory sends droid's org header), so a probe cannot
|
|
479
|
+
* reach them from the quota path.
|
|
480
|
+
* - `openrouter`: no reference in tokscale, magpie or oh-my-pi reads a usage
|
|
481
|
+
* endpoint, so `GET /api/v1/key`'s shape is unconfirmed and unshipped.
|
|
482
|
+
*
|
|
483
|
+
* shortcut: the CN-region routes (`zai-coding-cn`, `minimax-code-cn`) reuse the
|
|
484
|
+
* international endpoints, so a CN key reports `unauthorized`; add per-region
|
|
485
|
+
* base URLs when a CN-hosted account must show quota.
|
|
486
|
+
*/
|
|
487
|
+
const QUOTA_PROBES = Object.freeze({
|
|
488
|
+
claude: claudeQuotaProbe,
|
|
489
|
+
anthropic: claudeQuotaProbe,
|
|
490
|
+
codex: codexQuotaProbe,
|
|
491
|
+
'openai-codex': codexQuotaProbe,
|
|
492
|
+
zai: zaiQuotaProbe,
|
|
493
|
+
'zai-coding-cn': zaiQuotaProbe,
|
|
494
|
+
'zhipu-coding-plan': zaiQuotaProbe,
|
|
495
|
+
kimi: kimiQuotaProbe,
|
|
496
|
+
'kimi-code': kimiQuotaProbe,
|
|
497
|
+
'kimi-coding': kimiQuotaProbe,
|
|
498
|
+
minimax: minimaxQuotaProbe,
|
|
499
|
+
'minimax-code': minimaxQuotaProbe,
|
|
500
|
+
'minimax-code-cn': minimaxQuotaProbe,
|
|
501
|
+
'opencode-go': opencodeGoQuotaProbe,
|
|
502
|
+
commandcode: commandcodeQuotaProbe,
|
|
503
|
+
xai: xaiQuotaProbe,
|
|
504
|
+
'cline-pass': clineQuotaProbe,
|
|
505
|
+
});
|
|
506
|
+
/** The probe for a route id, or `undefined` when the provider exposes no usage API. */
|
|
507
|
+
export function quotaProbe(provider) {
|
|
508
|
+
// Own-property check: a plain index would answer `constructor` with a
|
|
509
|
+
// function and hand it back as if it were a probe.
|
|
510
|
+
return Object.hasOwn(QUOTA_PROBES, provider) ? QUOTA_PROBES[provider] : undefined;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Probe one route id, degrading an unknown route to `absent` and a probe that
|
|
514
|
+
* somehow throws to `error`, so callers never handle an exception.
|
|
515
|
+
*/
|
|
516
|
+
export async function resolveQuota(provider, input) {
|
|
517
|
+
const probe = quotaProbe(provider);
|
|
518
|
+
if (probe === undefined) {
|
|
519
|
+
return { status: 'absent', fetchedAt: Date.now(), windows: [], reason: `no quota profile for ${provider}` };
|
|
520
|
+
}
|
|
521
|
+
try {
|
|
522
|
+
return await probe(input);
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
return {
|
|
526
|
+
status: 'error',
|
|
527
|
+
fetchedAt: Date.now(),
|
|
528
|
+
windows: [],
|
|
529
|
+
reason: error instanceof Error ? error.message : 'quota probe failed',
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/quota/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAexD,MAAM,gBAAgB,GAAG,2CAA2C,CAAA;AACpE,MAAM,kBAAkB,GAAG,kBAAkB,CAAA;AAC7C,MAAM,eAAe,GAAG,4CAA4C,CAAA;AACpE,MAAM,aAAa,GAAG,gDAAgD,CAAA;AACtE,MAAM,cAAc,GAAG,uCAAuC,CAAA;AAC9D,MAAM,iBAAiB,GAAG,gEAAgE,CAAA;AAC1F,MAAM,qBAAqB,GAAG,qCAAqC,CAAA;AACnE,MAAM,uBAAuB,GAAG,kDAAkD,CAAA;AAClF,MAAM,eAAe,GAAG,2DAA2D,CAAA;AACnF;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,cAAc,CAAA;AACzC,MAAM,kBAAkB,GAAG,iCAAiC,CAAA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CAAA;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB,EAAE,KAAsB;IACzE,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAA;IAClC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,wBAAwB,QAAQ,EAAE,EAAE,CAAA;IAC7G,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,KAAK,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,OAAO;YACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,OAAO,EAAE,EAAE;YACX,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB;SACtE,CAAA;IACH,CAAC;AACH,CAAC"}
|
package/locale/en.json
CHANGED
|
@@ -57,5 +57,11 @@
|
|
|
57
57
|
"transportEmpty": "No transport accounts yet.",
|
|
58
58
|
"signInAgain": "Sign in again",
|
|
59
59
|
"loginPasteHint": "Paste the full URL from your browser address bar, or just the authorization code.",
|
|
60
|
-
"loginReveal": "Show pasted code"
|
|
60
|
+
"loginReveal": "Show pasted code",
|
|
61
|
+
"signingIn": "Signing in…",
|
|
62
|
+
"quotaSignInAgain": "Sign in again",
|
|
63
|
+
"quotaStale": "Stale",
|
|
64
|
+
"quotaCompactHint": "The tightest plan window across this provider's accounts; expand the card for every account.",
|
|
65
|
+
"quotaNativelyManaged": "Managed by DSH",
|
|
66
|
+
"quotaResetDue": "Reset due"
|
|
61
67
|
}
|
package/locale/zh.json
CHANGED
|
@@ -57,5 +57,11 @@
|
|
|
57
57
|
"transportEmpty": "还没有传输账户。",
|
|
58
58
|
"signInAgain": "重新登录",
|
|
59
59
|
"loginPasteHint": "从浏览器地址栏复制完整 URL,或只粘贴授权码。",
|
|
60
|
-
"loginReveal": "显示粘贴的内容"
|
|
60
|
+
"loginReveal": "显示粘贴的内容",
|
|
61
|
+
"signingIn": "正在登录…",
|
|
62
|
+
"quotaSignInAgain": "请重新登录",
|
|
63
|
+
"quotaStale": "数据较旧",
|
|
64
|
+
"quotaCompactHint": "该 Provider 各账号中最紧的计划用量窗口;展开卡片查看每个账号。",
|
|
65
|
+
"quotaNativelyManaged": "由 DSH 原生管理",
|
|
66
|
+
"quotaResetDue": "已到重置时间"
|
|
61
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-keys-manager",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Multi-key management for DSH providers: sticky per-session round-robin, retry failover, cooldown recovery, and searchable extra providers.",
|
|
6
6
|
"repository": {
|
|
@@ -61,26 +61,26 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
64
|
-
"@deepseek-ai/dsh-client-connection": "^0.2.1-rc.
|
|
65
|
-
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.
|
|
66
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager": "^0.2.1-rc.
|
|
67
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.
|
|
68
|
-
"@deepseek-ai/dsh-client-ui-settings-models": "^0.2.1-rc.
|
|
69
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.
|
|
70
|
-
"@deepseek-ai/dsh-credentials": "^0.2.1-rc.
|
|
71
|
-
"@deepseek-ai/dsh-llm": "^0.2.1-rc.
|
|
72
|
-
"@deepseek-ai/dsh-settings": "^0.2.1-rc.
|
|
73
|
-
"@deepseek-ai/dsh-typert-registry": "^0.2.1-rc.
|
|
64
|
+
"@deepseek-ai/dsh-client-connection": "^0.2.1-rc.3",
|
|
65
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.3",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": "^0.2.1-rc.3",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.3",
|
|
68
|
+
"@deepseek-ai/dsh-client-ui-settings-models": "^0.2.1-rc.3",
|
|
69
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.3",
|
|
70
|
+
"@deepseek-ai/dsh-credentials": "^0.2.1-rc.3",
|
|
71
|
+
"@deepseek-ai/dsh-llm": "^0.2.1-rc.3",
|
|
72
|
+
"@deepseek-ai/dsh-settings": "^0.2.1-rc.3",
|
|
73
|
+
"@deepseek-ai/dsh-typert-registry": "^0.2.1-rc.3",
|
|
74
74
|
"react": "^18.2.0"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"dsh-llm-omp-transports": "^0.2.
|
|
77
|
+
"dsh-llm-omp-transports": "^0.2.9"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
81
|
-
"@oh-my-pi/pi-ai": "18.12.
|
|
82
|
-
"@oh-my-pi/pi-catalog": "18.12.
|
|
83
|
-
"@oh-my-pi/pi-utils": "18.12.
|
|
81
|
+
"@oh-my-pi/pi-ai": "18.12.6",
|
|
82
|
+
"@oh-my-pi/pi-catalog": "18.12.6",
|
|
83
|
+
"@oh-my-pi/pi-utils": "18.12.6",
|
|
84
84
|
"@types/node": "^22.20.0",
|
|
85
85
|
"@types/react": "~18.3.31",
|
|
86
86
|
"esbuild": "^0.28.2",
|