@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
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,8 @@ __export(index_exports, {
|
|
|
35
35
|
DEFAULT_LOCAL_ENDPOINTS: () => DEFAULT_LOCAL_ENDPOINTS,
|
|
36
36
|
DEFAULT_MAX_VIDEO_BYTES: () => DEFAULT_MAX_VIDEO_BYTES,
|
|
37
37
|
FALLBACK_CONTEXT_WINDOW: () => FALLBACK_CONTEXT_WINDOW,
|
|
38
|
+
GEMINI_API_KEY: () => GEMINI_API_KEY,
|
|
39
|
+
GEMINI_API_KEY_BASE_URL: () => GEMINI_API_KEY_BASE_URL,
|
|
38
40
|
LOCAL_API_KEY_PLACEHOLDER: () => LOCAL_API_KEY_PLACEHOLDER,
|
|
39
41
|
LOCAL_AUTH_KEY_PREFIX: () => LOCAL_AUTH_KEY_PREFIX,
|
|
40
42
|
MODELS: () => MODELS,
|
|
@@ -90,6 +92,7 @@ __export(index_exports, {
|
|
|
90
92
|
isLocalModelId: () => isLocalModelId,
|
|
91
93
|
isLoggerOpen: () => isLoggerOpen,
|
|
92
94
|
isModelLoaded: () => isModelLoaded,
|
|
95
|
+
isPaidModel: () => isPaidModel,
|
|
93
96
|
isThinkingLevelSupported: () => isThinkingLevelSupported,
|
|
94
97
|
kimiCodeBaseUrl: () => kimiCodeBaseUrl,
|
|
95
98
|
kimiCodingHeaders: () => kimiCodingHeaders,
|
|
@@ -119,13 +122,11 @@ __export(index_exports, {
|
|
|
119
122
|
toModelInfo: () => toModelInfo,
|
|
120
123
|
transcribeVoice: () => transcribeVoice,
|
|
121
124
|
usesOpenAICodexTransport: () => usesOpenAICodexTransport,
|
|
122
|
-
withFileLock: () => withFileLock
|
|
125
|
+
withFileLock: () => withFileLock,
|
|
126
|
+
withoutPaidTier: () => withoutPaidTier
|
|
123
127
|
});
|
|
124
128
|
module.exports = __toCommonJS(index_exports);
|
|
125
129
|
|
|
126
|
-
// src/model-registry.ts
|
|
127
|
-
var import_ai2 = require("@prestyj/ai");
|
|
128
|
-
|
|
129
130
|
// src/oauth/kimi.ts
|
|
130
131
|
var import_node_child_process = require("child_process");
|
|
131
132
|
var import_node_crypto = require("crypto");
|
|
@@ -155,7 +156,8 @@ function getAppPaths() {
|
|
|
155
156
|
extensionsDir: import_node_path.default.join(agentDir, "extensions"),
|
|
156
157
|
agentsDir: import_node_path.default.join(agentDir, "agents"),
|
|
157
158
|
progressFile: import_node_path.default.join(agentDir, "progress.json"),
|
|
158
|
-
progressBackupFile: import_node_path.default.join(agentDir, "progress.backup.json")
|
|
159
|
+
progressBackupFile: import_node_path.default.join(agentDir, "progress.backup.json"),
|
|
160
|
+
trophiesFile: import_node_path.default.join(agentDir, "trophies.json")
|
|
159
161
|
};
|
|
160
162
|
}
|
|
161
163
|
|
|
@@ -418,16 +420,19 @@ var import_ai = require("@prestyj/ai");
|
|
|
418
420
|
var MAX_BYTES = 10 * 1024 * 1024;
|
|
419
421
|
var MIN_HEADROOM_BYTES = 64 * 1024;
|
|
420
422
|
var fd = null;
|
|
421
|
-
var
|
|
423
|
+
var logPath = null;
|
|
424
|
+
var fileBytes = 0;
|
|
425
|
+
var processBytes = 0;
|
|
426
|
+
var rotationFailed = false;
|
|
422
427
|
var capped = false;
|
|
423
428
|
var sessionId = "";
|
|
424
429
|
var appName = "app";
|
|
425
430
|
var cleanups = [];
|
|
426
431
|
var exactSecrets = [];
|
|
427
|
-
function rotateIfNeeded(filePath) {
|
|
432
|
+
function rotateIfNeeded(filePath, force = false) {
|
|
428
433
|
try {
|
|
429
434
|
const st = import_node_fs2.default.statSync(filePath);
|
|
430
|
-
if (st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
|
|
435
|
+
if (!force && st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
|
|
431
436
|
const rotated = `${filePath}.1`;
|
|
432
437
|
try {
|
|
433
438
|
import_node_fs2.default.unlinkSync(rotated);
|
|
@@ -437,6 +442,32 @@ function rotateIfNeeded(filePath) {
|
|
|
437
442
|
} catch {
|
|
438
443
|
}
|
|
439
444
|
}
|
|
445
|
+
function rotateOpenLog() {
|
|
446
|
+
if (fd === null || logPath === null) return false;
|
|
447
|
+
const sizeBefore = fileBytes;
|
|
448
|
+
try {
|
|
449
|
+
import_node_fs2.default.closeSync(fd);
|
|
450
|
+
} catch {
|
|
451
|
+
}
|
|
452
|
+
fd = null;
|
|
453
|
+
rotateIfNeeded(logPath, true);
|
|
454
|
+
try {
|
|
455
|
+
fd = import_node_fs2.default.openSync(logPath, "a");
|
|
456
|
+
fileBytes = import_node_fs2.default.fstatSync(fd).size;
|
|
457
|
+
} catch {
|
|
458
|
+
if (fd !== null) {
|
|
459
|
+
try {
|
|
460
|
+
import_node_fs2.default.closeSync(fd);
|
|
461
|
+
} catch {
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
fd = null;
|
|
465
|
+
capped = true;
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
if (fileBytes >= sizeBefore) rotationFailed = true;
|
|
469
|
+
return true;
|
|
470
|
+
}
|
|
440
471
|
function openLog(filePath, name) {
|
|
441
472
|
if (fd !== null || capped) return false;
|
|
442
473
|
appName = name;
|
|
@@ -450,24 +481,29 @@ function openLog(filePath, name) {
|
|
|
450
481
|
fd = import_node_fs2.default.openSync(filePath, "a");
|
|
451
482
|
} catch {
|
|
452
483
|
fd = null;
|
|
453
|
-
|
|
484
|
+
fileBytes = 0;
|
|
454
485
|
return false;
|
|
455
486
|
}
|
|
456
487
|
try {
|
|
457
|
-
|
|
488
|
+
fileBytes = import_node_fs2.default.fstatSync(fd).size;
|
|
458
489
|
} catch {
|
|
459
490
|
try {
|
|
460
491
|
import_node_fs2.default.closeSync(fd);
|
|
461
492
|
} catch {
|
|
462
493
|
}
|
|
463
494
|
fd = null;
|
|
464
|
-
|
|
495
|
+
fileBytes = 0;
|
|
465
496
|
return false;
|
|
466
497
|
}
|
|
498
|
+
logPath = filePath;
|
|
499
|
+
processBytes = 0;
|
|
500
|
+
rotationFailed = false;
|
|
467
501
|
sessionId = (0, import_node_crypto2.randomBytes)(4).toString("hex");
|
|
468
502
|
try {
|
|
469
|
-
if (
|
|
470
|
-
|
|
503
|
+
if (fileBytes < MAX_BYTES) {
|
|
504
|
+
const written = import_node_fs2.default.writeSync(fd, "\n");
|
|
505
|
+
fileBytes += written;
|
|
506
|
+
processBytes += written;
|
|
471
507
|
}
|
|
472
508
|
} catch {
|
|
473
509
|
}
|
|
@@ -495,12 +531,12 @@ function log(level, category, message, data) {
|
|
|
495
531
|
}
|
|
496
532
|
line += "\n";
|
|
497
533
|
const lineBytes = Buffer.byteLength(line);
|
|
498
|
-
if (
|
|
534
|
+
if (processBytes + lineBytes > MAX_BYTES) {
|
|
499
535
|
const capLine = `[${ts}] [sid=${sessionId}] [WARN] [logger] Log cap reached; file logging disabled until restart
|
|
500
536
|
`;
|
|
501
537
|
try {
|
|
502
|
-
if (
|
|
503
|
-
|
|
538
|
+
if (fileBytes + Buffer.byteLength(capLine) <= MAX_BYTES) {
|
|
539
|
+
fileBytes += import_node_fs2.default.writeSync(fd, capLine);
|
|
504
540
|
}
|
|
505
541
|
import_node_fs2.default.closeSync(fd);
|
|
506
542
|
} catch {
|
|
@@ -509,8 +545,12 @@ function log(level, category, message, data) {
|
|
|
509
545
|
capped = true;
|
|
510
546
|
return;
|
|
511
547
|
}
|
|
548
|
+
if (fileBytes + lineBytes > MAX_BYTES && !rotationFailed && !rotateOpenLog()) return;
|
|
549
|
+
if (fd === null) return;
|
|
512
550
|
try {
|
|
513
|
-
|
|
551
|
+
const written = import_node_fs2.default.writeSync(fd, line);
|
|
552
|
+
fileBytes += written;
|
|
553
|
+
processBytes += written;
|
|
514
554
|
} catch {
|
|
515
555
|
}
|
|
516
556
|
}
|
|
@@ -526,7 +566,10 @@ function closeLogger(opts) {
|
|
|
526
566
|
}
|
|
527
567
|
}
|
|
528
568
|
fd = null;
|
|
529
|
-
|
|
569
|
+
logPath = null;
|
|
570
|
+
fileBytes = 0;
|
|
571
|
+
processBytes = 0;
|
|
572
|
+
rotationFailed = false;
|
|
530
573
|
capped = false;
|
|
531
574
|
exactSecrets = [];
|
|
532
575
|
for (const unsub of cleanups) unsub();
|
|
@@ -1393,7 +1436,7 @@ var DEFAULT_CLIENT_ID2 = "b1a00492-073a-47ea-816f-4c329264a828";
|
|
|
1393
1436
|
var DEFAULT_ISSUER = "https://auth.x.ai";
|
|
1394
1437
|
var DEFAULT_CLI_BASE_URL = "https://cli-chat-proxy.grok.com/v1";
|
|
1395
1438
|
var OAUTH_SCOPE = "openid profile email offline_access grok-cli:access api:access";
|
|
1396
|
-
var DEFAULT_GROK_CLI_VERSION = "0.
|
|
1439
|
+
var DEFAULT_GROK_CLI_VERSION = "1.0.67";
|
|
1397
1440
|
var DEVICE_TIMEOUT_FALLBACK_MS = 10 * 60 * 1e3;
|
|
1398
1441
|
var DEFAULT_TOKEN_LIFETIME_SECONDS = 3600;
|
|
1399
1442
|
function issuer() {
|
|
@@ -1682,6 +1725,8 @@ function providerStorageKeys(provider) {
|
|
|
1682
1725
|
return dual ? [dual.oauthKey, dual.provider] : [provider];
|
|
1683
1726
|
}
|
|
1684
1727
|
var XIAOMI_CREDITS_KEY = "xiaomi-credits";
|
|
1728
|
+
var GEMINI_API_KEY = "gemini-api";
|
|
1729
|
+
var GEMINI_API_KEY_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
1685
1730
|
var LOCAL_AUTH_KEY_PREFIX = "local:";
|
|
1686
1731
|
var LOCAL_CREDENTIAL_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
|
|
1687
1732
|
function activeBaseUrlEntry(data, provider) {
|
|
@@ -1785,6 +1830,9 @@ var AuthStorage = class {
|
|
|
1785
1830
|
if (provider === "xiaomi") {
|
|
1786
1831
|
return Boolean(this.data["xiaomi"] || this.data[XIAOMI_CREDITS_KEY]);
|
|
1787
1832
|
}
|
|
1833
|
+
if (provider === "gemini") {
|
|
1834
|
+
return Boolean(this.data["gemini"] || this.data[GEMINI_API_KEY]);
|
|
1835
|
+
}
|
|
1788
1836
|
if (provider === "local") {
|
|
1789
1837
|
return Object.keys(this.data).some((key) => key.startsWith(LOCAL_AUTH_KEY_PREFIX));
|
|
1790
1838
|
}
|
|
@@ -2019,6 +2067,12 @@ var AuthStorage = class {
|
|
|
2019
2067
|
...opts.rejectedToken !== void 0 ? { rejectedToken: opts.rejectedToken } : {}
|
|
2020
2068
|
});
|
|
2021
2069
|
}
|
|
2070
|
+
if (key === provider) {
|
|
2071
|
+
return await this.resolveCredentials(provider, {
|
|
2072
|
+
...opts.forceRefresh ? { forceRefresh: true } : {},
|
|
2073
|
+
...opts.rejectedToken !== void 0 ? { rejectedToken: opts.rejectedToken } : {}
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2022
2076
|
return creds2;
|
|
2023
2077
|
}
|
|
2024
2078
|
throw new NotLoggedInError(provider);
|
|
@@ -2092,9 +2146,20 @@ var AuthStorage = class {
|
|
|
2092
2146
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2093
2147
|
const isAuthFailure = /\((401|400)\)/.test(msg) || /invalid_grant|invalid_token|invalid.*refresh/i.test(msg) || /unauthorized/i.test(msg);
|
|
2094
2148
|
if (isAuthFailure) {
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2149
|
+
const current = await readAuthData(this.filePath);
|
|
2150
|
+
const currentCreds = current[provider];
|
|
2151
|
+
if (currentCreds && currentCreds.refreshToken !== latestCreds.refreshToken) {
|
|
2152
|
+
log(
|
|
2153
|
+
"WARN",
|
|
2154
|
+
"auth",
|
|
2155
|
+
`${provider} token refresh was rejected, but another gg process already saved a newer credential \u2014 adopting it instead of signing out`
|
|
2156
|
+
);
|
|
2157
|
+
this.data = current;
|
|
2158
|
+
return currentCreds;
|
|
2159
|
+
}
|
|
2160
|
+
delete current[provider];
|
|
2161
|
+
this.data = current;
|
|
2162
|
+
await atomicWriteFile(this.filePath, JSON.stringify(current, null, 2));
|
|
2098
2163
|
throw new NotLoggedInError(provider);
|
|
2099
2164
|
}
|
|
2100
2165
|
throw err;
|
|
@@ -2160,6 +2225,24 @@ var NotLoggedInError = class extends Error {
|
|
|
2160
2225
|
};
|
|
2161
2226
|
|
|
2162
2227
|
// src/model-registry.ts
|
|
2228
|
+
var CLAUDE_FAST_BILLING = {
|
|
2229
|
+
label: "bills usage credits",
|
|
2230
|
+
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.",
|
|
2231
|
+
paid: true,
|
|
2232
|
+
standardModel: "claude-opus-5-5"
|
|
2233
|
+
};
|
|
2234
|
+
var XIAOMI_ULTRASPEED_BILLING = {
|
|
2235
|
+
label: "bills API Credits",
|
|
2236
|
+
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.",
|
|
2237
|
+
paid: true,
|
|
2238
|
+
standardModel: "mimo-v2.6-pro"
|
|
2239
|
+
};
|
|
2240
|
+
var CODEX_FAST_BILLING = {
|
|
2241
|
+
label: "2.5x plan usage",
|
|
2242
|
+
detail: "Codex Fast mode uses your ChatGPT plan limits at 2.5x the standard rate (purchased credits at 2x).",
|
|
2243
|
+
paid: false
|
|
2244
|
+
};
|
|
2245
|
+
var GEMINI_AUTH_KEYS = [GEMINI_API_KEY, "gemini"];
|
|
2163
2246
|
var MODELS = [
|
|
2164
2247
|
// ── Anthropic ──────────────────────────────────────────
|
|
2165
2248
|
// NOTE: Claude Mythos 5.1 (`claude-mythos-5-1`, 2026-09-01) is kept commented
|
|
@@ -2222,28 +2305,6 @@ var MODELS = [
|
|
|
2222
2305
|
costTier: "high",
|
|
2223
2306
|
maxThinkingLevel: "max"
|
|
2224
2307
|
},
|
|
2225
|
-
{
|
|
2226
|
-
// Released 2026-07-24 — "For complex agentic coding and enterprise work".
|
|
2227
|
-
// Near-Fable capability at half the price ($5/$25 vs $10/$50). Adaptive
|
|
2228
|
-
// thinking with the full effort ladder (low→max, xhigh included); dateless
|
|
2229
|
-
// ID is the canonical pinned snapshot (post-4.6 naming scheme). Kept as a
|
|
2230
|
-
// legacy option now that Opus 5.5 leads the line: it's the last Opus that
|
|
2231
|
-
// accepts disabled thinking and forced tool use.
|
|
2232
|
-
id: "claude-opus-5",
|
|
2233
|
-
name: "Claude Opus 5",
|
|
2234
|
-
provider: "anthropic",
|
|
2235
|
-
contextWindow: 1e6,
|
|
2236
|
-
maxOutputTokens: 128e3,
|
|
2237
|
-
supportsThinking: true,
|
|
2238
|
-
supportsImages: true,
|
|
2239
|
-
supportsVideo: false,
|
|
2240
|
-
costTier: "high",
|
|
2241
|
-
// Anthropic's API and Claude Code both start the 5.5 family at medium; at a
|
|
2242
|
-
// given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
|
|
2243
|
-
// sessions slow and expensive. Users can still opt up.
|
|
2244
|
-
defaultThinkingLevel: "medium",
|
|
2245
|
-
maxThinkingLevel: "max"
|
|
2246
|
-
},
|
|
2247
2308
|
{
|
|
2248
2309
|
// Opus 5.5 in fast mode (research preview): the same model at up to 2.5x
|
|
2249
2310
|
// output tokens/sec, $8/$40 MTok. @prestyj/ai's `stream()` sends it as
|
|
@@ -2261,7 +2322,8 @@ var MODELS = [
|
|
|
2261
2322
|
supportsVideo: false,
|
|
2262
2323
|
costTier: "high",
|
|
2263
2324
|
defaultThinkingLevel: "medium",
|
|
2264
|
-
maxThinkingLevel: "max"
|
|
2325
|
+
maxThinkingLevel: "max",
|
|
2326
|
+
billing: CLAUDE_FAST_BILLING
|
|
2265
2327
|
},
|
|
2266
2328
|
{
|
|
2267
2329
|
// Released 2026-09-28 — replaces Sonnet 5 at $2/$10 MTok, with the same
|
|
@@ -2275,9 +2337,10 @@ var MODELS = [
|
|
|
2275
2337
|
supportsImages: true,
|
|
2276
2338
|
supportsVideo: false,
|
|
2277
2339
|
costTier: "medium",
|
|
2278
|
-
//
|
|
2279
|
-
//
|
|
2280
|
-
//
|
|
2340
|
+
// We start Sonnet 5.5 at medium like the rest of the 5.5 family (the API's
|
|
2341
|
+
// own default for Sonnet 5.5 is high). At a given level 5.5 thinks more
|
|
2342
|
+
// than 5, so the ladder ceiling (max) made fresh sessions slow and
|
|
2343
|
+
// expensive. Users can still opt up.
|
|
2281
2344
|
defaultThinkingLevel: "medium",
|
|
2282
2345
|
maxThinkingLevel: "max"
|
|
2283
2346
|
},
|
|
@@ -2346,7 +2409,8 @@ var MODELS = [
|
|
|
2346
2409
|
supportsImages: true,
|
|
2347
2410
|
supportsVideo: false,
|
|
2348
2411
|
costTier: "high",
|
|
2349
|
-
maxThinkingLevel: "ultra"
|
|
2412
|
+
maxThinkingLevel: "ultra",
|
|
2413
|
+
billing: CODEX_FAST_BILLING
|
|
2350
2414
|
},
|
|
2351
2415
|
// GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
|
|
2352
2416
|
// GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
|
|
@@ -2390,7 +2454,8 @@ var MODELS = [
|
|
|
2390
2454
|
supportsImages: true,
|
|
2391
2455
|
supportsVideo: false,
|
|
2392
2456
|
costTier: "medium",
|
|
2393
|
-
maxThinkingLevel: "ultra"
|
|
2457
|
+
maxThinkingLevel: "ultra",
|
|
2458
|
+
billing: CODEX_FAST_BILLING
|
|
2394
2459
|
},
|
|
2395
2460
|
{
|
|
2396
2461
|
// Luna — "Fast and affordable model for easier tasks." (Codex priority 4,
|
|
@@ -2424,7 +2489,8 @@ var MODELS = [
|
|
|
2424
2489
|
supportsImages: true,
|
|
2425
2490
|
supportsVideo: false,
|
|
2426
2491
|
costTier: "low",
|
|
2427
|
-
maxThinkingLevel: "max"
|
|
2492
|
+
maxThinkingLevel: "max",
|
|
2493
|
+
billing: CODEX_FAST_BILLING
|
|
2428
2494
|
},
|
|
2429
2495
|
// ── Sakana (Fugu) ──────────────────────────────────────
|
|
2430
2496
|
// Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
|
|
@@ -2508,10 +2574,14 @@ var MODELS = [
|
|
|
2508
2574
|
supportsVideo: true,
|
|
2509
2575
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2510
2576
|
costTier: "low",
|
|
2511
|
-
maxThinkingLevel: "high"
|
|
2577
|
+
maxThinkingLevel: "high",
|
|
2578
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2512
2579
|
},
|
|
2513
2580
|
// Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
|
|
2514
|
-
// New GA models are opt-in; Code Assist access varies by account.
|
|
2581
|
+
// New GA models are opt-in; Code Assist access varies by account. Gemini 3.7
|
|
2582
|
+
// Flash is retired: Google deprecated it on 2026-10-08 and routes every
|
|
2583
|
+
// `gemini-3.7-flash` request to 3.8 Flash (ai.google.dev/gemini-api/docs/
|
|
2584
|
+
// changelog), so a saved session on it falls back to the provider default.
|
|
2515
2585
|
{
|
|
2516
2586
|
id: "gemini-3.8-flash",
|
|
2517
2587
|
name: "Gemini 3.8 Flash",
|
|
@@ -2523,7 +2593,8 @@ var MODELS = [
|
|
|
2523
2593
|
supportsVideo: true,
|
|
2524
2594
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2525
2595
|
costTier: "low",
|
|
2526
|
-
maxThinkingLevel: "high"
|
|
2596
|
+
maxThinkingLevel: "high",
|
|
2597
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2527
2598
|
},
|
|
2528
2599
|
{
|
|
2529
2600
|
id: "gemini-3.5-flash-lite",
|
|
@@ -2536,27 +2607,8 @@ var MODELS = [
|
|
|
2536
2607
|
supportsVideo: true,
|
|
2537
2608
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2538
2609
|
costTier: "low",
|
|
2539
|
-
maxThinkingLevel: "high"
|
|
2540
|
-
|
|
2541
|
-
{
|
|
2542
|
-
// Gemini 3.7 Flash (released 2026-08-13) — Google's most capable Flash for
|
|
2543
|
-
// coding, agents, and multi-step execution; GA-stable on the Gemini API as
|
|
2544
|
-
// `gemini-3.7-flash`. 1M context, 64K output, thinking low/medium/high.
|
|
2545
|
-
// Sent over our Code Assist (OAuth) transport ahead of gemini-cli — upstream
|
|
2546
|
-
// hasn't listed 3.7 yet (google-gemini/gemini-cli#28802, still open) — so
|
|
2547
|
-
// free/personal accounts 404 (entitlement-gated) while Code Assist
|
|
2548
|
-
// Standard/Enterprise accounts get it.
|
|
2549
|
-
id: "gemini-3.7-flash",
|
|
2550
|
-
name: "Gemini 3.7 Flash",
|
|
2551
|
-
provider: "gemini",
|
|
2552
|
-
contextWindow: 1048576,
|
|
2553
|
-
maxOutputTokens: 65536,
|
|
2554
|
-
supportsThinking: true,
|
|
2555
|
-
supportsImages: true,
|
|
2556
|
-
supportsVideo: true,
|
|
2557
|
-
maxVideoBytes: 20 * 1024 * 1024,
|
|
2558
|
-
costTier: "low",
|
|
2559
|
-
maxThinkingLevel: "high"
|
|
2610
|
+
maxThinkingLevel: "high",
|
|
2611
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2560
2612
|
},
|
|
2561
2613
|
{
|
|
2562
2614
|
// Wire name `gemini-3-flash` — the Code Assist (OAuth) backend rejects the
|
|
@@ -2572,7 +2624,8 @@ var MODELS = [
|
|
|
2572
2624
|
supportsVideo: true,
|
|
2573
2625
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2574
2626
|
costTier: "low",
|
|
2575
|
-
maxThinkingLevel: "high"
|
|
2627
|
+
maxThinkingLevel: "high",
|
|
2628
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2576
2629
|
},
|
|
2577
2630
|
{
|
|
2578
2631
|
// Gemini 3.1 Pro is public preview — gated behind Code Assist preview
|
|
@@ -2588,7 +2641,8 @@ var MODELS = [
|
|
|
2588
2641
|
supportsVideo: true,
|
|
2589
2642
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2590
2643
|
costTier: "high",
|
|
2591
|
-
maxThinkingLevel: "high"
|
|
2644
|
+
maxThinkingLevel: "high",
|
|
2645
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2592
2646
|
},
|
|
2593
2647
|
// ── Moonshot (Kimi) ────────────────────────────────────
|
|
2594
2648
|
// K3 is Kimi's 2.8T-parameter flagship for long-horizon coding, knowledge
|
|
@@ -2793,9 +2847,13 @@ var MODELS = [
|
|
|
2793
2847
|
maxVideoBytes: 36 * 1024 * 1024,
|
|
2794
2848
|
costTier: "high",
|
|
2795
2849
|
maxThinkingLevel: "high",
|
|
2796
|
-
authStorageKeys: [XIAOMI_CREDITS_KEY]
|
|
2850
|
+
authStorageKeys: [XIAOMI_CREDITS_KEY],
|
|
2851
|
+
billing: XIAOMI_ULTRASPEED_BILLING
|
|
2797
2852
|
},
|
|
2798
2853
|
// ── DeepSeek ───────────────────────────────────────────
|
|
2854
|
+
// Window 1,000,000 tokens (decimal "1M"), as DeepSeek's own agent sizes it
|
|
2855
|
+
// (deepseek-ai/deepseek-harness DEFAULT_CONTEXT_WINDOW = 1_000_000; models.dev
|
|
2856
|
+
// via earendil-works/pi agrees) — not 1,048,576.
|
|
2799
2857
|
// The live /models list (2026-09-28) serves exactly `deepseek-flash` and
|
|
2800
2858
|
// `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
|
|
2801
2859
|
// ids only temporarily route to V4.1 Flash, so they are retired here too.
|
|
@@ -2809,7 +2867,7 @@ var MODELS = [
|
|
|
2809
2867
|
id: "deepseek-v4-pro",
|
|
2810
2868
|
name: "DeepSeek V4 Pro",
|
|
2811
2869
|
provider: "deepseek",
|
|
2812
|
-
contextWindow:
|
|
2870
|
+
contextWindow: 1e6,
|
|
2813
2871
|
maxOutputTokens: 384e3,
|
|
2814
2872
|
supportsThinking: true,
|
|
2815
2873
|
supportsImages: false,
|
|
@@ -2823,7 +2881,7 @@ var MODELS = [
|
|
|
2823
2881
|
id: "deepseek-flash",
|
|
2824
2882
|
name: "DeepSeek V4.1 Flash",
|
|
2825
2883
|
provider: "deepseek",
|
|
2826
|
-
contextWindow:
|
|
2884
|
+
contextWindow: 1e6,
|
|
2827
2885
|
maxOutputTokens: 384e3,
|
|
2828
2886
|
supportsThinking: true,
|
|
2829
2887
|
supportsImages: true,
|
|
@@ -2887,7 +2945,7 @@ var MODELS = [
|
|
|
2887
2945
|
id: "deepseek-ai/DeepSeek-V4.1-Flash",
|
|
2888
2946
|
name: "DeepSeek V4.1 Flash",
|
|
2889
2947
|
provider: "huggingface",
|
|
2890
|
-
contextWindow:
|
|
2948
|
+
contextWindow: 1e6,
|
|
2891
2949
|
maxOutputTokens: 131072,
|
|
2892
2950
|
supportsThinking: false,
|
|
2893
2951
|
supportsImages: true,
|
|
@@ -2934,6 +2992,19 @@ function getModel(id) {
|
|
|
2934
2992
|
function getModelsForProvider(provider) {
|
|
2935
2993
|
return getAllModels().filter((m) => m.provider === provider);
|
|
2936
2994
|
}
|
|
2995
|
+
function isPaidModel(modelId) {
|
|
2996
|
+
return getModel(modelId)?.billing?.paid === true;
|
|
2997
|
+
}
|
|
2998
|
+
function withoutPaidTier(modelId) {
|
|
2999
|
+
const model = getModel(modelId);
|
|
3000
|
+
if (model?.billing?.paid !== true) return modelId;
|
|
3001
|
+
const usable = (id) => id !== void 0 && getModel(id) !== void 0 && !isPaidModel(id);
|
|
3002
|
+
const standard = model.billing.standardModel;
|
|
3003
|
+
if (usable(standard)) return standard;
|
|
3004
|
+
const providerDefault = DEFAULT_MODEL_IDS[model.provider];
|
|
3005
|
+
if (usable(providerDefault)) return providerDefault;
|
|
3006
|
+
return FALLBACK_DEFAULT_MODEL_ID;
|
|
3007
|
+
}
|
|
2937
3008
|
function getAuthStorageKeys(provider, modelId) {
|
|
2938
3009
|
const model = getAllModels().find((m) => m.id === modelId && m.provider === provider);
|
|
2939
3010
|
return model?.authStorageKeys ?? [provider];
|
|
@@ -3015,9 +3086,7 @@ var SUMMARY_COST_TIER = {
|
|
|
3015
3086
|
};
|
|
3016
3087
|
function getSummaryModel(provider, currentModelId) {
|
|
3017
3088
|
const tier = SUMMARY_COST_TIER[provider];
|
|
3018
|
-
const tagged = tier ? getModelsForProvider(provider).find(
|
|
3019
|
-
(m) => m.costTier === tier && !(0, import_ai2.resolveFastModeModel)(provider, m.id).fast
|
|
3020
|
-
) : void 0;
|
|
3089
|
+
const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier && m.billing === void 0) : void 0;
|
|
3021
3090
|
return tagged ?? getModel(currentModelId) ?? getDefaultModel(provider);
|
|
3022
3091
|
}
|
|
3023
3092
|
|
|
@@ -3435,8 +3504,28 @@ var AUTH_PROVIDERS = [
|
|
|
3435
3504
|
{
|
|
3436
3505
|
value: "gemini",
|
|
3437
3506
|
label: "Gemini",
|
|
3438
|
-
description: "Gemini 3.8 Flash, 3.5 Flash Lite, 3.
|
|
3439
|
-
methods: ["oauth"]
|
|
3507
|
+
description: "Gemini 3.8 Flash, 3.5 Flash Lite, 3.1 Flash Lite, 3.5 Flash, 3.1 Pro (Preview)",
|
|
3508
|
+
methods: ["oauth", "apikey"],
|
|
3509
|
+
apiKeyLabel: "Gemini",
|
|
3510
|
+
apiKeyBaseUrl: GEMINI_API_KEY_BASE_URL,
|
|
3511
|
+
// Stored under its own key so it never overwrites the `gemini` OAuth login.
|
|
3512
|
+
apiKeyVariants: [
|
|
3513
|
+
{ key: GEMINI_API_KEY, label: "Google AI Studio", baseUrl: GEMINI_API_KEY_BASE_URL }
|
|
3514
|
+
],
|
|
3515
|
+
methodDetails: {
|
|
3516
|
+
oauth: {
|
|
3517
|
+
method: "oauth",
|
|
3518
|
+
label: "Sign in with Google",
|
|
3519
|
+
billing: "Gemini Code Assist Standard or Enterprise licence.",
|
|
3520
|
+
when: "Personal Google accounts are no longer served here (Google ended it on June 18, 2026)."
|
|
3521
|
+
},
|
|
3522
|
+
apikey: {
|
|
3523
|
+
method: "apikey",
|
|
3524
|
+
label: "Gemini API key",
|
|
3525
|
+
billing: "Pay-per-token from a Google AI Studio key.",
|
|
3526
|
+
when: "Used first whenever it is set."
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3440
3529
|
},
|
|
3441
3530
|
{
|
|
3442
3531
|
value: "xai",
|
|
@@ -3566,6 +3655,9 @@ function describeAuthMethods(provider) {
|
|
|
3566
3655
|
});
|
|
3567
3656
|
}
|
|
3568
3657
|
function authPriorityNote(provider) {
|
|
3658
|
+
if (provider === "gemini") {
|
|
3659
|
+
return "Uses the Gemini API key first when one is set; otherwise the Google sign-in.";
|
|
3660
|
+
}
|
|
3569
3661
|
const dual = dualAuthProvider(provider);
|
|
3570
3662
|
if (!dual) return void 0;
|
|
3571
3663
|
return `Uses ${dual.oauthLabel} first; the ${dual.apiKeyLabel} takes over when it runs out, then switches back.`;
|
|
@@ -4312,6 +4404,8 @@ function createAutoUpdater(config) {
|
|
|
4312
4404
|
DEFAULT_LOCAL_ENDPOINTS,
|
|
4313
4405
|
DEFAULT_MAX_VIDEO_BYTES,
|
|
4314
4406
|
FALLBACK_CONTEXT_WINDOW,
|
|
4407
|
+
GEMINI_API_KEY,
|
|
4408
|
+
GEMINI_API_KEY_BASE_URL,
|
|
4315
4409
|
LOCAL_API_KEY_PLACEHOLDER,
|
|
4316
4410
|
LOCAL_AUTH_KEY_PREFIX,
|
|
4317
4411
|
MODELS,
|
|
@@ -4367,6 +4461,7 @@ function createAutoUpdater(config) {
|
|
|
4367
4461
|
isLocalModelId,
|
|
4368
4462
|
isLoggerOpen,
|
|
4369
4463
|
isModelLoaded,
|
|
4464
|
+
isPaidModel,
|
|
4370
4465
|
isThinkingLevelSupported,
|
|
4371
4466
|
kimiCodeBaseUrl,
|
|
4372
4467
|
kimiCodingHeaders,
|
|
@@ -4396,6 +4491,7 @@ function createAutoUpdater(config) {
|
|
|
4396
4491
|
toModelInfo,
|
|
4397
4492
|
transcribeVoice,
|
|
4398
4493
|
usesOpenAICodexTransport,
|
|
4399
|
-
withFileLock
|
|
4494
|
+
withFileLock,
|
|
4495
|
+
withoutPaidTier
|
|
4400
4496
|
});
|
|
4401
4497
|
//# sourceMappingURL=index.cjs.map
|