@prestyj/core 5.33.0 → 5.34.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/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 complex, demanding work."
2951
- // (Codex catalog priority 2, listed for every ChatGPT plan, requires a
2952
- // Codex client >= 0.153.0 — see CODEX_CLIENT_VERSION). Same split as 5.6:
2953
- // 1.05M on the public Responses API, 272K on the ChatGPT OAuth route
2954
- // (openai/codex models.json, `gpt-6-astra`). Reasoning ladder low → medium
2955
- // → high → xhigh → max → ultra; `ultra` is the Codex orchestration preset
2956
- // (multi_agent v2) and is Codex-only — the public API tops out at `max`.
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 (catalog `service_tiers: priority`, "2x speed,
2975
- // increased usage"). @prestyj/ai's `stream()` sends it as `gpt-6-astra` +
2976
- // `service_tier: "priority"`, exactly what the Codex CLI sends. On a
2977
- // ChatGPT plan it draws included limits at 2.5x the standard rate.
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) then replaced
2995
- // GPT-6 Sol, and GPT-6.1 Terra (2026-10-26) sits between Sol and Luna. Same window split as Astra: 1.05M on the public Responses API,
2996
- // 272K on the Codex route; 128K output, text+image input, freeform
2997
- // apply_patch, responses-lite transport. The GPT-5.6 ids and `gpt-6-sol` are
2998
- // retired — a saved session on one falls back to the provider default on
2999
- // next start.
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.1 Sol — "Latest workhorse model for coding and everyday work."
3002
- // (Codex priority 1, default low). The catalog says Codex client >= 0.153.0,
3003
- // but the ChatGPT backend only serves it from 0.159.0 (see
3004
- // CODEX_CLIENT_VERSION). $2/$10 MTok, cached input $0.10. Ladder low →
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.1-sol",
3008
- name: "GPT-6.1 Sol",
3020
+ id: "gpt-6.2-sol",
3021
+ name: "GPT-6.2 Sol",
3009
3022
  provider: "openai",
3010
3023
  contextWindow: 105e4,
3011
- codexContextWindow: 272e3,
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.1 Sol ("2x speed, increased usage") — see
3022
- // `gpt-6-astra-fast` for the wire mapping and billing.
3023
- id: "gpt-6.1-sol-fast",
3024
- name: "GPT-6.1 Sol Fast",
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: 272e3,
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",
@@ -3534,6 +3547,93 @@ var MODELS = [
3534
3547
  costTier: "medium",
3535
3548
  maxThinkingLevel: "high"
3536
3549
  },
