@prestyj/core 5.33.0 → 5.35.0
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-G3ZS4V2K.js → chunk-WSFHVWQ4.js} +202 -41
- package/dist/chunk-WSFHVWQ4.js.map +1 -0
- package/dist/index.cjs +325 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +120 -9
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +189 -40
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.d.cts +4 -3
- package/dist/model-registry.d.ts +4 -3
- package/dist/model-registry.js +1 -1
- package/dist/paths.d.cts +2 -1
- package/dist/paths.d.ts +2 -1
- package/package.json +2 -2
- package/dist/chunk-G3ZS4V2K.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -48,6 +48,8 @@ __export(index_exports, {
|
|
|
48
48
|
MODELS: () => MODELS,
|
|
49
49
|
MOONSHOT_OAUTH_KEY: () => MOONSHOT_OAUTH_KEY,
|
|
50
50
|
NotLoggedInError: () => NotLoggedInError,
|
|
51
|
+
OPENCODE_CATALOG_URLS: () => OPENCODE_CATALOG_URLS,
|
|
52
|
+
OPENCODE_PROVIDERS: () => OPENCODE_PROVIDERS,
|
|
51
53
|
OPENROUTER_DEFAULT_BASE_URL: () => OPENROUTER_DEFAULT_BASE_URL,
|
|
52
54
|
PLAN_MODE_THINKING_CAP: () => PLAN_MODE_THINKING_CAP,
|
|
53
55
|
SubscriptionUsageError: () => SubscriptionUsageError,
|
|
@@ -83,6 +85,7 @@ __export(index_exports, {
|
|
|
83
85
|
findProbedModel: () => findProbedModel,
|
|
84
86
|
formatClaudeCodeInstallProgress: () => formatClaudeCodeInstallProgress,
|
|
85
87
|
formatLocalModelId: () => formatLocalModelId,
|
|
88
|
+
formatOpenCodeModelId: () => formatOpenCodeModelId,
|
|
86
89
|
generatePKCE: () => generatePKCE,
|
|
87
90
|
getAllModels: () => getAllModels,
|
|
88
91
|
getAppPaths: () => getAppPaths,
|
|
@@ -135,8 +138,10 @@ __export(index_exports, {
|
|
|
135
138
|
ollamaServedContext: () => ollamaServedContext,
|
|
136
139
|
openLog: () => openLog,
|
|
137
140
|
parseLocalModelId: () => parseLocalModelId,
|
|
141
|
+
parseOpenCodeCatalog: () => parseOpenCodeCatalog,
|
|
138
142
|
parseOpenRouterCatalog: () => parseOpenRouterCatalog,
|
|
139
143
|
pendingClaudeCodeVersionRefresh: () => import_ai.pendingClaudeCodeVersionRefresh,
|
|
144
|
+
pointScale: () => pointScale,
|
|
140
145
|
probeEndpoint: () => probeEndpoint,
|
|
141
146
|
providerStorageKeys: () => providerStorageKeys,
|
|
142
147
|
readClaudeCodeUsage: () => readClaudeCodeUsage,
|
|
@@ -1418,6 +1423,7 @@ var import_node_path3 = __toESM(require("path"), 1);
|
|
|
1418
1423
|
var import_node_crypto5 = require("crypto");
|
|
1419
1424
|
var import_ai2 = require("@prestyj/ai");
|
|
1420
1425
|
var MAX_BYTES = 10 * 1024 * 1024;
|
|
1426
|
+
var ROTATED_GENERATIONS = 3;
|
|
1421
1427
|
var MIN_HEADROOM_BYTES = 64 * 1024;
|
|
1422
1428
|
var fd = null;
|
|
1423
1429
|
var logPath = null;
|
|
@@ -1434,6 +1440,17 @@ function rotateIfNeeded(filePath, force = false) {
|
|
|
1434
1440
|
const st = import_node_fs2.default.statSync(filePath);
|
|
1435
1441
|
if (!force && st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
|
|
1436
1442
|
const rotated = `${filePath}.1`;
|
|
1443
|
+
for (let generation = ROTATED_GENERATIONS - 1; generation >= 1; generation--) {
|
|
1444
|
+
const older = `${filePath}.${generation + 1}`;
|
|
1445
|
+
try {
|
|
1446
|
+
import_node_fs2.default.unlinkSync(older);
|
|
1447
|
+
} catch {
|
|
1448
|
+
}
|
|
1449
|
+
try {
|
|
1450
|
+
import_node_fs2.default.renameSync(`${filePath}.${generation}`, older);
|
|
1451
|
+
} catch {
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1437
1454
|
try {
|
|
1438
1455
|
import_node_fs2.default.unlinkSync(rotated);
|
|
1439
1456
|
} catch {
|
|
@@ -2947,18 +2964,13 @@ var MODELS = [
|
|
|
2947
2964
|
},
|
|
2948
2965
|
// ── OpenAI (Codex) ─────────────────────────────────────
|
|
2949
2966
|
{
|
|
2950
|
-
// GPT-6 Astra — "Our most capable model for
|
|
2951
|
-
// (Codex catalog priority 2,
|
|
2952
|
-
//
|
|
2953
|
-
//
|
|
2954
|
-
//
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
// Note: through a plain API key OpenAI requires the Responses API for tool
|
|
2958
|
-
// calling on Astra, so the Chat Completions path is text-only; the OAuth
|
|
2959
|
-
// Codex route is the supported way to use it as an agent.
|
|
2960
|
-
id: "gpt-6-astra",
|
|
2961
|
-
name: "GPT-6 Astra",
|
|
2967
|
+
// GPT-6.2 Astra — released 2026-11-17, "Our most capable model for your
|
|
2968
|
+
// hardest projects." (Codex catalog priority 2, default low, client >=
|
|
2969
|
+
// 0.166.0). $8/$40 MTok, cached input $0.40. 1.05M on the public Responses
|
|
2970
|
+
// API, 272K on the Codex route; 128K output, text+image input. Same ladder
|
|
2971
|
+
// and Ultra preset as GPT-6 Astra, which it retires; the API rejects reasoning effort `none`.
|
|
2972
|
+
id: "gpt-6.2-astra",
|
|
2973
|
+
name: "GPT-6.2 Astra",
|
|
2962
2974
|
provider: "openai",
|
|
2963
2975
|
contextWindow: 105e4,
|
|
2964
2976
|
codexContextWindow: 272e3,
|
|
@@ -2971,12 +2983,12 @@ var MODELS = [
|
|
|
2971
2983
|
maxThinkingLevel: "ultra"
|
|
2972
2984
|
},
|
|
2973
2985
|
{
|
|
2974
|
-
// Codex Fast mode for Astra (
|
|
2975
|
-
//
|
|
2976
|
-
//
|
|
2977
|
-
//
|
|
2978
|
-
id: "gpt-6-astra-fast",
|
|
2979
|
-
name: "GPT-6 Astra Fast",
|
|
2986
|
+
// Codex Fast mode for 6.2 Astra ("2x speed, increased usage"). @prestyj/ai's
|
|
2987
|
+
// `stream()` sends it as `gpt-6.2-astra` + `service_tier: "priority"`,
|
|
2988
|
+
// exactly what the Codex CLI sends. On a ChatGPT plan it draws included
|
|
2989
|
+
// limits at 2.5x the standard rate.
|
|
2990
|
+
id: "gpt-6.2-astra-fast",
|
|
2991
|
+
name: "GPT-6.2 Astra Fast",
|
|
2980
2992
|
provider: "openai",
|
|
2981
2993
|
contextWindow: 105e4,
|
|
2982
2994
|
codexContextWindow: 272e3,
|
|
@@ -2991,24 +3003,25 @@ var MODELS = [
|
|
|
2991
3003
|
},
|
|
2992
3004
|
// GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
|
|
2993
3005
|
// GPT-5.6 family (Sol/Terra/Luna; there was no GPT-6 Terra — OpenAI's Codex
|
|
2994
|
-
// catalog upgrades 5.6 Terra to 6 Sol). GPT-6.1 Sol (2026-09-29)
|
|
2995
|
-
// GPT-6 Sol,
|
|
2996
|
-
//
|
|
2997
|
-
//
|
|
2998
|
-
//
|
|
2999
|
-
//
|
|
3006
|
+
// catalog upgrades 5.6 Terra to 6 Sol). GPT-6.1 Sol (2026-09-29) replaced
|
|
3007
|
+
// GPT-6 Sol, GPT-6.1 Terra (2026-10-26) sits between Sol and Luna, and
|
|
3008
|
+
// GPT-6.2 Sol (2026-11-17) replaced GPT-6.1 Sol. 1.05M on the public
|
|
3009
|
+
// Responses API; 128K output, text+image input, freeform apply_patch,
|
|
3010
|
+
// responses-lite transport. The GPT-5.6 ids, `gpt-6-sol` and `gpt-6.1-sol`
|
|
3011
|
+
// are retired — a saved session on one falls back to the provider default
|
|
3012
|
+
// on next start.
|
|
3000
3013
|
{
|
|
3001
|
-
// GPT-6.
|
|
3002
|
-
// (Codex priority 1, default low
|
|
3003
|
-
//
|
|
3004
|
-
//
|
|
3014
|
+
// GPT-6.2 Sol — "Our go-to model for everyday work, from coding to
|
|
3015
|
+
// powering agents at scale." (Codex priority 1, default low, client >=
|
|
3016
|
+
// 0.166.0). $2/$10 MTok, cached input $0.10. Like Terra, the Codex route
|
|
3017
|
+
// gets a 500K window (catalog `context_window`). Ladder low →
|
|
3005
3018
|
// medium → high → xhigh → max → ultra; ultra is the Codex orchestration
|
|
3006
3019
|
// preset (xhigh effort on the wire + proactive local subagent delegation).
|
|
3007
|
-
id: "gpt-6.
|
|
3008
|
-
name: "GPT-6.
|
|
3020
|
+
id: "gpt-6.2-sol",
|
|
3021
|
+
name: "GPT-6.2 Sol",
|
|
3009
3022
|
provider: "openai",
|
|
3010
3023
|
contextWindow: 105e4,
|
|
3011
|
-
codexContextWindow:
|
|
3024
|
+
codexContextWindow: 5e5,
|
|
3012
3025
|
maxOutputTokens: 128e3,
|
|
3013
3026
|
supportsThinking: true,
|
|
3014
3027
|
defaultThinkingLevel: "low",
|
|
@@ -3018,13 +3031,13 @@ var MODELS = [
|
|
|
3018
3031
|
maxThinkingLevel: "ultra"
|
|
3019
3032
|
},
|
|
3020
3033
|
{
|
|
3021
|
-
// Codex Fast mode for 6.
|
|
3022
|
-
// `gpt-6-astra-fast` for the wire mapping and billing.
|
|
3023
|
-
id: "gpt-6.
|
|
3024
|
-
name: "GPT-6.
|
|
3034
|
+
// Codex Fast mode for 6.2 Sol ("2x speed, increased usage") — see
|
|
3035
|
+
// `gpt-6.2-astra-fast` for the wire mapping and billing.
|
|
3036
|
+
id: "gpt-6.2-sol-fast",
|
|
3037
|
+
name: "GPT-6.2 Sol Fast",
|
|
3025
3038
|
provider: "openai",
|
|
3026
3039
|
contextWindow: 105e4,
|
|
3027
|
-
codexContextWindow:
|
|
3040
|
+
codexContextWindow: 5e5,
|
|
3028
3041
|
maxOutputTokens: 128e3,
|
|
3029
3042
|
supportsThinking: true,
|
|
3030
3043
|
defaultThinkingLevel: "low",
|
|
@@ -3052,7 +3065,7 @@ var MODELS = [
|
|
|
3052
3065
|
maxThinkingLevel: "ultra"
|
|
3053
3066
|
},
|
|
3054
3067
|
{
|
|
3055
|
-
// Codex Fast mode for 6.1 Terra ("1.5x speed") — see `gpt-6-astra-fast`
|
|
3068
|
+
// Codex Fast mode for 6.1 Terra ("1.5x speed") — see `gpt-6.2-astra-fast`
|
|
3056
3069
|
// for the wire mapping and billing.
|
|
3057
3070
|
id: "gpt-6.1-terra-fast",
|
|
3058
3071
|
name: "GPT-6.1 Terra Fast",
|
|
@@ -3086,7 +3099,7 @@ var MODELS = [
|
|
|
3086
3099
|
maxThinkingLevel: "max"
|
|
3087
3100
|
},
|
|
3088
3101
|
{
|
|
3089
|
-
// Codex Fast mode for Luna ("1.5x speed") — see `gpt-6-astra-fast` for the
|
|
3102
|
+
// Codex Fast mode for Luna ("1.5x speed") — see `gpt-6.2-astra-fast` for the
|
|
3090
3103
|
// wire mapping and billing. Listed after Luna so compaction summaries
|
|
3091
3104
|
// (first `low` OpenAI model) stay on standard-speed Luna.
|
|
3092
3105
|
id: "gpt-6-luna-fast",
|
|
@@ -3189,7 +3202,56 @@ var MODELS = [
|
|
|
3189
3202
|
authStorageKeys: GEMINI_AUTH_KEYS
|
|
3190
3203
|
},
|
|
3191
3204
|
// Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
|
|
3192
|
-
// New GA models are opt-in; Code Assist access varies by account.
|
|
3205
|
+
// New GA models are opt-in; Code Assist access varies by account.
|
|
3206
|
+
// Gemini 4 (GA Nov 2026, ai.google.dev/gemini-api/docs/changelog): a unified 1M window and
|
|
3207
|
+
// 64K synchronous output. Hydrogen also takes an `xhigh` thinking level; the ladder here
|
|
3208
|
+
// stops at `high` like the other Gemini models.
|
|
3209
|
+
{
|
|
3210
|
+
// The fast everyday model, on the free tier too ($1.50 / $7.50 per 1M paid).
|
|
3211
|
+
id: "gemini-4-hydrogen",
|
|
3212
|
+
name: "Gemini 4 Hydrogen",
|
|
3213
|
+
provider: "gemini",
|
|
3214
|
+
contextWindow: 1048576,
|
|
3215
|
+
maxOutputTokens: 65536,
|
|
3216
|
+
supportsThinking: true,
|
|
3217
|
+
supportsImages: true,
|
|
3218
|
+
supportsVideo: true,
|
|
3219
|
+
maxVideoBytes: 20 * 1024 * 1024,
|
|
3220
|
+
costTier: "medium",
|
|
3221
|
+
maxThinkingLevel: "high",
|
|
3222
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
3223
|
+
},
|
|
3224
|
+
{
|
|
3225
|
+
// Paid tier only ($4 / $20 per 1M from Dec 1, 2026).
|
|
3226
|
+
id: "gemini-4-argon",
|
|
3227
|
+
name: "Gemini 4 Argon",
|
|
3228
|
+
provider: "gemini",
|
|
3229
|
+
contextWindow: 1048576,
|
|
3230
|
+
maxOutputTokens: 65536,
|
|
3231
|
+
supportsThinking: true,
|
|
3232
|
+
supportsImages: true,
|
|
3233
|
+
supportsVideo: true,
|
|
3234
|
+
maxVideoBytes: 20 * 1024 * 1024,
|
|
3235
|
+
costTier: "high",
|
|
3236
|
+
maxThinkingLevel: "high",
|
|
3237
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
3238
|
+
},
|
|
3239
|
+
{
|
|
3240
|
+
// The strongest Gemini 4 reasoning model; paid tier only.
|
|
3241
|
+
id: "gemini-4-carbon",
|
|
3242
|
+
name: "Gemini 4 Carbon",
|
|
3243
|
+
provider: "gemini",
|
|
3244
|
+
contextWindow: 1048576,
|
|
3245
|
+
maxOutputTokens: 65536,
|
|
3246
|
+
supportsThinking: true,
|
|
3247
|
+
supportsImages: true,
|
|
3248
|
+
supportsVideo: true,
|
|
3249
|
+
maxVideoBytes: 20 * 1024 * 1024,
|
|
3250
|
+
costTier: "high",
|
|
3251
|
+
maxThinkingLevel: "high",
|
|
3252
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
3253
|
+
},
|
|
3254
|
+
// Gemini 3.7
|
|
3193
3255
|
// Flash is retired: Google deprecated it on 2026-10-08 and routes every
|
|
3194
3256
|
// `gemini-3.7-flash` request to 3.8 Flash (ai.google.dev/gemini-api/docs/
|
|
3195
3257
|
// changelog), so a saved session on it falls back to the provider default.
|
|
@@ -3207,6 +3269,21 @@ var MODELS = [
|
|
|
3207
3269
|
maxThinkingLevel: "high",
|
|
3208
3270
|
authStorageKeys: GEMINI_AUTH_KEYS
|
|
3209
3271
|
},
|
|
3272
|
+
{
|
|
3273
|
+
// Replaced 3.5 Flash, which Google now routes here (changelog).
|
|
3274
|
+
id: "gemini-3.6-flash",
|
|
3275
|
+
name: "Gemini 3.6 Flash",
|
|
3276
|
+
provider: "gemini",
|
|
3277
|
+
contextWindow: 1048576,
|
|
3278
|
+
maxOutputTokens: 65536,
|
|
3279
|
+
supportsThinking: true,
|
|
3280
|
+
supportsImages: true,
|
|
3281
|
+
supportsVideo: true,
|
|
3282
|
+
maxVideoBytes: 20 * 1024 * 1024,
|
|
3283
|
+
costTier: "low",
|
|
3284
|
+
maxThinkingLevel: "high",
|
|
3285
|
+
authStorageKeys: GEMINI_AUTH_KEYS
|
|
3286
|
+
},
|
|
3210
3287
|
{
|
|
3211
3288
|
id: "gemini-3.5-flash-lite",
|
|
3212
3289
|
name: "Gemini 3.5 Flash Lite",
|
|
@@ -3534,6 +3611,93 @@ var MODELS = [
|
|
|
3534
3611
|
costTier: "medium",
|
|
3535
3612
|
maxThinkingLevel: "high"
|
|
3536
3613
|
},
|
|
3614
|
+
// ── OpenCode Console (Go subscription, then pay-as-you-go) ────────
|
|
3615
|
+
// One Console API key reaches many labs' models through opencode.ai. Ids
|
|
3616
|
+
// carry the plan prefix (`opencode-go/kimi-k3`) because the gateway reuses
|
|
3617
|
+
// the vendors' own ids; @prestyj/ai strips it at the wire. These rows are only the
|
|
3618
|
+
// offline fallback: the desktop app replaces them with each plan's live,
|
|
3619
|
+
// public model list (core/opencode-catalog-store.ts). Limits, image input
|
|
3620
|
+
// and effort ladders are from GET /inference[/go]/v1/models (2026-11-11);
|
|
3621
|
+
// all three speak Chat Completions natively.
|
|
3622
|
+
{
|
|
3623
|
+
// Go declares `max` as K3's only effort; pay-as-you-go adds low and high.
|
|
3624
|
+
id: "opencode-go/kimi-k3",
|
|
3625
|
+
name: "Kimi K3",
|
|
3626
|
+
provider: "opencode-go",
|
|
3627
|
+
contextWindow: 1048576,
|
|
3628
|
+
maxOutputTokens: 131072,
|
|
3629
|
+
supportsThinking: true,
|
|
3630
|
+
supportsImages: true,
|
|
3631
|
+
supportsVideo: false,
|
|
3632
|
+
costTier: "high",
|
|
3633
|
+
maxThinkingLevel: "max",
|
|
3634
|
+
thinkingLevels: ["max"]
|
|
3635
|
+
},
|
|
3636
|
+
{
|
|
3637
|
+
id: "opencode-go/glm-5.3",
|
|
3638
|
+
name: "GLM-5.3",
|
|
3639
|
+
provider: "opencode-go",
|
|
3640
|
+
contextWindow: 1e6,
|
|
3641
|
+
maxOutputTokens: 131072,
|
|
3642
|
+
supportsThinking: true,
|
|
3643
|
+
supportsImages: false,
|
|
3644
|
+
supportsVideo: false,
|
|
3645
|
+
costTier: "medium",
|
|
3646
|
+
maxThinkingLevel: "max",
|
|
3647
|
+
thinkingLevels: ["low", "high", "max"]
|
|
3648
|
+
},
|
|
3649
|
+
{
|
|
3650
|
+
id: "opencode-go/glm-5.3-flash",
|
|
3651
|
+
name: "GLM-5.3-Flash",
|
|
3652
|
+
provider: "opencode-go",
|
|
3653
|
+
contextWindow: 1e6,
|
|
3654
|
+
maxOutputTokens: 131072,
|
|
3655
|
+
supportsThinking: true,
|
|
3656
|
+
supportsImages: true,
|
|
3657
|
+
supportsVideo: false,
|
|
3658
|
+
costTier: "low",
|
|
3659
|
+
maxThinkingLevel: "max",
|
|
3660
|
+
thinkingLevels: ["low", "high", "max"]
|
|
3661
|
+
},
|
|
3662
|
+
{
|
|
3663
|
+
id: "opencode/kimi-k3",
|
|
3664
|
+
name: "Kimi K3",
|
|
3665
|
+
provider: "opencode",
|
|
3666
|
+
contextWindow: 1048576,
|
|
3667
|
+
maxOutputTokens: 131072,
|
|
3668
|
+
supportsThinking: true,
|
|
3669
|
+
supportsImages: true,
|
|
3670
|
+
supportsVideo: false,
|
|
3671
|
+
costTier: "high",
|
|
3672
|
+
maxThinkingLevel: "max",
|
|
3673
|
+
thinkingLevels: ["low", "high", "max"]
|
|
3674
|
+
},
|
|
3675
|
+
{
|
|
3676
|
+
id: "opencode/glm-5.3",
|
|
3677
|
+
name: "GLM-5.3",
|
|
3678
|
+
provider: "opencode",
|
|
3679
|
+
contextWindow: 1e6,
|
|
3680
|
+
maxOutputTokens: 131072,
|
|
3681
|
+
supportsThinking: true,
|
|
3682
|
+
supportsImages: false,
|
|
3683
|
+
supportsVideo: false,
|
|
3684
|
+
costTier: "medium",
|
|
3685
|
+
maxThinkingLevel: "max",
|
|
3686
|
+
thinkingLevels: ["low", "high", "max"]
|
|
3687
|
+
},
|
|
3688
|
+
{
|
|
3689
|
+
id: "opencode/glm-5.3-flash",
|
|
3690
|
+
name: "GLM-5.3-Flash",
|
|
3691
|
+
provider: "opencode",
|
|
3692
|
+
contextWindow: 1e6,
|
|
3693
|
+
maxOutputTokens: 131072,
|
|
3694
|
+
supportsThinking: true,
|
|
3695
|
+
supportsImages: true,
|
|
3696
|
+
supportsVideo: false,
|
|
3697
|
+
costTier: "low",
|
|
3698
|
+
maxThinkingLevel: "max",
|
|
3699
|
+
thinkingLevels: ["low", "high", "max"]
|
|
3700
|
+
},
|
|
3537
3701
|
// ── Hugging Face (Inference Providers router) ────────
|
|
3538
3702
|
// One HF token (hf.co/settings/tokens, "Make calls to Inference Providers"
|
|
3539
3703
|
// permission) routes to whichever hosted backend serves each open model;
|
|
@@ -3684,13 +3848,15 @@ function getVideoByteLimit(modelId) {
|
|
|
3684
3848
|
}
|
|
3685
3849
|
var DEFAULT_MODEL_IDS = {
|
|
3686
3850
|
xiaomi: "mimo-v2.6-pro",
|
|
3687
|
-
openai: "gpt-6.
|
|
3851
|
+
openai: "gpt-6.2-sol",
|
|
3688
3852
|
gemini: "gemini-3.1-flash-lite",
|
|
3689
3853
|
glm: "glm-5.3",
|
|
3690
3854
|
moonshot: "kimi-k3",
|
|
3691
3855
|
minimax: "MiniMax-M3.1-Flash",
|
|
3692
3856
|
deepseek: "deepseek-v4-pro",
|
|
3693
3857
|
huggingface: "moonshotai/Kimi-K2.7-Code",
|
|
3858
|
+
opencode: "opencode/kimi-k3",
|
|
3859
|
+
"opencode-go": "opencode-go/kimi-k3",
|
|
3694
3860
|
openrouter: "qwen/qwen3.8-max",
|
|
3695
3861
|
sakana: "fugu",
|
|
3696
3862
|
xai: "grok-4.7"
|
|
@@ -3807,6 +3973,70 @@ function parseOpenRouterCatalog(body) {
|
|
|
3807
3973
|
return { models, skipped };
|
|
3808
3974
|
}
|
|
3809
3975
|
|
|
3976
|
+
// src/opencode-catalog.ts
|
|
3977
|
+
var OPENCODE_PROVIDERS = ["opencode-go", "opencode"];
|
|
3978
|
+
var OPENCODE_CATALOG_URLS = {
|
|
3979
|
+
opencode: "https://opencode.ai/inference/v1/models",
|
|
3980
|
+
"opencode-go": "https://opencode.ai/inference/go/v1/models"
|
|
3981
|
+
};
|
|
3982
|
+
var EFFORT_LADDER2 = ["low", "medium", "high", "xhigh", "max"];
|
|
3983
|
+
function positiveInt2(value) {
|
|
3984
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
|
|
3985
|
+
}
|
|
3986
|
+
function strings2(value) {
|
|
3987
|
+
return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
|
|
3988
|
+
}
|
|
3989
|
+
function costTier2(price) {
|
|
3990
|
+
if (typeof price !== "number" || !Number.isFinite(price) || price < 0.5) return "low";
|
|
3991
|
+
return price < 3 ? "medium" : "high";
|
|
3992
|
+
}
|
|
3993
|
+
function formatOpenCodeModelId(provider, rawId) {
|
|
3994
|
+
return `${provider}/${rawId}`;
|
|
3995
|
+
}
|
|
3996
|
+
function parseOpenCodeCatalog(provider, body) {
|
|
3997
|
+
const data = body?.data;
|
|
3998
|
+
if (!Array.isArray(data)) return { models: [], skipped: 0 };
|
|
3999
|
+
const models = [];
|
|
4000
|
+
let skipped = 0;
|
|
4001
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4002
|
+
for (const raw of data) {
|
|
4003
|
+
const rawId = typeof raw?.id === "string" ? raw.id.trim() : "";
|
|
4004
|
+
const contextWindow = positiveInt2(raw?.limit?.context);
|
|
4005
|
+
const price = raw?.cost?.text?.input?.price;
|
|
4006
|
+
if (!/^[\w.:-]+$/.test(rawId) || seen.has(rawId) || raw.type !== "chat" || !raw.api?.["chat-completions"] || raw.capabilities?.tools?.supported !== true || !contextWindow || provider === "opencode" && price === 0) {
|
|
4007
|
+
skipped++;
|
|
4008
|
+
continue;
|
|
4009
|
+
}
|
|
4010
|
+
seen.add(rawId);
|
|
4011
|
+
const reasoning = raw.capabilities.reasoning;
|
|
4012
|
+
const efforts = strings2(reasoning?.effort);
|
|
4013
|
+
const ladder = EFFORT_LADDER2.filter((rung) => efforts.includes(rung));
|
|
4014
|
+
const defaultEffort = reasoning?.default?.type === "effort" ? reasoning.default.value : null;
|
|
4015
|
+
const maxOutput = Math.min(
|
|
4016
|
+
positiveInt2(raw.limit?.output) ?? 16384,
|
|
4017
|
+
Math.floor(contextWindow / 2)
|
|
4018
|
+
);
|
|
4019
|
+
models.push({
|
|
4020
|
+
id: formatOpenCodeModelId(provider, rawId),
|
|
4021
|
+
name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim() : rawId,
|
|
4022
|
+
provider,
|
|
4023
|
+
contextWindow,
|
|
4024
|
+
maxOutputTokens: Math.max(1, maxOutput),
|
|
4025
|
+
// Only a declared effort ladder counts: a model without one is never sent
|
|
4026
|
+
// a reasoning_effort it might reject.
|
|
4027
|
+
supportsThinking: ladder.length > 0,
|
|
4028
|
+
supportsImages: strings2(raw.modalities?.input).some((m) => m.startsWith("image")),
|
|
4029
|
+
// Video needs a per-transport payload cap the catalog doesn't publish.
|
|
4030
|
+
supportsVideo: false,
|
|
4031
|
+
costTier: costTier2(price),
|
|
4032
|
+
maxThinkingLevel: ladder[ladder.length - 1] ?? "low",
|
|
4033
|
+
...ladder.length > 0 ? { thinkingLevels: ladder } : {},
|
|
4034
|
+
...typeof defaultEffort === "string" && ladder.includes(defaultEffort) ? { defaultThinkingLevel: defaultEffort } : {}
|
|
4035
|
+
});
|
|
4036
|
+
}
|
|
4037
|
+
return { models, skipped };
|
|
4038
|
+
}
|
|
4039
|
+
|
|
3810
4040
|
// src/thinking-level.ts
|
|
3811
4041
|
var OPENAI_GPT_THINKING_LEVELS = ["medium", "high", "xhigh"];
|
|
3812
4042
|
var OPENAI_GPT_56_THINKING_LEVELS = [
|
|
@@ -4033,7 +4263,12 @@ async function probeEndpoint(endpoint, { timeoutMs = DEFAULT_PROBE_TIMEOUT_MS, s
|
|
|
4033
4263
|
);
|
|
4034
4264
|
const enriched = await enrich(endpoint, entries, { timeoutMs, signal });
|
|
4035
4265
|
const pinned = contextLength(endpoint.contextLength);
|
|
4036
|
-
const
|
|
4266
|
+
const images = typeof endpoint.supportsImages === "boolean" ? endpoint.supportsImages : void 0;
|
|
4267
|
+
const models = enriched.map((m) => ({
|
|
4268
|
+
...m,
|
|
4269
|
+
...pinned === void 0 ? {} : { contextWindow: pinned, contextWindowKnown: true },
|
|
4270
|
+
...images === void 0 ? {} : { supportsImages: images }
|
|
4271
|
+
}));
|
|
4037
4272
|
log("INFO", "local-models", `Probed ${endpoint.label}`, {
|
|
4038
4273
|
baseUrl: endpoint.baseUrl,
|
|
4039
4274
|
models: String(models.length)
|
|
@@ -4053,7 +4288,7 @@ async function enrichCustom(endpoint, entries, options) {
|
|
|
4053
4288
|
const root = endpointRoot(endpoint.baseUrl);
|
|
4054
4289
|
const props = await fetchJson(`${root}/props`, endpoint, options);
|
|
4055
4290
|
const nCtx = contextLength(props?.default_generation_settings?.n_ctx);
|
|
4056
|
-
if (nCtx !== void 0) return llamaCppModels(endpoint, entries, nCtx);
|
|
4291
|
+
if (nCtx !== void 0) return llamaCppModels(endpoint, entries, nCtx, props);
|
|
4057
4292
|
const lmStudio = await fetchJson(`${root}/api/v1/models`, endpoint, options);
|
|
4058
4293
|
if (Array.isArray(lmStudio?.models)) return enrichLmStudio(endpoint, entries, options, lmStudio);
|
|
4059
4294
|
return generic;
|
|
@@ -4196,14 +4431,16 @@ async function enrichLlamaCpp(endpoint, entries, options) {
|
|
|
4196
4431
|
return llamaCppModels(
|
|
4197
4432
|
endpoint,
|
|
4198
4433
|
entries,
|
|
4199
|
-
contextLength(props?.default_generation_settings?.n_ctx)
|
|
4434
|
+
contextLength(props?.default_generation_settings?.n_ctx),
|
|
4435
|
+
props
|
|
4200
4436
|
);
|
|
4201
4437
|
}
|
|
4202
|
-
function llamaCppModels(endpoint, entries, nCtx) {
|
|
4438
|
+
function llamaCppModels(endpoint, entries, nCtx, props) {
|
|
4203
4439
|
return entries.map((entry) => ({
|
|
4204
4440
|
...genericModel(endpoint, entry),
|
|
4205
4441
|
contextWindow: nCtx ?? FALLBACK_CONTEXT_WINDOW,
|
|
4206
|
-
contextWindowKnown: nCtx !== void 0
|
|
4442
|
+
contextWindowKnown: nCtx !== void 0,
|
|
4443
|
+
supportsImages: props?.modalities?.vision === true
|
|
4207
4444
|
}));
|
|
4208
4445
|
}
|
|
4209
4446
|
async function mapLimited(items, limit, fn) {
|
|
@@ -4239,7 +4476,7 @@ function toModelInfo(model, endpoint) {
|
|
|
4239
4476
|
}
|
|
4240
4477
|
var cache;
|
|
4241
4478
|
function cacheKey(endpoints) {
|
|
4242
|
-
return endpoints.map((e) => `${e.id}@${e.baseUrl}#${e.contextLength ?? ""}`).join("|");
|
|
4479
|
+
return endpoints.map((e) => `${e.id}@${e.baseUrl}#${e.contextLength ?? ""}#${e.supportsImages ?? ""}`).join("|");
|
|
4243
4480
|
}
|
|
4244
4481
|
async function discoverLocalModels(endpoints = DEFAULT_LOCAL_ENDPOINTS, options = {}) {
|
|
4245
4482
|
const key = cacheKey(endpoints);
|
|
@@ -4268,6 +4505,12 @@ function findProbedModel(probes, modelId) {
|
|
|
4268
4505
|
return void 0;
|
|
4269
4506
|
}
|
|
4270
4507
|
|
|
4508
|
+
// src/point-scale.ts
|
|
4509
|
+
var NORM1000_PATTERN = /qwen3[-_.]?vl|qwen3[._]?[56](?![\d])/i;
|
|
4510
|
+
function pointScale(modelId) {
|
|
4511
|
+
return NORM1000_PATTERN.test(modelId) ? "norm1000" : "pixels";
|
|
4512
|
+
}
|
|
4513
|
+
|
|
4271
4514
|
// src/claude-code/usage.ts
|
|
4272
4515
|
var import_promises6 = __toESM(require("fs/promises"), 1);
|
|
4273
4516
|
var import_node_path5 = __toESM(require("path"), 1);
|
|
@@ -4373,6 +4616,9 @@ async function signOutOfClaudeCode(auth, opts = {}) {
|
|
|
4373
4616
|
}
|
|
4374
4617
|
|
|
4375
4618
|
// src/auth-providers.ts
|
|
4619
|
+
function apiKeyDetails(label, billing, when = "") {
|
|
4620
|
+
return { apikey: { method: "apikey", label, billing, when } };
|
|
4621
|
+
}
|
|
4376
4622
|
var ALL_AUTH_PROVIDERS = [
|
|
4377
4623
|
{
|
|
4378
4624
|
value: "anthropic",
|
|
@@ -4383,13 +4629,13 @@ var ALL_AUTH_PROVIDERS = [
|
|
|
4383
4629
|
{
|
|
4384
4630
|
value: "openai",
|
|
4385
4631
|
label: "OpenAI",
|
|
4386
|
-
description: "GPT-6 Astra, GPT-6 Astra Fast, GPT-6.
|
|
4632
|
+
description: "GPT-6.2 Astra, GPT-6.2 Astra Fast, GPT-6.2 Sol, GPT-6.2 Sol Fast, GPT-6.1 Terra, GPT-6.1 Terra Fast, GPT-6 Luna, GPT-6 Luna Fast",
|
|
4387
4633
|
methods: ["oauth"]
|
|
4388
4634
|
},
|
|
4389
4635
|
{
|
|
4390
4636
|
value: "gemini",
|
|
4391
4637
|
label: "Gemini",
|
|
4392
|
-
description: "Gemini 3.8 Flash, 3.5 Flash Lite, 3.1 Flash Lite, 3.5 Flash, 3.1 Pro (Preview)",
|
|
4638
|
+
description: "Gemini 4 Hydrogen, 4 Argon, 4 Carbon, 3.8 Flash, 3.6 Flash, 3.5 Flash Lite, 3.1 Flash Lite, 3.5 Flash, 3.1 Pro (Preview)",
|
|
4393
4639
|
methods: ["oauth", "apikey"],
|
|
4394
4640
|
apiKeyLabel: "Gemini",
|
|
4395
4641
|
apiKeyBaseUrl: GEMINI_API_KEY_BASE_URL,
|
|
@@ -4502,6 +4748,30 @@ var ALL_AUTH_PROVIDERS = [
|
|
|
4502
4748
|
methods: ["apikey"],
|
|
4503
4749
|
apiKeyLabel: "Sakana"
|
|
4504
4750
|
},
|
|
4751
|
+
{
|
|
4752
|
+
value: "opencode-go",
|
|
4753
|
+
label: "OpenCode Go",
|
|
4754
|
+
description: "Kimi K3, GLM-5.3, GLM-5.3-Flash and more Go models",
|
|
4755
|
+
methods: ["apikey"],
|
|
4756
|
+
apiKeyLabel: "OpenCode",
|
|
4757
|
+
methodDetails: apiKeyDetails(
|
|
4758
|
+
"OpenCode API key",
|
|
4759
|
+
"Uses your OpenCode Go subscription.",
|
|
4760
|
+
"Create a personal API key in the OpenCode Console, in a workspace subscribed to Go."
|
|
4761
|
+
)
|
|
4762
|
+
},
|
|
4763
|
+
{
|
|
4764
|
+
value: "opencode",
|
|
4765
|
+
label: "OpenCode",
|
|
4766
|
+
description: "Kimi K3, GLM-5.3, GLM-5.3-Flash and more paid Console models",
|
|
4767
|
+
methods: ["apikey"],
|
|
4768
|
+
apiKeyLabel: "OpenCode",
|
|
4769
|
+
methodDetails: apiKeyDetails(
|
|
4770
|
+
"OpenCode API key",
|
|
4771
|
+
"Pay-per-token from your OpenCode Console credits.",
|
|
4772
|
+
"Free-tier models only run inside OpenCode, so they are not listed here."
|
|
4773
|
+
)
|
|
4774
|
+
},
|
|
4505
4775
|
{
|
|
4506
4776
|
value: "openrouter",
|
|
4507
4777
|
label: "OpenRouter",
|
|
@@ -4559,6 +4829,8 @@ var SubscriptionUsageError = class extends Error {
|
|
|
4559
4829
|
this.retryAfterMs = retryAfterMs2;
|
|
4560
4830
|
this.name = "SubscriptionUsageError";
|
|
4561
4831
|
}
|
|
4832
|
+
status;
|
|
4833
|
+
retryAfterMs;
|
|
4562
4834
|
};
|
|
4563
4835
|
var ANTHROPIC_USAGE_URL = "https://api.anthropic.com/api/oauth/usage";
|
|
4564
4836
|
var CODEX_USAGE_URL = "https://chatgpt.com/backend-api/wham/usage";
|
|
@@ -5305,6 +5577,8 @@ function createAutoUpdater(config) {
|
|
|
5305
5577
|
MODELS,
|
|
5306
5578
|
MOONSHOT_OAUTH_KEY,
|
|
5307
5579
|
NotLoggedInError,
|
|
5580
|
+
OPENCODE_CATALOG_URLS,
|
|
5581
|
+
OPENCODE_PROVIDERS,
|
|
5308
5582
|
OPENROUTER_DEFAULT_BASE_URL,
|
|
5309
5583
|
PLAN_MODE_THINKING_CAP,
|
|
5310
5584
|
SubscriptionUsageError,
|
|
@@ -5340,6 +5614,7 @@ function createAutoUpdater(config) {
|
|
|
5340
5614
|
findProbedModel,
|
|
5341
5615
|
formatClaudeCodeInstallProgress,
|
|
5342
5616
|
formatLocalModelId,
|
|
5617
|
+
formatOpenCodeModelId,
|
|
5343
5618
|
generatePKCE,
|
|
5344
5619
|
getAllModels,
|
|
5345
5620
|
getAppPaths,
|
|
@@ -5392,8 +5667,10 @@ function createAutoUpdater(config) {
|
|
|
5392
5667
|
ollamaServedContext,
|
|
5393
5668
|
openLog,
|
|
5394
5669
|
parseLocalModelId,
|
|
5670
|
+
parseOpenCodeCatalog,
|
|
5395
5671
|
parseOpenRouterCatalog,
|
|
5396
5672
|
pendingClaudeCodeVersionRefresh,
|
|
5673
|
+
pointScale,
|
|
5397
5674
|
probeEndpoint,
|
|
5398
5675
|
providerStorageKeys,
|
|
5399
5676
|
readClaudeCodeUsage,
|