@prestyj/core 5.31.0 → 5.32.1
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-CRU3SSNX.js → chunk-W4NHU4UL.js} +3 -2
- package/dist/chunk-W4NHU4UL.js.map +1 -0
- package/dist/{chunk-GYAMOZYP.js → chunk-XPXWXKRZ.js} +207 -64
- package/dist/chunk-XPXWXKRZ.js.map +1 -0
- package/dist/index.cjs +240 -69
- 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 +39 -8
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +129 -48
- 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-CRU3SSNX.js.map +0 -1
- package/dist/chunk-GYAMOZYP.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,7 +122,8 @@ __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
|
|
|
@@ -152,7 +156,8 @@ function getAppPaths() {
|
|
|
152
156
|
extensionsDir: import_node_path.default.join(agentDir, "extensions"),
|
|
153
157
|
agentsDir: import_node_path.default.join(agentDir, "agents"),
|
|
154
158
|
progressFile: import_node_path.default.join(agentDir, "progress.json"),
|
|
155
|
-
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")
|
|
156
161
|
};
|
|
157
162
|
}
|
|
158
163
|
|
|
@@ -415,16 +420,19 @@ var import_ai = require("@prestyj/ai");
|
|
|
415
420
|
var MAX_BYTES = 10 * 1024 * 1024;
|
|
416
421
|
var MIN_HEADROOM_BYTES = 64 * 1024;
|
|
417
422
|
var fd = null;
|
|
418
|
-
var
|
|
423
|
+
var logPath = null;
|
|
424
|
+
var fileBytes = 0;
|
|
425
|
+
var processBytes = 0;
|
|
426
|
+
var rotationFailed = false;
|
|
419
427
|
var capped = false;
|
|
420
428
|
var sessionId = "";
|
|
421
429
|
var appName = "app";
|
|
422
430
|
var cleanups = [];
|
|
423
431
|
var exactSecrets = [];
|
|
424
|
-
function rotateIfNeeded(filePath) {
|
|
432
|
+
function rotateIfNeeded(filePath, force = false) {
|
|
425
433
|
try {
|
|
426
434
|
const st = import_node_fs2.default.statSync(filePath);
|
|
427
|
-
if (st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
|
|
435
|
+
if (!force && st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
|
|
428
436
|
const rotated = `${filePath}.1`;
|
|
429
437
|
try {
|
|
430
438
|
import_node_fs2.default.unlinkSync(rotated);
|
|
@@ -434,6 +442,32 @@ function rotateIfNeeded(filePath) {
|
|
|
434
442
|
} catch {
|
|
435
443
|
}
|
|
436
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
|
+
}
|
|
437
471
|
function openLog(filePath, name) {
|
|
438
472
|
if (fd !== null || capped) return false;
|
|
439
473
|
appName = name;
|
|
@@ -447,24 +481,29 @@ function openLog(filePath, name) {
|
|
|
447
481
|
fd = import_node_fs2.default.openSync(filePath, "a");
|
|
448
482
|
} catch {
|
|
449
483
|
fd = null;
|
|
450
|
-
|
|
484
|
+
fileBytes = 0;
|
|
451
485
|
return false;
|
|
452
486
|
}
|
|
453
487
|
try {
|
|
454
|
-
|
|
488
|
+
fileBytes = import_node_fs2.default.fstatSync(fd).size;
|
|
455
489
|
} catch {
|
|
456
490
|
try {
|
|
457
491
|
import_node_fs2.default.closeSync(fd);
|
|
458
492
|
} catch {
|
|
459
493
|
}
|
|
460
494
|
fd = null;
|
|
461
|
-
|
|
495
|
+
fileBytes = 0;
|
|
462
496
|
return false;
|
|
463
497
|
}
|
|
498
|
+
logPath = filePath;
|
|
499
|
+
processBytes = 0;
|
|
500
|
+
rotationFailed = false;
|
|
464
501
|
sessionId = (0, import_node_crypto2.randomBytes)(4).toString("hex");
|
|
465
502
|
try {
|
|
466
|
-
if (
|
|
467
|
-
|
|
503
|
+
if (fileBytes < MAX_BYTES) {
|
|
504
|
+
const written = import_node_fs2.default.writeSync(fd, "\n");
|
|
505
|
+
fileBytes += written;
|
|
506
|
+
processBytes += written;
|
|
468
507
|
}
|
|
469
508
|
} catch {
|
|
470
509
|
}
|
|
@@ -492,12 +531,12 @@ function log(level, category, message, data) {
|
|
|
492
531
|
}
|
|
493
532
|
line += "\n";
|
|
494
533
|
const lineBytes = Buffer.byteLength(line);
|
|
495
|
-
if (
|
|
534
|
+
if (processBytes + lineBytes > MAX_BYTES) {
|
|
496
535
|
const capLine = `[${ts}] [sid=${sessionId}] [WARN] [logger] Log cap reached; file logging disabled until restart
|
|
497
536
|
`;
|
|
498
537
|
try {
|
|
499
|
-
if (
|
|
500
|
-
|
|
538
|
+
if (fileBytes + Buffer.byteLength(capLine) <= MAX_BYTES) {
|
|
539
|
+
fileBytes += import_node_fs2.default.writeSync(fd, capLine);
|
|
501
540
|
}
|
|
502
541
|
import_node_fs2.default.closeSync(fd);
|
|
503
542
|
} catch {
|
|
@@ -506,8 +545,12 @@ function log(level, category, message, data) {
|
|
|
506
545
|
capped = true;
|
|
507
546
|
return;
|
|
508
547
|
}
|
|
548
|
+
if (fileBytes + lineBytes > MAX_BYTES && !rotationFailed && !rotateOpenLog()) return;
|
|
549
|
+
if (fd === null) return;
|
|
509
550
|
try {
|
|
510
|
-
|
|
551
|
+
const written = import_node_fs2.default.writeSync(fd, line);
|
|
552
|
+
fileBytes += written;
|
|
553
|
+
processBytes += written;
|
|
511
554
|
} catch {
|
|
512
555
|
}
|
|
513
556
|
}
|
|
@@ -523,7 +566,10 @@ function closeLogger(opts) {
|
|
|
523
566
|
}
|
|
524
567
|
}
|
|
525
568
|
fd = null;
|
|
526
|
-
|
|
569
|
+
logPath = null;
|
|
570
|
+
fileBytes = 0;
|
|
571
|
+
processBytes = 0;
|
|
572
|
+
rotationFailed = false;
|
|
527
573
|
capped = false;
|
|
528
574
|
exactSecrets = [];
|
|
529
575
|
for (const unsub of cleanups) unsub();
|
|
@@ -1679,6 +1725,8 @@ function providerStorageKeys(provider) {
|
|
|
1679
1725
|
return dual ? [dual.oauthKey, dual.provider] : [provider];
|
|
1680
1726
|
}
|
|
1681
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";
|
|
1682
1730
|
var LOCAL_AUTH_KEY_PREFIX = "local:";
|
|
1683
1731
|
var LOCAL_CREDENTIAL_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
|
|
1684
1732
|
function activeBaseUrlEntry(data, provider) {
|
|
@@ -1782,6 +1830,9 @@ var AuthStorage = class {
|
|
|
1782
1830
|
if (provider === "xiaomi") {
|
|
1783
1831
|
return Boolean(this.data["xiaomi"] || this.data[XIAOMI_CREDITS_KEY]);
|
|
1784
1832
|
}
|
|
1833
|
+
if (provider === "gemini") {
|
|
1834
|
+
return Boolean(this.data["gemini"] || this.data[GEMINI_API_KEY]);
|
|
1835
|
+
}
|
|
1785
1836
|
if (provider === "local") {
|
|
1786
1837
|
return Object.keys(this.data).some((key) => key.startsWith(LOCAL_AUTH_KEY_PREFIX));
|
|
1787
1838
|
}
|
|
@@ -2016,6 +2067,12 @@ var AuthStorage = class {
|
|
|
2016
2067
|
...opts.rejectedToken !== void 0 ? { rejectedToken: opts.rejectedToken } : {}
|
|
2017
2068
|
});
|
|
2018
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
|
+
}
|
|
2019
2076
|
return creds2;
|
|
2020
2077
|
}
|
|
2021
2078
|
throw new NotLoggedInError(provider);
|
|
@@ -2089,9 +2146,20 @@ var AuthStorage = class {
|
|
|
2089
2146
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2090
2147
|
const isAuthFailure = /\((401|400)\)/.test(msg) || /invalid_grant|invalid_token|invalid.*refresh/i.test(msg) || /unauthorized/i.test(msg);
|
|
2091
2148
|
if (isAuthFailure) {
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
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));
|
|
2095
2163
|
throw new NotLoggedInError(provider);
|
|
2096
2164
|
}
|
|
2097
2165
|
throw err;
|
|
@@ -2157,6 +2225,24 @@ var NotLoggedInError = class extends Error {
|
|
|
2157
2225
|
};
|
|
2158
2226
|
|
|
2159
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"];
|
|
2160
2246
|
var MODELS = [
|
|
2161
2247
|
// ── Anthropic ──────────────────────────────────────────
|
|
2162
2248
|
// NOTE: Claude Mythos 5.1 (`claude-mythos-5-1`, 2026-09-01) is kept commented
|
|
@@ -2220,14 +2306,14 @@ var MODELS = [
|
|
|
2220
2306
|
maxThinkingLevel: "max"
|
|
2221
2307
|
},
|
|
2222
2308
|
{
|
|
2223
|
-
//
|
|
2224
|
-
//
|
|
2225
|
-
//
|
|
2226
|
-
//
|
|
2227
|
-
//
|
|
2228
|
-
//
|
|
2229
|
-
id: "claude-opus-5",
|
|
2230
|
-
name: "Claude Opus 5",
|
|
2309
|
+
// Opus 5.5 in fast mode (research preview): the same model at up to 2.5x
|
|
2310
|
+
// output tokens/sec, $8/$40 MTok. @prestyj/ai's `stream()` sends it as
|
|
2311
|
+
// `claude-opus-5-5` + `speed: "fast"` + the fast-mode beta. On a Claude
|
|
2312
|
+
// subscription it bills usage credits only — never included plan usage —
|
|
2313
|
+
// and Anthropic 429s "Usage credits are required for fast mode" until they
|
|
2314
|
+
// are turned on. Its prompt cache is separate from standard-speed Opus.
|
|
2315
|
+
id: "claude-opus-5-5-fast",
|
|
2316
|
+
name: "Claude Opus 5.5 Fast",
|
|
2231
2317
|
provider: "anthropic",
|
|
2232
2318
|
contextWindow: 1e6,
|
|
2233
2319
|
maxOutputTokens: 128e3,
|
|
@@ -2235,11 +2321,9 @@ var MODELS = [
|
|
|
2235
2321
|
supportsImages: true,
|
|
2236
2322
|
supportsVideo: false,
|
|
2237
2323
|
costTier: "high",
|
|
2238
|
-
// Anthropic's API and Claude Code both start the 5.5 family at medium; at a
|
|
2239
|
-
// given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
|
|
2240
|
-
// sessions slow and expensive. Users can still opt up.
|
|
2241
2324
|
defaultThinkingLevel: "medium",
|
|
2242
|
-
maxThinkingLevel: "max"
|
|
2325
|
+
maxThinkingLevel: "max",
|
|
2326
|
+
billing: CLAUDE_FAST_BILLING
|
|
2243
2327
|
},
|
|
2244
2328
|
{
|
|
2245
2329
|
// Released 2026-09-28 — replaces Sonnet 5 at $2/$10 MTok, with the same
|
|
@@ -2253,9 +2337,10 @@ var MODELS = [
|
|
|
2253
2337
|
supportsImages: true,
|
|
2254
2338
|
supportsVideo: false,
|
|
2255
2339
|
costTier: "medium",
|
|
2256
|
-
//
|
|
2257
|
-
//
|
|
2258
|
-
//
|
|
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.
|
|
2259
2344
|
defaultThinkingLevel: "medium",
|
|
2260
2345
|
maxThinkingLevel: "max"
|
|
2261
2346
|
},
|
|
@@ -2308,6 +2393,25 @@ var MODELS = [
|
|
|
2308
2393
|
costTier: "high",
|
|
2309
2394
|
maxThinkingLevel: "ultra"
|
|
2310
2395
|
},
|
|
2396
|
+
{
|
|
2397
|
+
// Codex Fast mode for Astra (catalog `service_tiers: priority`, "2x speed,
|
|
2398
|
+
// increased usage"). @prestyj/ai's `stream()` sends it as `gpt-6-astra` +
|
|
2399
|
+
// `service_tier: "priority"`, exactly what the Codex CLI sends. On a
|
|
2400
|
+
// ChatGPT plan it draws included limits at 2.5x the standard rate.
|
|
2401
|
+
id: "gpt-6-astra-fast",
|
|
2402
|
+
name: "GPT-6 Astra Fast",
|
|
2403
|
+
provider: "openai",
|
|
2404
|
+
contextWindow: 105e4,
|
|
2405
|
+
codexContextWindow: 272e3,
|
|
2406
|
+
maxOutputTokens: 128e3,
|
|
2407
|
+
supportsThinking: true,
|
|
2408
|
+
defaultThinkingLevel: "low",
|
|
2409
|
+
supportsImages: true,
|
|
2410
|
+
supportsVideo: false,
|
|
2411
|
+
costTier: "high",
|
|
2412
|
+
maxThinkingLevel: "ultra",
|
|
2413
|
+
billing: CODEX_FAST_BILLING
|
|
2414
|
+
},
|
|
2311
2415
|
// GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
|
|
2312
2416
|
// GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
|
|
2313
2417
|
// catalog upgrades 5.6 Terra to 6 Sol). GPT-6.1 Sol (2026-09-29) then replaced
|
|
@@ -2336,6 +2440,23 @@ var MODELS = [
|
|
|
2336
2440
|
costTier: "medium",
|
|
2337
2441
|
maxThinkingLevel: "ultra"
|
|
2338
2442
|
},
|
|
2443
|
+
{
|
|
2444
|
+
// Codex Fast mode for 6.1 Sol ("2x speed, increased usage") — see
|
|
2445
|
+
// `gpt-6-astra-fast` for the wire mapping and billing.
|
|
2446
|
+
id: "gpt-6.1-sol-fast",
|
|
2447
|
+
name: "GPT-6.1 Sol Fast",
|
|
2448
|
+
provider: "openai",
|
|
2449
|
+
contextWindow: 105e4,
|
|
2450
|
+
codexContextWindow: 272e3,
|
|
2451
|
+
maxOutputTokens: 128e3,
|
|
2452
|
+
supportsThinking: true,
|
|
2453
|
+
defaultThinkingLevel: "low",
|
|
2454
|
+
supportsImages: true,
|
|
2455
|
+
supportsVideo: false,
|
|
2456
|
+
costTier: "medium",
|
|
2457
|
+
maxThinkingLevel: "ultra",
|
|
2458
|
+
billing: CODEX_FAST_BILLING
|
|
2459
|
+
},
|
|
2339
2460
|
{
|
|
2340
2461
|
// Luna — "Fast and affordable model for easier tasks." (Codex priority 4,
|
|
2341
2462
|
// default medium, needs a Codex client >= 0.155.0). $0.10/$0.50 MTok.
|
|
@@ -2353,6 +2474,24 @@ var MODELS = [
|
|
|
2353
2474
|
costTier: "low",
|
|
2354
2475
|
maxThinkingLevel: "max"
|
|
2355
2476
|
},
|
|
2477
|
+
{
|
|
2478
|
+
// Codex Fast mode for Luna ("1.5x speed") — see `gpt-6-astra-fast` for the
|
|
2479
|
+
// wire mapping and billing. Listed after Luna so compaction summaries
|
|
2480
|
+
// (first `low` OpenAI model) stay on standard-speed Luna.
|
|
2481
|
+
id: "gpt-6-luna-fast",
|
|
2482
|
+
name: "GPT-6 Luna Fast",
|
|
2483
|
+
provider: "openai",
|
|
2484
|
+
contextWindow: 105e4,
|
|
2485
|
+
codexContextWindow: 272e3,
|
|
2486
|
+
maxOutputTokens: 128e3,
|
|
2487
|
+
supportsThinking: true,
|
|
2488
|
+
defaultThinkingLevel: "medium",
|
|
2489
|
+
supportsImages: true,
|
|
2490
|
+
supportsVideo: false,
|
|
2491
|
+
costTier: "low",
|
|
2492
|
+
maxThinkingLevel: "max",
|
|
2493
|
+
billing: CODEX_FAST_BILLING
|
|
2494
|
+
},
|
|
2356
2495
|
// ── Sakana (Fugu) ──────────────────────────────────────
|
|
2357
2496
|
// Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
|
|
2358
2497
|
// OpenAI-compatible Sakana API (https://api.sakana.ai/v1). All three take
|
|
@@ -2435,10 +2574,14 @@ var MODELS = [
|
|
|
2435
2574
|
supportsVideo: true,
|
|
2436
2575
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2437
2576
|
costTier: "low",
|
|
2438
|
-
maxThinkingLevel: "high"
|
|
2577
|
+
maxThinkingLevel: "high",
|
|
2578
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2439
2579
|
},
|
|
2440
2580
|
// Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
|
|
2441
|
-
// 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.
|
|
2442
2585
|
{
|
|
2443
2586
|
id: "gemini-3.8-flash",
|
|
2444
2587
|
name: "Gemini 3.8 Flash",
|
|
@@ -2450,7 +2593,8 @@ var MODELS = [
|
|
|
2450
2593
|
supportsVideo: true,
|
|
2451
2594
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2452
2595
|
costTier: "low",
|
|
2453
|
-
maxThinkingLevel: "high"
|
|
2596
|
+
maxThinkingLevel: "high",
|
|
2597
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2454
2598
|
},
|
|
2455
2599
|
{
|
|
2456
2600
|
id: "gemini-3.5-flash-lite",
|
|
@@ -2463,27 +2607,8 @@ var MODELS = [
|
|
|
2463
2607
|
supportsVideo: true,
|
|
2464
2608
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2465
2609
|
costTier: "low",
|
|
2466
|
-
maxThinkingLevel: "high"
|
|
2467
|
-
|
|
2468
|
-
{
|
|
2469
|
-
// Gemini 3.7 Flash (released 2026-08-13) — Google's most capable Flash for
|
|
2470
|
-
// coding, agents, and multi-step execution; GA-stable on the Gemini API as
|
|
2471
|
-
// `gemini-3.7-flash`. 1M context, 64K output, thinking low/medium/high.
|
|
2472
|
-
// Sent over our Code Assist (OAuth) transport ahead of gemini-cli — upstream
|
|
2473
|
-
// hasn't listed 3.7 yet (google-gemini/gemini-cli#28802, still open) — so
|
|
2474
|
-
// free/personal accounts 404 (entitlement-gated) while Code Assist
|
|
2475
|
-
// Standard/Enterprise accounts get it.
|
|
2476
|
-
id: "gemini-3.7-flash",
|
|
2477
|
-
name: "Gemini 3.7 Flash",
|
|
2478
|
-
provider: "gemini",
|
|
2479
|
-
contextWindow: 1048576,
|
|
2480
|
-
maxOutputTokens: 65536,
|
|
2481
|
-
supportsThinking: true,
|
|
2482
|
-
supportsImages: true,
|
|
2483
|
-
supportsVideo: true,
|
|
2484
|
-
maxVideoBytes: 20 * 1024 * 1024,
|
|
2485
|
-
costTier: "low",
|
|
2486
|
-
maxThinkingLevel: "high"
|
|
2610
|
+
maxThinkingLevel: "high",
|
|
2611
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2487
2612
|
},
|
|
2488
2613
|
{
|
|
2489
2614
|
// Wire name `gemini-3-flash` — the Code Assist (OAuth) backend rejects the
|
|
@@ -2499,7 +2624,8 @@ var MODELS = [
|
|
|
2499
2624
|
supportsVideo: true,
|
|
2500
2625
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2501
2626
|
costTier: "low",
|
|
2502
|
-
maxThinkingLevel: "high"
|
|
2627
|
+
maxThinkingLevel: "high",
|
|
2628
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2503
2629
|
},
|
|
2504
2630
|
{
|
|
2505
2631
|
// Gemini 3.1 Pro is public preview — gated behind Code Assist preview
|
|
@@ -2515,7 +2641,8 @@ var MODELS = [
|
|
|
2515
2641
|
supportsVideo: true,
|
|
2516
2642
|
maxVideoBytes: 20 * 1024 * 1024,
|
|
2517
2643
|
costTier: "high",
|
|
2518
|
-
maxThinkingLevel: "high"
|
|
2644
|
+
maxThinkingLevel: "high",
|
|
2645
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
2519
2646
|
},
|
|
2520
2647
|
// ── Moonshot (Kimi) ────────────────────────────────────
|
|
2521
2648
|
// K3 is Kimi's 2.8T-parameter flagship for long-horizon coding, knowledge
|
|
@@ -2720,9 +2847,13 @@ var MODELS = [
|
|
|
2720
2847
|
maxVideoBytes: 36 * 1024 * 1024,
|
|
2721
2848
|
costTier: "high",
|
|
2722
2849
|
maxThinkingLevel: "high",
|
|
2723
|
-
authStorageKeys: [XIAOMI_CREDITS_KEY]
|
|
2850
|
+
authStorageKeys: [XIAOMI_CREDITS_KEY],
|
|
2851
|
+
billing: XIAOMI_ULTRASPEED_BILLING
|
|
2724
2852
|
},
|
|
2725
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.
|
|
2726
2857
|
// The live /models list (2026-09-28) serves exactly `deepseek-flash` and
|
|
2727
2858
|
// `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
|
|
2728
2859
|
// ids only temporarily route to V4.1 Flash, so they are retired here too.
|
|
@@ -2736,7 +2867,7 @@ var MODELS = [
|
|
|
2736
2867
|
id: "deepseek-v4-pro",
|
|
2737
2868
|
name: "DeepSeek V4 Pro",
|
|
2738
2869
|
provider: "deepseek",
|
|
2739
|
-
contextWindow:
|
|
2870
|
+
contextWindow: 1e6,
|
|
2740
2871
|
maxOutputTokens: 384e3,
|
|
2741
2872
|
supportsThinking: true,
|
|
2742
2873
|
supportsImages: false,
|
|
@@ -2750,7 +2881,7 @@ var MODELS = [
|
|
|
2750
2881
|
id: "deepseek-flash",
|
|
2751
2882
|
name: "DeepSeek V4.1 Flash",
|
|
2752
2883
|
provider: "deepseek",
|
|
2753
|
-
contextWindow:
|
|
2884
|
+
contextWindow: 1e6,
|
|
2754
2885
|
maxOutputTokens: 384e3,
|
|
2755
2886
|
supportsThinking: true,
|
|
2756
2887
|
supportsImages: true,
|
|
@@ -2814,7 +2945,7 @@ var MODELS = [
|
|
|
2814
2945
|
id: "deepseek-ai/DeepSeek-V4.1-Flash",
|
|
2815
2946
|
name: "DeepSeek V4.1 Flash",
|
|
2816
2947
|
provider: "huggingface",
|
|
2817
|
-
contextWindow:
|
|
2948
|
+
contextWindow: 1e6,
|
|
2818
2949
|
maxOutputTokens: 131072,
|
|
2819
2950
|
supportsThinking: false,
|
|
2820
2951
|
supportsImages: true,
|
|
@@ -2861,6 +2992,19 @@ function getModel(id) {
|
|
|
2861
2992
|
function getModelsForProvider(provider) {
|
|
2862
2993
|
return getAllModels().filter((m) => m.provider === provider);
|
|
2863
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
|
+
}
|
|
2864
3008
|
function getAuthStorageKeys(provider, modelId) {
|
|
2865
3009
|
const model = getAllModels().find((m) => m.id === modelId && m.provider === provider);
|
|
2866
3010
|
return model?.authStorageKeys ?? [provider];
|
|
@@ -2942,7 +3086,7 @@ var SUMMARY_COST_TIER = {
|
|
|
2942
3086
|
};
|
|
2943
3087
|
function getSummaryModel(provider, currentModelId) {
|
|
2944
3088
|
const tier = SUMMARY_COST_TIER[provider];
|
|
2945
|
-
const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier) : void 0;
|
|
3089
|
+
const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier && m.billing === void 0) : void 0;
|
|
2946
3090
|
return tagged ?? getModel(currentModelId) ?? getDefaultModel(provider);
|
|
2947
3091
|
}
|
|
2948
3092
|
|
|
@@ -3348,20 +3492,40 @@ var AUTH_PROVIDERS = [
|
|
|
3348
3492
|
{
|
|
3349
3493
|
value: "anthropic",
|
|
3350
3494
|
label: "Anthropic",
|
|
3351
|
-
description: "Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5",
|
|
3495
|
+
description: "Claude Fable 5.1, Opus 5.5, Opus 5.5 Fast, Sonnet 5.5, Haiku 5.5",
|
|
3352
3496
|
methods: ["oauth"]
|
|
3353
3497
|
},
|
|
3354
3498
|
{
|
|
3355
3499
|
value: "openai",
|
|
3356
3500
|
label: "OpenAI",
|
|
3357
|
-
description: "GPT-6 Astra, GPT-6.1 Sol, GPT-6 Luna",
|
|
3501
|
+
description: "GPT-6 Astra, GPT-6 Astra Fast, GPT-6.1 Sol, GPT-6.1 Sol Fast, GPT-6 Luna, GPT-6 Luna Fast",
|
|
3358
3502
|
methods: ["oauth"]
|
|
3359
3503
|
},
|
|
3360
3504
|
{
|
|
3361
3505
|
value: "gemini",
|
|
3362
3506
|
label: "Gemini",
|
|
3363
|
-
description: "Gemini 3.8 Flash, 3.5 Flash Lite, 3.
|
|
3364
|
-
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
|
+
}
|
|
3365
3529
|
},
|
|
3366
3530
|
{
|
|
3367
3531
|
value: "xai",
|
|
@@ -3491,6 +3655,9 @@ function describeAuthMethods(provider) {
|
|
|
3491
3655
|
});
|
|
3492
3656
|
}
|
|
3493
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
|
+
}
|
|
3494
3661
|
const dual = dualAuthProvider(provider);
|
|
3495
3662
|
if (!dual) return void 0;
|
|
3496
3663
|
return `Uses ${dual.oauthLabel} first; the ${dual.apiKeyLabel} takes over when it runs out, then switches back.`;
|
|
@@ -4237,6 +4404,8 @@ function createAutoUpdater(config) {
|
|
|
4237
4404
|
DEFAULT_LOCAL_ENDPOINTS,
|
|
4238
4405
|
DEFAULT_MAX_VIDEO_BYTES,
|
|
4239
4406
|
FALLBACK_CONTEXT_WINDOW,
|
|
4407
|
+
GEMINI_API_KEY,
|
|
4408
|
+
GEMINI_API_KEY_BASE_URL,
|
|
4240
4409
|
LOCAL_API_KEY_PLACEHOLDER,
|
|
4241
4410
|
LOCAL_AUTH_KEY_PREFIX,
|
|
4242
4411
|
MODELS,
|
|
@@ -4292,6 +4461,7 @@ function createAutoUpdater(config) {
|
|
|
4292
4461
|
isLocalModelId,
|
|
4293
4462
|
isLoggerOpen,
|
|
4294
4463
|
isModelLoaded,
|
|
4464
|
+
isPaidModel,
|
|
4295
4465
|
isThinkingLevelSupported,
|
|
4296
4466
|
kimiCodeBaseUrl,
|
|
4297
4467
|
kimiCodingHeaders,
|
|
@@ -4321,6 +4491,7 @@ function createAutoUpdater(config) {
|
|
|
4321
4491
|
toModelInfo,
|
|
4322
4492
|
transcribeVoice,
|
|
4323
4493
|
usesOpenAICodexTransport,
|
|
4324
|
-
withFileLock
|
|
4494
|
+
withFileLock,
|
|
4495
|
+
withoutPaidTier
|
|
4325
4496
|
});
|
|
4326
4497
|
//# sourceMappingURL=index.cjs.map
|