3550
+ // ── OpenCode Console (Go subscription, then pay-as-you-go) ────────
3551
+ // One Console API key reaches many labs' models through opencode.ai. Ids
3552
+ // carry the plan prefix (`opencode-go/kimi-k3`) because the gateway reuses
3553
+ // the vendors' own ids; @prestyj/ai strips it at the wire. These rows are only the
3554
+ // offline fallback: the desktop app replaces them with each plan's live,
3555
+ // public model list (core/opencode-catalog-store.ts). Limits, image input
3556
+ // and effort ladders are from GET /inference[/go]/v1/models (2026-11-11);
3557
+ // all three speak Chat Completions natively.
3558
+ {
3559
+ // Go declares `max` as K3's only effort; pay-as-you-go adds low and high.
3560
+ id: "opencode-go/kimi-k3",
3561
+ name: "Kimi K3",
3562
+ provider: "opencode-go",
3563
+ contextWindow: 1048576,
3564
+ maxOutputTokens: 131072,
3565
+ supportsThinking: true,
3566
+ supportsImages: true,
3567
+ supportsVideo: false,
3568
+ costTier: "high",
3569
+ maxThinkingLevel: "max",
3570
+ thinkingLevels: ["max"]
3571
+ },
3572
+ {
3573
+ id: "opencode-go/glm-5.3",
3574
+ name: "GLM-5.3",
3575
+ provider: "opencode-go",
3576
+ contextWindow: 1e6,
3577
+ maxOutputTokens: 131072,
3578
+ supportsThinking: true,
3579
+ supportsImages: false,
3580
+ supportsVideo: false,
3581
+ costTier: "medium",
3582
+ maxThinkingLevel: "max",
3583
+ thinkingLevels: ["low", "high", "max"]
3584
+ },
3585
+ {
3586
+ id: "opencode-go/glm-5.3-flash",
3587
+ name: "GLM-5.3-Flash",
3588
+ provider: "opencode-go",
3589
+ contextWindow: 1e6,
3590
+ maxOutputTokens: 131072,
3591
+ supportsThinking: true,
3592
+ supportsImages: true,
3593
+ supportsVideo: false,
3594
+ costTier: "low",
3595
+ maxThinkingLevel: "max",
3596
+ thinkingLevels: ["low", "high", "max"]
3597
+ },
3598
+ {
3599
+ id: "opencode/kimi-k3",
3600
+ name: "Kimi K3",
3601
+ provider: "opencode",
3602
+ contextWindow: 1048576,
3603
+ maxOutputTokens: 131072,
3604
+ supportsThinking: true,
3605
+ supportsImages: true,
3606
+ supportsVideo: false,
3607
+ costTier: "high",
3608
+ maxThinkingLevel: "max",
3609
+ thinkingLevels: ["low", "high", "max"]
3610
+ },
3611
+ {
3612
+ id: "opencode/glm-5.3",
3613
+ name: "GLM-5.3",
3614
+ provider: "opencode",
3615
+ contextWindow: 1e6,
3616
+ maxOutputTokens: 131072,
3617
+ supportsThinking: true,
3618
+ supportsImages: false,
3619
+ supportsVideo: false,
3620
+ costTier: "medium",
3621
+ maxThinkingLevel: "max",
3622
+ thinkingLevels: ["low", "high", "max"]
3623
+ },
3624
+ {
3625
+ id: "opencode/glm-5.3-flash",
3626
+ name: "GLM-5.3-Flash",
3627
+ provider: "opencode",
3628
+ contextWindow: 1e6,
3629
+ maxOutputTokens: 131072,
3630
+ supportsThinking: true,
3631
+ supportsImages: true,
3632
+ supportsVideo: false,
3633
+ costTier: "low",
3634
+ maxThinkingLevel: "max",
3635
+ thinkingLevels: ["low", "high", "max"]
3636
+ },
3537
3637
  // ── Hugging Face (Inference Providers router) ────────
3538
3638
  // One HF token (hf.co/settings/tokens, "Make calls to Inference Providers"
3539
3639
  // permission) routes to whichever hosted backend serves each open model;
@@ -3684,13 +3784,15 @@ function getVideoByteLimit(modelId) {
3684
3784
  }
