@prestyj/core 5.32.0 → 5.32.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/dist/{chunk-7JDCLVUN.js → chunk-6I3APHDP.js} +152 -84
- package/dist/chunk-6I3APHDP.js.map +1 -0
- package/dist/{chunk-CRU3SSNX.js → chunk-W4NHU4UL.js} +3 -2
- package/dist/chunk-W4NHU4UL.js.map +1 -0
- package/dist/index.cjs +183 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +37 -6
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +73 -65
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.d.cts +41 -1
- package/dist/model-registry.d.ts +41 -1
- package/dist/model-registry.js +8 -4
- package/dist/paths.cjs +2 -1
- package/dist/paths.cjs.map +1 -1
- package/dist/paths.d.cts +2 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-7JDCLVUN.js.map +0 -1
- package/dist/chunk-CRU3SSNX.js.map +0 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAppPaths
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
|
|
5
|
-
// src/model-registry.ts
|
|
6
|
-
import { resolveFastModeModel } from "@prestyj/ai";
|
|
3
|
+
} from "./chunk-W4NHU4UL.js";
|
|
7
4
|
|
|
8
5
|
// src/oauth/kimi.ts
|
|
9
6
|
import { execFileSync } from "child_process";
|
|
@@ -271,16 +268,19 @@ import { environmentSecrets, redactText, redactValue } from "@prestyj/ai";
|
|
|
271
268
|
var MAX_BYTES = 10 * 1024 * 1024;
|
|
272
269
|
var MIN_HEADROOM_BYTES = 64 * 1024;
|
|
273
270
|
var fd = null;
|
|
274
|
-
var
|
|
271
|
+
var logPath = null;
|
|
272
|
+
var fileBytes = 0;
|
|
273
|
+
var processBytes = 0;
|
|
274
|
+
var rotationFailed = false;
|
|
275
275
|
var capped = false;
|
|
276
276
|
var sessionId = "";
|
|
277
277
|
var appName = "app";
|
|
278
278
|
var cleanups = [];
|
|
279
279
|
var exactSecrets = [];
|
|
280
|
-
function rotateIfNeeded(filePath) {
|
|
280
|
+
function rotateIfNeeded(filePath, force = false) {
|
|
281
281
|
try {
|
|
282
282
|
const st = fs.statSync(filePath);
|
|
283
|
-
if (st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
|
|
283
|
+
if (!force && st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
|
|
284
284
|
const rotated = `${filePath}.1`;
|
|
285
285
|
try {
|
|
286
286
|
fs.unlinkSync(rotated);
|
|
@@ -290,6 +290,32 @@ function rotateIfNeeded(filePath) {
|
|
|
290
290
|
} catch {
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
+
function rotateOpenLog() {
|
|
294
|
+
if (fd === null || logPath === null) return false;
|
|
295
|
+
const sizeBefore = fileBytes;
|
|
296
|
+
try {
|
|
297
|
+
fs.closeSync(fd);
|
|
298
|
+
} catch {
|
|
299
|
+
}
|
|
300
|
+
fd = null;
|
|
301
|
+
rotateIfNeeded(logPath, true);
|
|
302
|
+
try {
|
|
303
|
+
fd = fs.openSync(logPath, "a");
|
|
304
|
+
fileBytes = fs.fstatSync(fd).size;
|
|
305
|
+
} catch {
|
|
306
|
+
if (fd !== null) {
|
|
307
|
+
try {
|
|
308
|
+
fs.closeSync(fd);
|
|
309
|
+
} catch {
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
fd = null;
|
|
313
|
+
capped = true;
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
if (fileBytes >= sizeBefore) rotationFailed = true;
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
293
319
|
function openLog(filePath, name) {
|
|
294
320
|
if (fd !== null || capped) return false;
|
|
295
321
|
appName = name;
|
|
@@ -303,24 +329,29 @@ function openLog(filePath, name) {
|
|
|
303
329
|
fd = fs.openSync(filePath, "a");
|
|
304
330
|
} catch {
|
|
305
331
|
fd = null;
|
|
306
|
-
|
|
332
|
+
fileBytes = 0;
|
|
307
333
|
return false;
|
|
308
334
|
}
|
|
309
335
|
try {
|
|
310
|
-
|
|
336
|
+
fileBytes = fs.fstatSync(fd).size;
|
|
311
337
|
} catch {
|
|
312
338
|
try {
|
|
313
339
|
fs.closeSync(fd);
|
|
314
340
|
} catch {
|
|
315
341
|
}
|
|
316
342
|
fd = null;
|
|
317
|
-
|
|
343
|
+
fileBytes = 0;
|
|
318
344
|
return false;
|
|
319
345
|
}
|
|
346
|
+
logPath = filePath;
|
|
347
|
+
processBytes = 0;
|
|
348
|
+
rotationFailed = false;
|
|
320
349
|
sessionId = randomBytes(4).toString("hex");
|
|
321
350
|
try {
|
|
322
|
-
if (
|
|
323
|
-
|
|
351
|
+
if (fileBytes < MAX_BYTES) {
|
|
352
|
+
const written = fs.writeSync(fd, "\n");
|
|
353
|
+
fileBytes += written;
|
|
354
|
+
processBytes += written;
|
|
324
355
|
}
|
|
325
356
|
} catch {
|
|
326
357
|
}
|
|
@@ -348,12 +379,12 @@ function log(level, category, message, data) {
|
|
|
348
379
|
}
|
|
349
380
|
line += "\n";
|
|
350
381
|
const lineBytes = Buffer.byteLength(line);
|
|
351
|
-
if (
|
|
382
|
+
if (processBytes + lineBytes > MAX_BYTES) {
|
|
352
383
|
const capLine = `[${ts}] [sid=${sessionId}] [WARN] [logger] Log cap reached; file logging disabled until restart
|
|
353
384
|
`;
|
|
354
385
|
try {
|
|
355
|
-
if (
|
|
356
|
-
|
|
386
|
+
if (fileBytes + Buffer.byteLength(capLine) <= MAX_BYTES) {
|
|
387
|
+
fileBytes += fs.writeSync(fd, capLine);
|
|
357
388
|
}
|
|
358
389
|
fs.closeSync(fd);
|
|
359
390
|
} catch {
|
|
@@ -362,8 +393,12 @@ function log(level, category, message, data) {
|
|
|
362
393
|
capped = true;
|
|
363
394
|
return;
|
|
364
395
|
}
|
|
396
|
+
if (fileBytes + lineBytes > MAX_BYTES && !rotationFailed && !rotateOpenLog()) return;
|
|
397
|
+
if (fd === null) return;
|
|
365
398
|
try {
|
|
366
|
-
|
|
399
|
+
const written = fs.writeSync(fd, line);
|
|
400
|
+
fileBytes += written;
|
|
401
|
+
processBytes += written;
|
|
367
402
|
} catch {
|
|
368
403
|
}
|
|
369
404
|
}
|
|
@@ -379,7 +414,10 @@ function closeLogger(opts) {
|
|
|
379
414
|
}
|
|
380
415
|
}
|
|
381
416
|
fd = null;
|
|
382
|
-
|
|
417
|
+
logPath = null;
|
|
418
|
+
fileBytes = 0;
|
|
419
|
+
processBytes = 0;
|
|
420
|
+
rotationFailed = false;
|
|
383
421
|
capped = false;
|
|
384
422
|
exactSecrets = [];
|
|
385
423
|
for (const unsub of cleanups) unsub();
|
|
@@ -1246,7 +1284,7 @@ var DEFAULT_CLIENT_ID2 = "b1a00492-073a-47ea-816f-4c329264a828";
|
|
|
1246
1284
|
var DEFAULT_ISSUER = "https://auth.x.ai";
|
|
1247
1285
|
var DEFAULT_CLI_BASE_URL = "https://cli-chat-proxy.grok.com/v1";
|
|
1248
1286
|
var OAUTH_SCOPE = "openid profile email offline_access grok-cli:access api:access";
|
|
1249
|
-
var DEFAULT_GROK_CLI_VERSION = "0.
|
|
1287
|
+
var DEFAULT_GROK_CLI_VERSION = "1.0.67";
|
|
1250
1288
|
var DEVICE_TIMEOUT_FALLBACK_MS = 10 * 60 * 1e3;
|
|
1251
1289
|
var DEFAULT_TOKEN_LIFETIME_SECONDS = 3600;
|
|
1252
1290
|
function issuer() {
|
|
@@ -1535,6 +1573,8 @@ function providerStorageKeys(provider) {
|
|
|
1535
1573
|
return dual ? [dual.oauthKey, dual.provider] : [provider];
|
|
1536
1574
|
}
|
|
1537
1575
|
var XIAOMI_CREDITS_KEY = "xiaomi-credits";
|
|
1576
|
+
var GEMINI_API_KEY = "gemini-api";
|
|
1577
|
+
var GEMINI_API_KEY_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
1538
1578
|
var LOCAL_AUTH_KEY_PREFIX = "local:";
|
|
1539
1579
|
var LOCAL_CREDENTIAL_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
|
|
1540
1580
|
function activeBaseUrlEntry(data, provider) {
|
|
@@ -1638,6 +1678,9 @@ var AuthStorage = class {
|
|
|
1638
1678
|
if (provider === "xiaomi") {
|
|
1639
1679
|
return Boolean(this.data["xiaomi"] || this.data[XIAOMI_CREDITS_KEY]);
|
|
1640
1680
|
}
|
|
1681
|
+
if (provider === "gemini") {
|
|
1682
|
+
return Boolean(this.data["gemini"] || this.data[GEMINI_API_KEY]);
|
|
1683
|
+
}
|
|
1641
1684
|
if (provider === "local") {
|
|
1642
1685
|
return Object.keys(this.data).some((key) => key.startsWith(LOCAL_AUTH_KEY_PREFIX));
|
|
1643
1686
|
}
|
|
@@ -1872,6 +1915,12 @@ var AuthStorage = class {
|
|
|
1872
1915
|
...opts.rejectedToken !== void 0 ? { rejectedToken: opts.rejectedToken } : {}
|
|
1873
1916
|
});
|
|
1874
1917
|
}
|
|
1918
|
+
if (key === provider) {
|
|
1919
|
+
return await this.resolveCredentials(provider, {
|
|
1920
|
+
...opts.forceRefresh ? { forceRefresh: true } : {},
|
|
1921
|
+
...opts.rejectedToken !== void 0 ? { rejectedToken: opts.rejectedToken } : {}
|
|
1922
|
+
});
|
|
1923
|
+
}
|
|
1875
1924
|
return creds2;
|
|
1876
1925
|
}
|
|
1877
1926
|
throw new NotLoggedInError(provider);
|
|
@@ -1945,9 +1994,20 @@ var AuthStorage = class {
|
|
|
1945
1994
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1946
1995
|
const isAuthFailure = /\((401|400)\)/.test(msg) || /invalid_grant|invalid_token|invalid.*refresh/i.test(msg) || /unauthorized/i.test(msg);
|
|
1947
1996
|
if (isAuthFailure) {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1997
|
+
const current = await readAuthData(this.filePath);
|
|
1998
|
+
const currentCreds = current[provider];
|
|
1999
|
+
if (currentCreds && currentCreds.refreshToken !== latestCreds.refreshToken) {
|
|
2000
|
+
log(
|
|
2001
|
+
"WARN",
|
|
2002
|
+
"auth",
|
|
2003
|
+
`${provider} token refresh was rejected, but another gg process already saved a newer credential \u2014 adopting it instead of signing out`
|
|
2004
|
+
);
|
|
2005
|
+
this.data = current;
|
|
2006
|
+
return currentCreds;
|
|
2007
|
+
}
|
|
2008
|
+
delete current[provider];
|
|
2009
|
+
this.data = current;
|
|
2010
|
+
await atomicWriteFile(this.filePath, JSON.stringify(current, null, 2));
|
|
1951
2011
|
throw new NotLoggedInError(provider);
|
|
1952
2012
|
}
|
|
1953
2013
|
throw err;
|
|
@@ -2013,6 +2073,24 @@ var NotLoggedInError = class extends Error {
|
|
|
2013
2073
|
};
|
|
2014
2074
|
|
|
2015
2075
|
// src/model-registry.ts
|
|
2076
|
+
var CLAUDE_FAST_BILLING = {
|
|
2077
|
+
label: "bills usage credits",
|
|
2078
|
+
detail: "Fast mode bills your Claude usage credits ($8 in / $40 out per million tokens) from the first token, never your plan's included usage.",
|
|
2079
|
+
paid: true,
|
|
2080
|
+
standardModel: "claude-opus-5-5"
|
|
2081
|
+
};
|
|
2082
|
+
var XIAOMI_ULTRASPEED_BILLING = {
|
|
2083
|
+
label: "bills API Credits",
|
|
2084
|
+
detail: "UltraSpeed runs only on your Xiaomi API Credits, billed per token at a higher rate than MiMo-V2.6-Pro, never on the Token Plan.",
|
|
2085
|
+
paid: true,
|
|
2086
|
+
standardModel: "mimo-v2.6-pro"
|
|
2087
|
+
};
|
|
2088
|
+
var CODEX_FAST_BILLING = {
|
|
2089
|
+
label: "2.5x plan usage",
|
|
2090
|
+
detail: "Codex Fast mode uses your ChatGPT plan limits at 2.5x the standard rate (purchased credits at 2x).",
|
|
2091
|
+
paid: false
|
|
2092
|
+
};
|
|
2093
|
+
var GEMINI_AUTH_KEYS = [GEMINI_API_KEY, "gemini"];
|
|
2016
2094
|
var MODELS = [
|
|
2017
2095
|
// ── Anthropic ──────────────────────────────────────────
|
|
2018
2096
|
// NOTE: Claude Mythos 5.1 (`claude-mythos-5-1`, 2026-09-01) is kept commented
|
|
@@ -2075,28 +2153,6 @@ var MODELS = [
|
|
|
2075
2153
|
costTier: "high",
|
|
2076
2154
|
maxThinkingLevel: "max"
|
|
2077
2155
|
},
|
|
2078
|
-
{
|
|
2079
|
-
// Released 2026-07-24 — "For complex agentic coding and enterprise work".
|
|
2080
|
-
// Near-Fable capability at half the price ($5/$25 vs $10/$50). Adaptive
|
|
2081
|
-
// thinking with the full effort ladder (low→max, xhigh included); dateless
|
|
2082
|
-
// ID is the canonical pinned snapshot (post-4.6 naming scheme). Kept as a
|
|
2083
|
-
// legacy option now that Opus 5.5 leads the line: it's the last Opus that
|
|
2084
|
-
// accepts disabled thinking and forced tool use.
|
|
2085
|
-
id: "claude-opus-5",
|
|
2086
|
-
name: "Claude Opus 5",
|
|
2087
|
-
provider: "anthropic",
|
|
2088
|
-
contextWindow: 1e6,
|
|
2089
|
-
maxOutputTokens: 128e3,
|
|
2090
|
-
supportsThinking: true,
|
|
2091
|
-
supportsImages: true,
|
|
2092
|
-
supportsVideo: false,
|
|
2093
|
-
costTier: "high",
|
|
2094
|
-
// Anthropic's API and Claude Code both start the 5.5 family at medium; at a
|
|
2095
|
-
// given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
|
|
2096
|
-
// sessions slow and expensive. Users can still opt up.
|
|
2097
|
-
defaultThinkingLevel: "medium",
|
|
2098
|
-
maxThinkingLevel: "max"
|
|
2099
|
-
},
|
|
2100
2156
|
{
|
|
2101
2157
|
// Opus 5.5 in fast mode (research preview): the same model at up to 2.5x
|
|
2102
2158
|
// output tokens/sec, $8/$40 MTok. @prestyj/ai's `stream()` sends it as
|
|
@@ -2114,7 +2170,8 @@ var MODELS = [
|
|
|
2114
2170
|
supportsVideo: false,
|
|
2115
2171
|
costTier: "high",
|
|
2116
2172
|
defaultThinkingLevel: "medium",
|
|
2117
|
-
maxThinkingLevel: "max"
|
|
2173
|
+
maxThinkingLevel: "max",
|
|
2174
|
+
billing: CLAUDE_FAST_BILLING
|
|
2118
2175
|
},
|
|
2119
2176
|
{
|
|
2120
2177
|
// Released 2026-09-28 — replaces Sonnet 5 at $2/$10 MTok, with the same
|
|
@@ -2128,9 +2185,10 @@ var MODELS = [
|
|
|
2128
2185
|
supportsImages: true,
|
|
2129
2186
|
supportsVideo: false,
|
|
2130
2187
|
costTier: "medium",
|
|
2131
|
-
//
|
|
2132
|
-
//
|
|
2133
|
-
//
|
|
2188
|
+
// We start Sonnet 5.5 at medium like the rest of the 5.5 family (the API's
|
|
2189
|
+
// own default for Sonnet 5.5 is high). At a given level 5.5 thinks more
|
|
2190
|
+
// than 5, so the ladder ceiling (max) made fresh sessions slow and
|
|
2191
|
+
// expensive. Users can still opt up.
|
|
2134
2192
|
defaultThinkingLevel: "medium",
|
|
2135
2193
|
maxThinkingLevel: "max"
|
|
2136
2194
|
},
|
|
@@ -2199,7 +2257,8 @@ var MODELS = [
|
|
|
2199
2257
|
supportsImages: true,
|
|
2200
2258
|
supportsVideo: false,
|
|
2201
2259
|
costTier: "high",
|
|
2202
|
-
maxThinkingLevel: "ultra"
|
|
2260
|
+
maxThinkingLevel: "ultra",
|
|
2261
|
+
billing: CODEX_FAST_BILLING
|
|
2203
2262
|
},
|
|
2204
2263
|
// GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
|
|
2205
2264
|
// GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
|
|
@@ -2243,7 +2302,8 @@ var MODELS = [
|
|
|
2243
2302
|
supportsImages: true,
|
|
2244
2303
|
supportsVideo: false,
|
|
2245
2304
|
costTier: "medium",
|
|
2246
|
-
maxThinkingLevel: "ultra"
|
|
2305
|
+
maxThinkingLevel: "ultra",
|
|
2306
|
+
billing: CODEX_FAST_BILLING
|
|
2247
2307
|
},
|
|
2248
2308
|
{
|
|
2249
2309
|
// Luna — "Fast and affordable model for easier tasks." (Codex priority 4,
|
|
@@ -2277,7 +2337,8 @@ var MODELS = [
|
|
|
2277
2337
|
supportsImages: true,
|
|
2278
2338
|
supportsVideo: false,
|
|
2279
2339
|
costTier: "low",
|
|
2280
|
-
maxThinkingLevel: "max"
|
|
2340
|
+
maxThinkingLevel: "max",
|
|
2341
|
+
billing: CODEX_FAST_BILLING
|
|
2281
2342
|
},
|
|
2282
2343
|
// ── Sakana (Fugu) ──────────────────────────────────────
|
|
2283
2344
|
// Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
|
|
@@ -2361,10 +2422,14 @@ var MODELS = [
|
|
|
2361
2422
|
supportsVideo: true,
|
|
2362
2423
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2363
2424
|
costTier: "low",
|
|
2364
|
-
maxThinkingLevel: "high"
|
|
2425
|
+
maxThinkingLevel: "high",
|
|
2426
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2365
2427
|
},
|
|
2366
2428
|
// Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
|
|
2367
|
-
// New GA models are opt-in; Code Assist access varies by account.
|
|
2429
|
+
// New GA models are opt-in; Code Assist access varies by account. Gemini 3.7
|
|
2430
|
+
// Flash is retired: Google deprecated it on 2026-10-08 and routes every
|
|
2431
|
+
// `gemini-3.7-flash` request to 3.8 Flash (ai.google.dev/gemini-api/docs/
|
|
2432
|
+
// changelog), so a saved session on it falls back to the provider default.
|
|
2368
2433
|
{
|
|
2369
2434
|
id: "gemini-3.8-flash",
|
|
2370
2435
|
name: "Gemini 3.8 Flash",
|
|
@@ -2376,7 +2441,8 @@ var MODELS = [
|
|
|
2376
2441
|
supportsVideo: true,
|
|
2377
2442
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2378
2443
|
costTier: "low",
|
|
2379
|
-
maxThinkingLevel: "high"
|
|
2444
|
+
maxThinkingLevel: "high",
|
|
2445
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2380
2446
|
},
|
|
2381
2447
|
{
|
|
2382
2448
|
id: "gemini-3.5-flash-lite",
|
|
@@ -2389,27 +2455,8 @@ var MODELS = [
|
|
|
2389
2455
|
supportsVideo: true,
|
|
2390
2456
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2391
2457
|
costTier: "low",
|
|
2392
|
-
maxThinkingLevel: "high"
|
|
2393
|
-
|
|
2394
|
-
{
|
|
2395
|
-
// Gemini 3.7 Flash (released 2026-08-13) — Google's most capable Flash for
|
|
2396
|
-
// coding, agents, and multi-step execution; GA-stable on the Gemini API as
|
|
2397
|
-
// `gemini-3.7-flash`. 1M context, 64K output, thinking low/medium/high.
|
|
2398
|
-
// Sent over our Code Assist (OAuth) transport ahead of gemini-cli — upstream
|
|
2399
|
-
// hasn't listed 3.7 yet (google-gemini/gemini-cli#28802, still open) — so
|
|
2400
|
-
// free/personal accounts 404 (entitlement-gated) while Code Assist
|
|
2401
|
-
// Standard/Enterprise accounts get it.
|
|
2402
|
-
id: "gemini-3.7-flash",
|
|
2403
|
-
name: "Gemini 3.7 Flash",
|
|
2404
|
-
provider: "gemini",
|
|
2405
|
-
contextWindow: 1048576,
|
|
2406
|
-
maxOutputTokens: 65536,
|
|
2407
|
-
supportsThinking: true,
|
|
2408
|
-
supportsImages: true,
|
|
2409
|
-
supportsVideo: true,
|
|
2410
|
-
maxVideoBytes: 20 * 1024 * 1024,
|
|
2411
|
-
costTier: "low",
|
|
2412
|
-
maxThinkingLevel: "high"
|
|
2458
|
+
maxThinkingLevel: "high",
|
|
2459
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2413
2460
|
},
|
|
2414
2461
|
{
|
|
2415
2462
|
// Wire name `gemini-3-flash` — the Code Assist (OAuth) backend rejects the
|
|
@@ -2425,7 +2472,8 @@ var MODELS = [
|
|
|
2425
2472
|
supportsVideo: true,
|
|
2426
2473
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2427
2474
|
costTier: "low",
|
|
2428
|
-
maxThinkingLevel: "high"
|
|
2475
|
+
maxThinkingLevel: "high",
|
|
2476
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2429
2477
|
},
|
|
2430
2478
|
{
|
|
2431
2479
|
// Gemini 3.1 Pro is public preview — gated behind Code Assist preview
|
|
@@ -2441,7 +2489,8 @@ var MODELS = [
|
|
|
2441
2489
|
supportsVideo: true,
|
|
2442
2490
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2443
2491
|
costTier: "high",
|
|
2444
|
-
maxThinkingLevel: "high"
|
|
2492
|
+
maxThinkingLevel: "high",
|
|
2493
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2445
2494
|
},
|
|
2446
2495
|
// ── Moonshot (Kimi) ────────────────────────────────────
|
|
2447
2496
|
// K3 is Kimi's 2.8T-parameter flagship for long-horizon coding, knowledge
|
|
@@ -2646,9 +2695,13 @@ var MODELS = [
|
|
|
2646
2695
|
maxVideoBytes: 36 * 1024 * 1024,
|
|
2647
2696
|
costTier: "high",
|
|
2648
2697
|
maxThinkingLevel: "high",
|
|
2649
|
-
authStorageKeys: [XIAOMI_CREDITS_KEY]
|
|
2698
|
+
authStorageKeys: [XIAOMI_CREDITS_KEY],
|
|
2699
|
+
billing: XIAOMI_ULTRASPEED_BILLING
|
|
2650
2700
|
},
|
|
2651
2701
|
// ── DeepSeek ───────────────────────────────────────────
|
|
2702
|
+
// Window 1,000,000 tokens (decimal "1M"), as DeepSeek's own agent sizes it
|
|
2703
|
+
// (deepseek-ai/deepseek-harness DEFAULT_CONTEXT_WINDOW = 1_000_000; models.dev
|
|
2704
|
+
// via earendil-works/pi agrees) — not 1,048,576.
|
|
2652
2705
|
// The live /models list (2026-09-28) serves exactly `deepseek-flash` and
|
|
2653
2706
|
// `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
|
|
2654
2707
|
// ids only temporarily route to V4.1 Flash, so they are retired here too.
|
|
@@ -2662,7 +2715,7 @@ var MODELS = [
|
|
|
2662
2715
|
id: "deepseek-v4-pro",
|
|
2663
2716
|
name: "DeepSeek V4 Pro",
|
|
2664
2717
|
provider: "deepseek",
|
|
2665
|
-
contextWindow:
|
|
2718
|
+
contextWindow: 1e6,
|
|
2666
2719
|
maxOutputTokens: 384e3,
|
|
2667
2720
|
supportsThinking: true,
|
|
2668
2721
|
supportsImages: false,
|
|
@@ -2676,7 +2729,7 @@ var MODELS = [
|
|
|
2676
2729
|
id: "deepseek-flash",
|
|
2677
2730
|
name: "DeepSeek V4.1 Flash",
|
|
2678
2731
|
provider: "deepseek",
|
|
2679
|
-
contextWindow:
|
|
2732
|
+
contextWindow: 1e6,
|
|
2680
2733
|
maxOutputTokens: 384e3,
|
|
2681
2734
|
supportsThinking: true,
|
|
2682
2735
|
supportsImages: true,
|
|
@@ -2740,7 +2793,7 @@ var MODELS = [
|
|
|
2740
2793
|
id: "deepseek-ai/DeepSeek-V4.1-Flash",
|
|
2741
2794
|
name: "DeepSeek V4.1 Flash",
|
|
2742
2795
|
provider: "huggingface",
|
|
2743
|
-
contextWindow:
|
|
2796
|
+
contextWindow: 1e6,
|
|
2744
2797
|
maxOutputTokens: 131072,
|
|
2745
2798
|
supportsThinking: false,
|
|
2746
2799
|
supportsImages: true,
|
|
@@ -2787,6 +2840,19 @@ function getModel(id) {
|
|
|
2787
2840
|
function getModelsForProvider(provider) {
|
|
2788
2841
|
return getAllModels().filter((m) => m.provider === provider);
|
|
2789
2842
|
}
|
|
2843
|
+
function isPaidModel(modelId) {
|
|
2844
|
+
return getModel(modelId)?.billing?.paid === true;
|
|
2845
|
+
}
|
|
2846
|
+
function withoutPaidTier(modelId) {
|
|
2847
|
+
const model = getModel(modelId);
|
|
2848
|
+
if (model?.billing?.paid !== true) return modelId;
|
|
2849
|
+
const usable = (id) => id !== void 0 && getModel(id) !== void 0 && !isPaidModel(id);
|
|
2850
|
+
const standard = model.billing.standardModel;
|
|
2851
|
+
if (usable(standard)) return standard;
|
|
2852
|
+
const providerDefault = DEFAULT_MODEL_IDS[model.provider];
|
|
2853
|
+
if (usable(providerDefault)) return providerDefault;
|
|
2854
|
+
return FALLBACK_DEFAULT_MODEL_ID;
|
|
2855
|
+
}
|
|
2790
2856
|
function getAuthStorageKeys(provider, modelId) {
|
|
2791
2857
|
const model = getAllModels().find((m) => m.id === modelId && m.provider === provider);
|
|
2792
2858
|
return model?.authStorageKeys ?? [provider];
|
|
@@ -2868,9 +2934,7 @@ var SUMMARY_COST_TIER = {
|
|
|
2868
2934
|
};
|
|
2869
2935
|
function getSummaryModel(provider, currentModelId) {
|
|
2870
2936
|
const tier = SUMMARY_COST_TIER[provider];
|
|
2871
|
-
const tagged = tier ? getModelsForProvider(provider).find(
|
|
2872
|
-
(m) => m.costTier === tier && !resolveFastModeModel(provider, m.id).fast
|
|
2873
|
-
) : void 0;
|
|
2937
|
+
const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier && m.billing === void 0) : void 0;
|
|
2874
2938
|
return tagged ?? getModel(currentModelId) ?? getDefaultModel(provider);
|
|
2875
2939
|
}
|
|
2876
2940
|
|
|
@@ -2910,6 +2974,8 @@ export {
|
|
|
2910
2974
|
oauthStorageKey,
|
|
2911
2975
|
providerStorageKeys,
|
|
2912
2976
|
XIAOMI_CREDITS_KEY,
|
|
2977
|
+
GEMINI_API_KEY,
|
|
2978
|
+
GEMINI_API_KEY_BASE_URL,
|
|
2913
2979
|
LOCAL_AUTH_KEY_PREFIX,
|
|
2914
2980
|
readStoredBaseUrlSync,
|
|
2915
2981
|
AuthStorage,
|
|
@@ -2920,6 +2986,8 @@ export {
|
|
|
2920
2986
|
getAllModels,
|
|
2921
2987
|
getModel,
|
|
2922
2988
|
getModelsForProvider,
|
|
2989
|
+
isPaidModel,
|
|
2990
|
+
withoutPaidTier,
|
|
2923
2991
|
getAuthStorageKeys,
|
|
2924
2992
|
getAuthStorageKey,
|
|
2925
2993
|
DEFAULT_MAX_VIDEO_BYTES,
|
|
@@ -2932,4 +3000,4 @@ export {
|
|
|
2932
3000
|
getDefaultThinkingLevel,
|
|
2933
3001
|
getSummaryModel
|
|
2934
3002
|
};
|
|
2935
|
-
//# sourceMappingURL=chunk-
|
|
3003
|
+
//# sourceMappingURL=chunk-6I3APHDP.js.map
|