@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.
@@ -45,8 +45,10 @@ __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
54
 
@@ -124,10 +126,29 @@ var import_promises3 = require("timers/promises");
124
126
  // src/auth-storage.ts
125
127
  var MOONSHOT_OAUTH_KEY = "moonshot-oauth";
126
128
  var XIAOMI_CREDITS_KEY = "xiaomi-credits";
129
+ var GEMINI_API_KEY = "gemini-api";
127
130
  var LOCAL_CREDENTIAL_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
128
131
  var USAGE_EXHAUSTED_DEFAULT_MS = 15 * 60 * 1e3;
129
132
 
130
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"];
131
152
  var MODELS = [
132
153
  // ── Anthropic ──────────────────────────────────────────
133
154
  // NOTE: Claude Mythos 5.1 (`claude-mythos-5-1`, 2026-09-01) is kept commented
@@ -191,14 +212,14 @@ var MODELS = [
191
212
  maxThinkingLevel: "max"
192
213
  },
193
214
  {
194
- // Released 2026-07-24 — "For complex agentic coding and enterprise work".
195
- // Near-Fable capability at half the price ($5/$25 vs $10/$50). Adaptive
196
- // thinking with the full effort ladder (low→max, xhigh included); dateless
197
- // ID is the canonical pinned snapshot (post-4.6 naming scheme). Kept as a
198
- // legacy option now that Opus 5.5 leads the line: it's the last Opus that
199
- // accepts disabled thinking and forced tool use.
200
- id: "claude-opus-5",
201
- name: "Claude Opus 5",
215
+ // Opus 5.5 in fast mode (research preview): the same model at up to 2.5x
216
+ // output tokens/sec, $8/$40 MTok. @prestyj/ai's `stream()` sends it as
217
+ // `claude-opus-5-5` + `speed: "fast"` + the fast-mode beta. On a Claude
218
+ // subscription it bills usage credits only — never included plan usage —
219
+ // and Anthropic 429s "Usage credits are required for fast mode" until they
220
+ // are turned on. Its prompt cache is separate from standard-speed Opus.
221
+ id: "claude-opus-5-5-fast",
222
+ name: "Claude Opus 5.5 Fast",
202
223
  provider: "anthropic",
203
224
  contextWindow: 1e6,
204
225
  maxOutputTokens: 128e3,
@@ -206,11 +227,9 @@ var MODELS = [
206
227
  supportsImages: true,
207
228
  supportsVideo: false,
208
229
  costTier: "high",
209
- // Anthropic's API and Claude Code both start the 5.5 family at medium; at a
210
- // given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
211
- // sessions slow and expensive. Users can still opt up.
212
230
  defaultThinkingLevel: "medium",
213
- maxThinkingLevel: "max"
231
+ maxThinkingLevel: "max",
232
+ billing: CLAUDE_FAST_BILLING
214
233
  },
215
234
  {
216
235
  // Released 2026-09-28 — replaces Sonnet 5 at $2/$10 MTok, with the same
@@ -224,9 +243,10 @@ var MODELS = [
224
243
  supportsImages: true,
225
244
  supportsVideo: false,
226
245
  costTier: "medium",
227
- // Anthropic's API and Claude Code both start the 5.5 family at medium; at a
228
- // given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
229
- // 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.
230
250
  defaultThinkingLevel: "medium",
231
251
  maxThinkingLevel: "max"
232
252
  },
@@ -279,6 +299,25 @@ var MODELS = [
279
299
  costTier: "high",
280
300
  maxThinkingLevel: "ultra"
281
301
  },
302
+ {
303
+ // Codex Fast mode for Astra (catalog `service_tiers: priority`, "2x speed,
304
+ // increased usage"). @prestyj/ai's `stream()` sends it as `gpt-6-astra` +
305
+ // `service_tier: "priority"`, exactly what the Codex CLI sends. On a
306
+ // ChatGPT plan it draws included limits at 2.5x the standard rate.
307
+ id: "gpt-6-astra-fast",
308
+ name: "GPT-6 Astra Fast",
309
+ provider: "openai",
310
+ contextWindow: 105e4,
311
+ codexContextWindow: 272e3,
312
+ maxOutputTokens: 128e3,
313
+ supportsThinking: true,
314
+ defaultThinkingLevel: "low",
315
+ supportsImages: true,
316
+ supportsVideo: false,
317
+ costTier: "high",
318
+ maxThinkingLevel: "ultra",
319
+ billing: CODEX_FAST_BILLING
320
+ },
282
321
  // GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
283
322
  // GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
284
323
  // catalog upgrades 5.6 Terra to 6 Sol). GPT-6.1 Sol (2026-09-29) then replaced
@@ -307,6 +346,23 @@ var MODELS = [
307
346
  costTier: "medium",
308
347
  maxThinkingLevel: "ultra"
309
348
  },
349
+ {
350
+ // Codex Fast mode for 6.1 Sol ("2x speed, increased usage") — see
351
+ // `gpt-6-astra-fast` for the wire mapping and billing.
352
+ id: "gpt-6.1-sol-fast",
353
+ name: "GPT-6.1 Sol Fast",
354
+ provider: "openai",
355
+ contextWindow: 105e4,
356
+ codexContextWindow: 272e3,
357
+ maxOutputTokens: 128e3,
358
+ supportsThinking: true,
359
+ defaultThinkingLevel: "low",
360
+ supportsImages: true,
361
+ supportsVideo: false,
362
+ costTier: "medium",
363
+ maxThinkingLevel: "ultra",
364
+ billing: CODEX_FAST_BILLING
365
+ },
310
366
  {
311
367
  // Luna — "Fast and affordable model for easier tasks." (Codex priority 4,
312
368
  // default medium, needs a Codex client >= 0.155.0). $0.10/$0.50 MTok.
@@ -324,6 +380,24 @@ var MODELS = [
324
380
  costTier: "low",
325
381
  maxThinkingLevel: "max"
326
382
  },
383
+ {
384
+ // Codex Fast mode for Luna ("1.5x speed") — see `gpt-6-astra-fast` for the
385
+ // wire mapping and billing. Listed after Luna so compaction summaries
386
+ // (first `low` OpenAI model) stay on standard-speed Luna.
387
+ id: "gpt-6-luna-fast",
388
+ name: "GPT-6 Luna Fast",
389
+ provider: "openai",
390
+ contextWindow: 105e4,
391
+ codexContextWindow: 272e3,
392
+ maxOutputTokens: 128e3,
393
+ supportsThinking: true,
394
+ defaultThinkingLevel: "medium",
395
+ supportsImages: true,
396
+ supportsVideo: false,
397
+ costTier: "low",
398
+ maxThinkingLevel: "max",
399
+ billing: CODEX_FAST_BILLING
400
+ },
327
401
  // ── Sakana (Fugu) ──────────────────────────────────────
328
402
  // Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
329
403
  // OpenAI-compatible Sakana API (https://api.sakana.ai/v1). All three take
@@ -406,10 +480,14 @@ var MODELS = [
406
480
  supportsVideo: true,
407
481
  maxVideoBytes: 20 * 1024 * 1024,
408
482
  costTier: "low",
409
- maxThinkingLevel: "high"
483
+ maxThinkingLevel: "high",
484
+ authStorageKeys: GEMINI_AUTH_KEYS
410
485
  },
411
486
  // Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
412
- // 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.
413
491
  {
414
492
  id: "gemini-3.8-flash",
415
493
  name: "Gemini 3.8 Flash",
@@ -421,7 +499,8 @@ var MODELS = [
421
499
  supportsVideo: true,
422
500
  maxVideoBytes: 20 * 1024 * 1024,
423
501
  costTier: "low",
424
- maxThinkingLevel: "high"
502
+ maxThinkingLevel: "high",
503
+ authStorageKeys: GEMINI_AUTH_KEYS
425
504
  },
426
505
  {
427
506
  id: "gemini-3.5-flash-lite",
@@ -434,27 +513,8 @@ var MODELS = [
434
513
  supportsVideo: true,
435
514
  maxVideoBytes: 20 * 1024 * 1024,
436
515
  costTier: "low",
437
- maxThinkingLevel: "high"
438
- },
439
- {
440
- // Gemini 3.7 Flash (released 2026-08-13) — Google's most capable Flash for
441
- // coding, agents, and multi-step execution; GA-stable on the Gemini API as
442
- // `gemini-3.7-flash`. 1M context, 64K output, thinking low/medium/high.
443
- // Sent over our Code Assist (OAuth) transport ahead of gemini-cli — upstream
444
- // hasn't listed 3.7 yet (google-gemini/gemini-cli#28802, still open) — so
445
- // free/personal accounts 404 (entitlement-gated) while Code Assist
446
- // Standard/Enterprise accounts get it.
447
- id: "gemini-3.7-flash",
448
- name: "Gemini 3.7 Flash",
449
- provider: "gemini",
450
- contextWindow: 1048576,
451
- maxOutputTokens: 65536,
452
- supportsThinking: true,
453
- supportsImages: true,
454
- supportsVideo: true,
455
- maxVideoBytes: 20 * 1024 * 1024,
456
- costTier: "low",
457
- maxThinkingLevel: "high"
516
+ maxThinkingLevel: "high",
517
+ authStorageKeys: GEMINI_AUTH_KEYS
458
518
  },
459
519
  {
460
520
  // Wire name `gemini-3-flash` — the Code Assist (OAuth) backend rejects the
@@ -470,7 +530,8 @@ var MODELS = [
470
530
  supportsVideo: true,
471
531
  maxVideoBytes: 20 * 1024 * 1024,
472
532
  costTier: "low",
473
- maxThinkingLevel: "high"
533
+ maxThinkingLevel: "high",
534
+ authStorageKeys: GEMINI_AUTH_KEYS
474
535
  },
475
536
  {
476
537
  // Gemini 3.1 Pro is public preview — gated behind Code Assist preview
@@ -486,7 +547,8 @@ var MODELS = [
486
547
  supportsVideo: true,
487
548
  maxVideoBytes: 20 * 1024 * 1024,
488
549
  costTier: "high",
489
- maxThinkingLevel: "high"
550
+ maxThinkingLevel: "high",
551
+ authStorageKeys: GEMINI_AUTH_KEYS
490
552
  },
491
553
  // ── Moonshot (Kimi) ────────────────────────────────────
492
554
  // K3 is Kimi's 2.8T-parameter flagship for long-horizon coding, knowledge
@@ -691,9 +753,13 @@ var MODELS = [
691
753
  maxVideoBytes: 36 * 1024 * 1024,
692
754
  costTier: "high",
693
755
  maxThinkingLevel: "high",
694
- authStorageKeys: [XIAOMI_CREDITS_KEY]
756
+ authStorageKeys: [XIAOMI_CREDITS_KEY],
757
+ billing: XIAOMI_ULTRASPEED_BILLING
695
758
  },
696
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.
697
763
  // The live /models list (2026-09-28) serves exactly `deepseek-flash` and
698
764
  // `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
699
765
  // ids only temporarily route to V4.1 Flash, so they are retired here too.
@@ -707,7 +773,7 @@ var MODELS = [
707
773
  id: "deepseek-v4-pro",
708
774
  name: "DeepSeek V4 Pro",
709
775
  provider: "deepseek",
710
- contextWindow: 1048576,
776
+ contextWindow: 1e6,
711
777
  maxOutputTokens: 384e3,
712
778
  supportsThinking: true,
713
779
  supportsImages: false,
@@ -721,7 +787,7 @@ var MODELS = [
721
787
  id: "deepseek-flash",
722
788
  name: "DeepSeek V4.1 Flash",
723
789
  provider: "deepseek",
724
- contextWindow: 1048576,
790
+ contextWindow: 1e6,
725
791
  maxOutputTokens: 384e3,
726
792
  supportsThinking: true,
727
793
  supportsImages: true,
@@ -785,7 +851,7 @@ var MODELS = [
785
851
  id: "deepseek-ai/DeepSeek-V4.1-Flash",
786
852
  name: "DeepSeek V4.1 Flash",
787
853
  provider: "huggingface",
788
- contextWindow: 1048576,
854
+ contextWindow: 1e6,
789
855
  maxOutputTokens: 131072,
790
856
  supportsThinking: false,
791
857
  supportsImages: true,
@@ -832,6 +898,19 @@ function getModel(id) {
832
898
  function getModelsForProvider(provider) {
833
899
  return getAllModels().filter((m) => m.provider === provider);
834
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
+ }
835
914
  function getAuthStorageKeys(provider, modelId) {
836
915
  const model = getAllModels().find((m) => m.id === modelId && m.provider === provider);
837
916
  return model?.authStorageKeys ?? [provider];
@@ -913,7 +992,7 @@ var SUMMARY_COST_TIER = {
913
992
  };
914
993
  function getSummaryModel(provider, currentModelId) {
915
994
  const tier = SUMMARY_COST_TIER[provider];
916
- const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier) : void 0;
995
+ const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier && m.billing === void 0) : void 0;
917
996
  return tagged ?? getModel(currentModelId) ?? getDefaultModel(provider);
918
997
  }
919
998
  // Annotate the CommonJS export names for ESM import in node:
@@ -933,7 +1012,9 @@ function getSummaryModel(provider, currentModelId) {
933
1012
  getSummaryModel,
934
1013
  getToolResultCharLimit,
935
1014
  getVideoByteLimit,
1015
+ isPaidModel,
936
1016
  registerRuntimeModels,
937
- usesOpenAICodexTransport
1017
+ usesOpenAICodexTransport,
1018
+ withoutPaidTier
938
1019
  });
939
1020
  //# sourceMappingURL=model-registry.cjs.map