3685
3785
  var DEFAULT_MODEL_IDS = {
3686
3786
  xiaomi: "mimo-v2.6-pro",
3687
- openai: "gpt-6.1-sol",
3787
+ openai: "gpt-6.2-sol",
3688
3788
  gemini: "gemini-3.1-flash-lite",
3689
3789
  glm: "glm-5.3",
3690
3790
  moonshot: "kimi-k3",
3691
3791
  minimax: "MiniMax-M3.1-Flash",
3692
3792
  deepseek: "deepseek-v4-pro",
3693
3793
  huggingface: "moonshotai/Kimi-K2.7-Code",
3794
+ opencode: "opencode/kimi-k3",
3795
+ "opencode-go": "opencode-go/kimi-k3",
3694
3796
  openrouter: "qwen/qwen3.8-max",
3695
3797
  sakana: "fugu",
3696
3798
  xai: "grok-4.7"
@@ -3807,6 +3909,70 @@ function parseOpenRouterCatalog(body) {
3807
3909
  return { models, skipped };
3808
3910
  }
3809
3911
 
3912
+ // src/opencode-catalog.ts
3913
+ var OPENCODE_PROVIDERS = ["opencode-go", "opencode"];
3914
+ var OPENCODE_CATALOG_URLS = {
3915
+ opencode: "https://opencode.ai/inference/v1/models",
3916
+ "opencode-go": "https://opencode.ai/inference/go/v1/models"
3917
+ };
3918
+ var EFFORT_LADDER2 = ["low", "medium", "high", "xhigh", "max"];
3919
+ function positiveInt2(value) {
3920
+ return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
3921
+ }
3922
+ function strings2(value) {
3923
+ return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
3924
+ }
3925
+ function costTier2(price) {
3926
+ if (typeof price !== "number" || !Number.isFinite(price) || price < 0.5) return "low";
3927
+ return price < 3 ? "medium" : "high";
3928
+ }
3929
+ function formatOpenCodeModelId(provider, rawId) {
3930
+ return `${provider}/${rawId}`;
3931
+ }
3932
+ function parseOpenCodeCatalog(provider, body) {
3933
+ const data = body?.data;
3934
+ if (!Array.isArray(data)) return { models: [], skipped: 0 };
3935
+ const models = [];
3936
+ let skipped = 0;
3937
+ const seen = /* @__PURE__ */ new Set();
3938
+ for (const raw of data) {
3939
+ const rawId = typeof raw?.id === "string" ? raw.id.trim() : "";
3940
+ const contextWindow = positiveInt2(raw?.limit?.context);
3941
+ const price = raw?.cost?.text?.input?.price;
3942
+ if (!/^[\w.:-]+$/.test(rawId) || seen.has(rawId) || raw.type !== "chat" || !raw.api?.["chat-completions"] || raw.capabilities?.tools?.supported !== true || !contextWindow || provider === "opencode" && price === 0) {
3943
+ skipped++;
3944
+ continue;
3945
+ }
3946
+ seen.add(rawId);
3947
+ const reasoning = raw.capabilities.reasoning;
3948
+ const efforts = strings2(reasoning?.effort);
3949
+ const ladder = EFFORT_LADDER2.filter((rung) => efforts.includes(rung));
3950
+ const defaultEffort = reasoning?.default?.type === "effort" ? reasoning.default.value : null;
3951
+ const maxOutput = Math.min(
3952
+ positiveInt2(raw.limit?.output) ?? 16384,
3953
+ Math.floor(contextWindow / 2)
3954
+ );
3955
+ models.push({
3956
+ id: formatOpenCodeModelId(provider, rawId),
3957
+ name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim() : rawId,
3958
+ provider,
3959
+ contextWindow,
3960
+ maxOutputTokens: Math.max(1, maxOutput),
3961
+ // Only a declared effort ladder counts: a model without one is never sent
3962
+ // a reasoning_effort it might reject.
3963
+ supportsThinking: ladder.length > 0,
3964
+ supportsImages: strings2(raw.modalities?.input).some((m) => m.startsWith("image")),
3965
+ // Video needs a per-transport payload cap the catalog doesn't publish.
3966
+ supportsVideo: false,
3967
+ costTier: costTier2(price),
3968
+ maxThinkingLevel: ladder[ladder.length - 1] ?? "low",
3969
+ ...ladder.length > 0 ? { thinkingLevels: ladder } : {},
3970
+ ...typeof defaultEffort === "string" && ladder.includes(defaultEffort) ? { defaultThinkingLevel: defaultEffort } : {}
3971
+ });
3972
+ }
3973
+ return { models, skipped };
3974
+ }
3975
+
3810
3976
  // src/thinking-level.ts
3811
3977
  var OPENAI_GPT_THINKING_LEVELS = ["medium", "high", "xhigh"];
3812
3978
  var OPENAI_GPT_56_THINKING_LEVELS = [
@@ -4033,7 +4199,12 @@ async function probeEndpoint(endpoint, { timeoutMs = DEFAULT_PROBE_TIMEOUT_MS, s
4033
4199
  );
4034
4200
  const enriched = await enrich(endpoint, entries, { timeoutMs, signal });
4035
4201
  const pinned = contextLength(endpoint.contextLength);
4036
- const models = pinned === void 0 ? enriched : enriched.map((m) => ({ ...m, contextWindow: pinned, contextWindowKnown: true }));
4202
+ const images = typeof endpoint.supportsImages === "boolean" ? endpoint.supportsImages : void 0;
4203
+ const models = enriched.map((m) => ({
4204
+ ...m,
4205
+ ...pinned === void 0 ? {} : { contextWindow: pinned, contextWindowKnown: true },
4206
+ ...images === void 0 ? {} : { supportsImages: images }
4207
+ }));
4037
4208
  log("INFO", "local-models", `Probed ${endpoint.label}`, {
4038
4209
  baseUrl: endpoint.baseUrl,
4039
4210
  models: String(models.length)
@@ -4053,7 +4224,7 @@ async function enrichCustom(endpoint, entries, options) {
4053
4224
  const root = endpointRoot(endpoint.baseUrl);
4054
4225
  const props = await fetchJson(`${root}/props`, endpoint, options);
4055
4226
  const nCtx = contextLength(props?.default_generation_settings?.n_ctx);
4056
- if (nCtx !== void 0) return llamaCppModels(endpoint, entries, nCtx);
4227
+ if (nCtx !== void 0) return llamaCppModels(endpoint, entries, nCtx, props);
4057
4228
  const lmStudio = await fetchJson(`${root}/api/v1/models`, endpoint, options);
4058
4229
  if (Array.isArray(lmStudio?.models)) return enrichLmStudio(endpoint, entries, options, lmStudio);
4059
4230
  return generic;
@@ -4196,14 +4367,16 @@ async function enrichLlamaCpp(endpoint, entries, options) {
4196
4367
  return llamaCppModels(
4197
4368
  endpoint,
4198
4369
  entries,
4199
- contextLength(props?.default_generation_settings?.n_ctx)
4370
+ contextLength(props?.default_generation_settings?.n_ctx),
4371
+ props
4200
4372
  );
4201
4373
  }
4202
- function llamaCppModels(endpoint, entries, nCtx) {
4374
+ function llamaCppModels(endpoint, entries, nCtx, props) {
4203
4375
  return entries.map((entry) => ({
4204
4376
  ...genericModel(endpoint, entry),
4205
4377
  contextWindow: nCtx ?? FALLBACK_CONTEXT_WINDOW,
4206
- contextWindowKnown: nCtx !== void 0
4378
+ contextWindowKnown: nCtx !== void 0,
4379
+ supportsImages: props?.modalities?.vision === true
4207
4380
  }));
4208
4381
  }
4209
4382
  async function mapLimited(items, limit, fn) {
@@ -4239,7 +4412,7 @@ function toModelInfo(model, endpoint) {
4239
4412
  }
4240
4413
  var cache;
4241
4414
  function cacheKey(endpoints) {
4242
- return endpoints.map((e) => `${e.id}@${e.baseUrl}#${e.contextLength ?? ""}`).join("|");
4415
+ return endpoints.map((e) => `${e.id}@${e.baseUrl}#${e.contextLength ?? ""}#${e.supportsImages ?? ""}`).join("|");
4243
4416
  }
4244
4417
  async function discoverLocalModels(endpoints = DEFAULT_LOCAL_ENDPOINTS, options = {}) {
4245
4418
  const key = cacheKey(endpoints);
@@ -4268,6 +4441,12 @@ function findProbedModel(probes, modelId) {
4268
4441
  return void 0;
4269
4442
  }
4270
4443
 
4444
+ // src/point-scale.ts
4445
+ var NORM1000_PATTERN = /qwen3[-_.]?vl|qwen3[._]?[56](?![\d])/i;
4446
+ function pointScale(modelId) {
4447
+ return NORM1000_PATTERN.test(modelId) ? "norm1000" : "pixels";
4448
+ }
4449
+
4271
4450
  // src/claude-code/usage.ts
4272
4451
  var import_promises6 = __toESM(require("fs/promises"), 1);
4273
4452
  var import_node_path5 = __toESM(require("path"), 1);
@@ -4373,6 +4552,9 @@ async function signOutOfClaudeCode(auth, opts = {}) {
4373
4552
  }
4374
4553
 
4375
4554
  // src/auth-providers.ts
4555
+ function apiKeyDetails(label, billing, when = "") {
4556
+ return { apikey: { method: "apikey", label, billing, when } };
4557
+ }
4376
4558
  var ALL_AUTH_PROVIDERS = [
4377
4559
  {
4378
4560
  value: "anthropic",
@@ -4383,7 +4565,7 @@ var ALL_AUTH_PROVIDERS = [
4383
4565
  {
4384
4566
  value: "openai",
4385
4567
  label: "OpenAI",
4386
- description: "GPT-6 Astra, GPT-6 Astra Fast, GPT-6.1 Sol, GPT-6.1 Sol Fast, GPT-6.1 Terra, GPT-6.1 Terra Fast, GPT-6 Luna, GPT-6 Luna Fast",
4568
+ 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
4569
  methods: ["oauth"]
4388
4570
  },
4389
4571
  {
@@ -4502,6 +4684,30 @@ var ALL_AUTH_PROVIDERS = [
4502
4684
  methods: ["apikey"],
4503
4685
  apiKeyLabel: "Sakana"
4504
4686
  },
4687
+ {
4688
+ value: "opencode-go",
4689
+ label: "OpenCode Go",
4690
+ description: "Kimi K3, GLM-5.3, GLM-5.3-Flash and more Go models",
4691
+ methods: ["apikey"],
4692
+ apiKeyLabel: "OpenCode",
4693
+ methodDetails: apiKeyDetails(
4694
+ "OpenCode API key",
4695
+ "Uses your OpenCode Go subscription.",
4696
+ "Create a personal API key in the OpenCode Console, in a workspace subscribed to Go."
4697
+ )
4698
+ },
4699
+ {
4700
+ value: "opencode",
4701
+ label: "OpenCode",
4702
+ description: "Kimi K3, GLM-5.3, GLM-5.3-Flash and more paid Console models",
4703
+ methods: ["apikey"],
4704
+ apiKeyLabel: "OpenCode",
4705
+ methodDetails: apiKeyDetails(
4706
+ "OpenCode API key",
4707
+ "Pay-per-token from your OpenCode Console credits.",
4708
+ "Free-tier models only run inside OpenCode, so they are not listed here."
4709
+ )
4710
+ },
4505
4711
  {
4506
4712
  value: "openrouter",
4507
4713
  label: "OpenRouter",
@@ -5305,6 +5511,8 @@ function createAutoUpdater(config) {
5305
5511
  MODELS,
5306
5512
  MOONSHOT_OAUTH_KEY,
5307
5513
  NotLoggedInError,
5514
+ OPENCODE_CATALOG_URLS,
5515
+ OPENCODE_PROVIDERS,
5308
5516
  OPENROUTER_DEFAULT_BASE_URL,
5309
5517
  PLAN_MODE_THINKING_CAP,
5310
5518
  SubscriptionUsageError,
@@ -5340,6 +5548,7 @@ function createAutoUpdater(config) {
5340
5548
  findProbedModel,
5341
5549
  formatClaudeCodeInstallProgress,
5342
5550
  formatLocalModelId,
5551
+ formatOpenCodeModelId,
5343
5552
  generatePKCE,
5344
5553
  getAllModels,
5345
5554
  getAppPaths,
@@ -5392,8 +5601,10 @@ function createAutoUpdater(config) {
5392
5601
  ollamaServedContext,
5393
5602
  openLog,
5394
5603
  parseLocalModelId,
5604
+ parseOpenCodeCatalog,
5395
5605
  parseOpenRouterCatalog,
5396
5606
  pendingClaudeCodeVersionRefresh,
5607
+ pointScale,
5397
5608
  probeEndpoint,
5398
5609
  providerStorageKeys,
5399
5610
  readClaudeCodeUsage,