@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.
@@ -45,11 +45,12 @@ __export(model_registry_exports, {
45
45
  getSummaryModel: () => getSummaryModel,
46
46
  getToolResultCharLimit: () => getToolResultCharLimit,
47
47
  getVideoByteLimit: () => getVideoByteLimit,
48
+ isPaidModel: () => isPaidModel,
48
49
  registerRuntimeModels: () => registerRuntimeModels,
49
- usesOpenAICodexTransport: () => usesOpenAICodexTransport
50
+ usesOpenAICodexTransport: () => usesOpenAICodexTransport,
51
+ withoutPaidTier: () => withoutPaidTier
50
52
  });
51
53
  module.exports = __toCommonJS(model_registry_exports);
52
- var import_ai2 = require("@prestyj/ai");
53
54
 
54
55
  // src/oauth/kimi.ts
55
56
  var import_node_child_process = require("child_process");
@@ -125,10 +126,29 @@ var import_promises3 = require("timers/promises");
125
126
  // src/auth-storage.ts
126
127
  var MOONSHOT_OAUTH_KEY = "moonshot-oauth";
127
128
  var XIAOMI_CREDITS_KEY = "xiaomi-credits";
129
+ var GEMINI_API_KEY = "gemini-api";
128
130
  var LOCAL_CREDENTIAL_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
129
131
  var USAGE_EXHAUSTED_DEFAULT_MS = 15 * 60 * 1e3;
130
132
 
131
133
  // src/model-registry.ts
134
+ var CLAUDE_FAST_BILLING = {
135
+ label: "bills usage credits",
136
+ 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.",
137
+ paid: true,
138
+ standardModel: "claude-opus-5-5"
139
+ };
140
+ var XIAOMI_ULTRASPEED_BILLING = {
141
+ label: "bills API Credits",
142
+ 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.",
143
+ paid: true,
144
+ standardModel: "mimo-v2.6-pro"
145
+ };
146
+ var CODEX_FAST_BILLING = {
147
+ label: "2.5x plan usage",
148
+ detail: "Codex Fast mode uses your ChatGPT plan limits at 2.5x the standard rate (purchased credits at 2x).",
149
+ paid: false
150
+ };
151
+ var GEMINI_AUTH_KEYS = [GEMINI_API_KEY, "gemini"];
132
152
  var MODELS = [
133
153
  // ── Anthropic ──────────────────────────────────────────
134
154
  // NOTE: Claude Mythos 5.1 (`claude-mythos-5-1`, 2026-09-01) is kept commented
@@ -191,28 +211,6 @@ var MODELS = [
191
211
  costTier: "high",
192
212
  maxThinkingLevel: "max"
193
213
  },
194
- {
195
- // Released 2026-07-24 — "For complex agentic coding and enterprise work".
196
- // Near-Fable capability at half the price ($5/$25 vs $10/$50). Adaptive
197
- // thinking with the full effort ladder (low→max, xhigh included); dateless
198
- // ID is the canonical pinned snapshot (post-4.6 naming scheme). Kept as a
199
- // legacy option now that Opus 5.5 leads the line: it's the last Opus that
200
- // accepts disabled thinking and forced tool use.
201
- id: "claude-opus-5",
202
- name: "Claude Opus 5",
203
- provider: "anthropic",
204
- contextWindow: 1e6,
205
- maxOutputTokens: 128e3,
206
- supportsThinking: true,
207
- supportsImages: true,
208
- supportsVideo: false,
209
- costTier: "high",
210
- // Anthropic's API and Claude Code both start the 5.5 family at medium; at a
211
- // given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
212
- // sessions slow and expensive. Users can still opt up.
213
- defaultThinkingLevel: "medium",
214
- maxThinkingLevel: "max"
215
- },
216
214
  {
217
215
  // Opus 5.5 in fast mode (research preview): the same model at up to 2.5x
218
216
  // output tokens/sec, $8/$40 MTok. @prestyj/ai's `stream()` sends it as
@@ -230,7 +228,8 @@ var MODELS = [
230
228
  supportsVideo: false,
231
229
  costTier: "high",
232
230
  defaultThinkingLevel: "medium",
233
- maxThinkingLevel: "max"
231
+ maxThinkingLevel: "max",
232
+ billing: CLAUDE_FAST_BILLING
234
233
  },
235
234
  {
236
235
  // Released 2026-09-28 — replaces Sonnet 5 at $2/$10 MTok, with the same
@@ -244,9 +243,10 @@ var MODELS = [
244
243
  supportsImages: true,
245
244
  supportsVideo: false,
246
245
  costTier: "medium",
247
- // Anthropic's API and Claude Code both start the 5.5 family at medium; at a
248
- // given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
249
- // sessions slow and expensive. Users can still opt up.
246
+ // We start Sonnet 5.5 at medium like the rest of the 5.5 family (the API's
247
+ // own default for Sonnet 5.5 is high). At a given level 5.5 thinks more
248
+ // than 5, so the ladder ceiling (max) made fresh sessions slow and
249
+ // expensive. Users can still opt up.
250
250
  defaultThinkingLevel: "medium",
251
251
  maxThinkingLevel: "max"
252
252
  },
@@ -315,7 +315,8 @@ var MODELS = [
315
315
  supportsImages: true,
316
316
  supportsVideo: false,
317
317
  costTier: "high",
318
- maxThinkingLevel: "ultra"
318
+ maxThinkingLevel: "ultra",
319
+ billing: CODEX_FAST_BILLING
319
320
  },
320
321
  // GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
321
322
  // GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
@@ -359,7 +360,8 @@ var MODELS = [
359
360
  supportsImages: true,
360
361
  supportsVideo: false,
361
362
  costTier: "medium",
362
- maxThinkingLevel: "ultra"
363
+ maxThinkingLevel: "ultra",
364
+ billing: CODEX_FAST_BILLING
363
365
  },
364
366
  {
365
367
  // Luna — "Fast and affordable model for easier tasks." (Codex priority 4,
@@ -393,7 +395,8 @@ var MODELS = [
393
395
  supportsImages: true,
394
396
  supportsVideo: false,
395
397
  costTier: "low",
396
- maxThinkingLevel: "max"
398
+ maxThinkingLevel: "max",
399
+ billing: CODEX_FAST_BILLING
397
400
  },
398
401
  // ── Sakana (Fugu) ──────────────────────────────────────
399
402
  // Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
@@ -477,10 +480,14 @@ var MODELS = [
477
480
  supportsVideo: true,
478
481
  maxVideoBytes: 20 * 1024 * 1024,
479
482
  costTier: "low",
480
- maxThinkingLevel: "high"
483
+ maxThinkingLevel: "high",
484
+ authStorageKeys: GEMINI_AUTH_KEYS
481
485
  },
482
486
  // Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
483
- // New GA models are opt-in; Code Assist access varies by account.
487
+ // New GA models are opt-in; Code Assist access varies by account. Gemini 3.7
488
+ // Flash is retired: Google deprecated it on 2026-10-08 and routes every
489
+ // `gemini-3.7-flash` request to 3.8 Flash (ai.google.dev/gemini-api/docs/
490
+ // changelog), so a saved session on it falls back to the provider default.
484
491
  {
485
492
  id: "gemini-3.8-flash",
486
493
  name: "Gemini 3.8 Flash",
@@ -492,7 +499,8 @@ var MODELS = [
492
499
  supportsVideo: true,
493
500
  maxVideoBytes: 20 * 1024 * 1024,
494
501
  costTier: "low",
495
- maxThinkingLevel: "high"
502
+ maxThinkingLevel: "high",
503
+ authStorageKeys: GEMINI_AUTH_KEYS
496
504
  },
497
505
  {
498
506
  id: "gemini-3.5-flash-lite",
@@ -505,27 +513,8 @@ var MODELS = [
505
513
  supportsVideo: true,
506
514
  maxVideoBytes: 20 * 1024 * 1024,
507
515
  costTier: "low",
508
- maxThinkingLevel: "high"
509
- },
510
- {
511
- // Gemini 3.7 Flash (released 2026-08-13) — Google's most capable Flash for
512
- // coding, agents, and multi-step execution; GA-stable on the Gemini API as
513
- // `gemini-3.7-flash`. 1M context, 64K output, thinking low/medium/high.
514
- // Sent over our Code Assist (OAuth) transport ahead of gemini-cli — upstream
515
- // hasn't listed 3.7 yet (google-gemini/gemini-cli#28802, still open) — so
516
- // free/personal accounts 404 (entitlement-gated) while Code Assist
517
- // Standard/Enterprise accounts get it.
518
- id: "gemini-3.7-flash",
519
- name: "Gemini 3.7 Flash",
520
- provider: "gemini",
521
- contextWindow: 1048576,
522
- maxOutputTokens: 65536,
523
- supportsThinking: true,
524
- supportsImages: true,
525
- supportsVideo: true,
526
- maxVideoBytes: 20 * 1024 * 1024,
527
- costTier: "low",
528
- maxThinkingLevel: "high"
516
+ maxThinkingLevel: "high",
517
+ authStorageKeys: GEMINI_AUTH_KEYS
529
518
  },
530
519
  {
531
520
  // Wire name `gemini-3-flash` — the Code Assist (OAuth) backend rejects the
@@ -541,7 +530,8 @@ var MODELS = [
541
530
  supportsVideo: true,
542
531
  maxVideoBytes: 20 * 1024 * 1024,
543
532
  costTier: "low",
544
- maxThinkingLevel: "high"
533
+ maxThinkingLevel: "high",
534
+ authStorageKeys: GEMINI_AUTH_KEYS
545
535
  },
546
536
  {
547
537
  // Gemini 3.1 Pro is public preview — gated behind Code Assist preview
@@ -557,7 +547,8 @@ var MODELS = [
557
547
  supportsVideo: true,
558
548
  maxVideoBytes: 20 * 1024 * 1024,
559
549
  costTier: "high",
560
- maxThinkingLevel: "high"
550
+ maxThinkingLevel: "high",
551
+ authStorageKeys: GEMINI_AUTH_KEYS
561
552
  },
562
553
  // ── Moonshot (Kimi) ────────────────────────────────────
563
554
  // K3 is Kimi's 2.8T-parameter flagship for long-horizon coding, knowledge
@@ -762,9 +753,13 @@ var MODELS = [
762
753
  maxVideoBytes: 36 * 1024 * 1024,
763
754
  costTier: "high",
764
755
  maxThinkingLevel: "high",
765
- authStorageKeys: [XIAOMI_CREDITS_KEY]
756
+ authStorageKeys: [XIAOMI_CREDITS_KEY],
757
+ billing: XIAOMI_ULTRASPEED_BILLING
766
758
  },
767
759
  // ── DeepSeek ───────────────────────────────────────────
760
+ // Window 1,000,000 tokens (decimal "1M"), as DeepSeek's own agent sizes it
761
+ // (deepseek-ai/deepseek-harness DEFAULT_CONTEXT_WINDOW = 1_000_000; models.dev
762
+ // via earendil-works/pi agrees) — not 1,048,576.
768
763
  // The live /models list (2026-09-28) serves exactly `deepseek-flash` and
769
764
  // `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
770
765
  // ids only temporarily route to V4.1 Flash, so they are retired here too.
@@ -778,7 +773,7 @@ var MODELS = [
778
773
  id: "deepseek-v4-pro",
779
774
  name: "DeepSeek V4 Pro",
780
775
  provider: "deepseek",
781
- contextWindow: 1048576,
776
+ contextWindow: 1e6,
782
777
  maxOutputTokens: 384e3,
783
778
  supportsThinking: true,
784
779
  supportsImages: false,
@@ -792,7 +787,7 @@ var MODELS = [
792
787
  id: "deepseek-flash",
793
788
  name: "DeepSeek V4.1 Flash",
794
789
  provider: "deepseek",
795
- contextWindow: 1048576,
790
+ contextWindow: 1e6,
796
791
  maxOutputTokens: 384e3,
797
792
  supportsThinking: true,
798
793
  supportsImages: true,
@@ -856,7 +851,7 @@ var MODELS = [
856
851
  id: "deepseek-ai/DeepSeek-V4.1-Flash",
857
852
  name: "DeepSeek V4.1 Flash",
858
853
  provider: "huggingface",
859
- contextWindow: 1048576,
854
+ contextWindow: 1e6,
860
855
  maxOutputTokens: 131072,
861
856
  supportsThinking: false,
862
857
  supportsImages: true,
@@ -903,6 +898,19 @@ function getModel(id) {
903
898
  function getModelsForProvider(provider) {
904
899
  return getAllModels().filter((m) => m.provider === provider);
905
900
  }
901
+ function isPaidModel(modelId) {
902
+ return getModel(modelId)?.billing?.paid === true;
903
+ }
904
+ function withoutPaidTier(modelId) {
905
+ const model = getModel(modelId);
906
+ if (model?.billing?.paid !== true) return modelId;
907
+ const usable = (id) => id !== void 0 && getModel(id) !== void 0 && !isPaidModel(id);
908
+ const standard = model.billing.standardModel;
909
+ if (usable(standard)) return standard;
910
+ const providerDefault = DEFAULT_MODEL_IDS[model.provider];
911
+ if (usable(providerDefault)) return providerDefault;
912
+ return FALLBACK_DEFAULT_MODEL_ID;
913
+ }
906
914
  function getAuthStorageKeys(provider, modelId) {
907
915
  const model = getAllModels().find((m) => m.id === modelId && m.provider === provider);
908
916
  return model?.authStorageKeys ?? [provider];
@@ -984,9 +992,7 @@ var SUMMARY_COST_TIER = {
984
992
  };
985
993
  function getSummaryModel(provider, currentModelId) {
986
994
  const tier = SUMMARY_COST_TIER[provider];
987
- const tagged = tier ? getModelsForProvider(provider).find(
988
- (m) => m.costTier === tier && !(0, import_ai2.resolveFastModeModel)(provider, m.id).fast
989
- ) : void 0;
995
+ const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier && m.billing === void 0) : void 0;
990
996
  return tagged ?? getModel(currentModelId) ?? getDefaultModel(provider);
991
997
  }
992
998
  // Annotate the CommonJS export names for ESM import in node:
@@ -1006,7 +1012,9 @@ function getSummaryModel(provider, currentModelId) {
1006
1012
  getSummaryModel,
1007
1013
  getToolResultCharLimit,
1008
1014
  getVideoByteLimit,
1015
+ isPaidModel,
1009
1016
  registerRuntimeModels,
1010
- usesOpenAICodexTransport
1017
+ usesOpenAICodexTransport,
1018
+ withoutPaidTier
1011
1019
  });
1012
1020
  //# sourceMappingURL=model-registry.cjs.map