@kenkaiiii/gg-core 5.81.0 → 5.83.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.
@@ -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
 
@@ -122,10 +124,29 @@ var import_promises3 = require("timers/promises");
122
124
  // src/auth-storage.ts
123
125
  var MOONSHOT_OAUTH_KEY = "moonshot-oauth";
124
126
  var XIAOMI_CREDITS_KEY = "xiaomi-credits";
127
+ var GEMINI_API_KEY = "gemini-api";
125
128
  var LOCAL_CREDENTIAL_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
126
129
  var USAGE_EXHAUSTED_DEFAULT_MS = 15 * 60 * 1e3;
127
130
 
128
131
  // src/model-registry.ts
132
+ var CLAUDE_FAST_BILLING = {
133
+ label: "bills usage credits",
134
+ 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.",
135
+ paid: true,
136
+ standardModel: "claude-opus-5-5"
137
+ };
138
+ var XIAOMI_ULTRASPEED_BILLING = {
139
+ label: "bills API Credits",
140
+ 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.",
141
+ paid: true,
142
+ standardModel: "mimo-v2.6-pro"
143
+ };
144
+ var CODEX_FAST_BILLING = {
145
+ label: "2.5x plan usage",
146
+ detail: "Codex Fast mode uses your ChatGPT plan limits at 2.5x the standard rate (purchased credits at 2x).",
147
+ paid: false
148
+ };
149
+ var GEMINI_AUTH_KEYS = [GEMINI_API_KEY, "gemini"];
129
150
  var MODELS = [
130
151
  // ── Anthropic ──────────────────────────────────────────
131
152
  // NOTE: Claude Mythos 5.1 (`claude-mythos-5-1`, 2026-09-01) is kept commented
@@ -170,9 +191,8 @@ var MODELS = [
170
191
  // context, 128K output, image input. Same always-on adaptive thinking with
171
192
  // the full effort ladder (low→max, xhigh included; the API-side default
172
193
  // effort is `medium`) and the same Fable 5.1 constraints gg-ai already
173
- // handles (no forced tool use, thinking can't be disabled). Also eligible
174
- // for the gated `speed: "fast"` research preview (waitlist-only, premium
175
- // $8/$40 pricing — not wired up). Opus 5 is retired here — a session that
194
+ // handles (no forced tool use, thinking can't be disabled). Fast mode is
195
+ // the separate `claude-opus-5-5-fast` entry below. Opus 5 is retired here — a session that
176
196
  // still has it saved falls back to the provider default on next start.
177
197
  id: "claude-opus-5-5",
178
198
  name: "Claude Opus 5.5",
@@ -189,6 +209,26 @@ var MODELS = [
189
209
  defaultThinkingLevel: "medium",
190
210
  maxThinkingLevel: "max"
191
211
  },
212
+ {
213
+ // Opus 5.5 in fast mode (research preview): the same model at up to 2.5x
214
+ // output tokens/sec, $8/$40 MTok. gg-ai's `stream()` sends it as
215
+ // `claude-opus-5-5` + `speed: "fast"` + the fast-mode beta. On a Claude
216
+ // subscription it bills usage credits only — never included plan usage —
217
+ // and Anthropic 429s "Usage credits are required for fast mode" until they
218
+ // are turned on. Its prompt cache is separate from standard-speed Opus.
219
+ id: "claude-opus-5-5-fast",
220
+ name: "Claude Opus 5.5 Fast",
221
+ provider: "anthropic",
222
+ contextWindow: 1e6,
223
+ maxOutputTokens: 128e3,
224
+ supportsThinking: true,
225
+ supportsImages: true,
226
+ supportsVideo: false,
227
+ costTier: "high",
228
+ defaultThinkingLevel: "medium",
229
+ maxThinkingLevel: "max",
230
+ billing: CLAUDE_FAST_BILLING
231
+ },
192
232
  {
193
233
  // Released 2026-09-28 — replaces Sonnet 5 at $2/$10 MTok, with the same
194
234
  // 1M context / 128K output and adaptive thinking, now including xhigh.
@@ -201,9 +241,10 @@ var MODELS = [
201
241
  supportsImages: true,
202
242
  supportsVideo: false,
203
243
  costTier: "medium",
204
- // Anthropic's API and Claude Code both start the 5.5 family at medium; at a
205
- // given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
206
- // sessions slow and expensive. Users can still opt up.
244
+ // We start Sonnet 5.5 at medium like the rest of the 5.5 family (the API's
245
+ // own default for Sonnet 5.5 is high). At a given level 5.5 thinks more
246
+ // than 5, so the ladder ceiling (max) made fresh sessions slow and
247
+ // expensive. Users can still opt up.
207
248
  defaultThinkingLevel: "medium",
208
249
  maxThinkingLevel: "max"
209
250
  },
@@ -256,6 +297,25 @@ var MODELS = [
256
297
  costTier: "high",
257
298
  maxThinkingLevel: "ultra"
258
299
  },
300
+ {
301
+ // Codex Fast mode for Astra (catalog `service_tiers: priority`, "2x speed,
302
+ // increased usage"). gg-ai's `stream()` sends it as `gpt-6-astra` +
303
+ // `service_tier: "priority"`, exactly what the Codex CLI sends. On a
304
+ // ChatGPT plan it draws included limits at 2.5x the standard rate.
305
+ id: "gpt-6-astra-fast",
306
+ name: "GPT-6 Astra Fast",
307
+ provider: "openai",
308
+ contextWindow: 105e4,
309
+ codexContextWindow: 272e3,
310
+ maxOutputTokens: 128e3,
311
+ supportsThinking: true,
312
+ defaultThinkingLevel: "low",
313
+ supportsImages: true,
314
+ supportsVideo: false,
315
+ costTier: "high",
316
+ maxThinkingLevel: "ultra",
317
+ billing: CODEX_FAST_BILLING
318
+ },
259
319
  // GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
260
320
  // GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
261
321
  // catalog upgrades 5.6 Terra to 6 Sol). GPT-6.1 Sol (2026-09-29) then replaced
@@ -284,6 +344,23 @@ var MODELS = [
284
344
  costTier: "medium",
285
345
  maxThinkingLevel: "ultra"
286
346
  },
347
+ {
348
+ // Codex Fast mode for 6.1 Sol ("2x speed, increased usage") — see
349
+ // `gpt-6-astra-fast` for the wire mapping and billing.
350
+ id: "gpt-6.1-sol-fast",
351
+ name: "GPT-6.1 Sol Fast",
352
+ provider: "openai",
353
+ contextWindow: 105e4,
354
+ codexContextWindow: 272e3,
355
+ maxOutputTokens: 128e3,
356
+ supportsThinking: true,
357
+ defaultThinkingLevel: "low",
358
+ supportsImages: true,
359
+ supportsVideo: false,
360
+ costTier: "medium",
361
+ maxThinkingLevel: "ultra",
362
+ billing: CODEX_FAST_BILLING
363
+ },
287
364
  {
288
365
  // Luna — "Fast and affordable model for easier tasks." (Codex priority 4,
289
366
  // default medium, needs a Codex client >= 0.155.0). $0.10/$0.50 MTok.
@@ -301,6 +378,24 @@ var MODELS = [
301
378
  costTier: "low",
302
379
  maxThinkingLevel: "max"
303
380
  },
381
+ {
382
+ // Codex Fast mode for Luna ("1.5x speed") — see `gpt-6-astra-fast` for the
383
+ // wire mapping and billing. Listed after Luna so compaction summaries
384
+ // (first `low` OpenAI model) stay on standard-speed Luna.
385
+ id: "gpt-6-luna-fast",
386
+ name: "GPT-6 Luna Fast",
387
+ provider: "openai",
388
+ contextWindow: 105e4,
389
+ codexContextWindow: 272e3,
390
+ maxOutputTokens: 128e3,
391
+ supportsThinking: true,
392
+ defaultThinkingLevel: "medium",
393
+ supportsImages: true,
394
+ supportsVideo: false,
395
+ costTier: "low",
396
+ maxThinkingLevel: "max",
397
+ billing: CODEX_FAST_BILLING
398
+ },
304
399
  // ── Sakana (Fugu) ──────────────────────────────────────
305
400
  // Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
306
401
  // OpenAI-compatible Sakana API (https://api.sakana.ai/v1). All three take
@@ -383,10 +478,14 @@ var MODELS = [
383
478
  supportsVideo: true,
384
479
  maxVideoBytes: 20 * 1024 * 1024,
385
480
  costTier: "low",
386
- maxThinkingLevel: "high"
481
+ maxThinkingLevel: "high",
482
+ authStorageKeys: GEMINI_AUTH_KEYS
387
483
  },
388
484
  // Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
389
- // New GA models are opt-in; Code Assist access varies by account.
485
+ // New GA models are opt-in; Code Assist access varies by account. Gemini 3.7
486
+ // Flash is retired: Google deprecated it on 2026-10-08 and routes every
487
+ // `gemini-3.7-flash` request to 3.8 Flash (ai.google.dev/gemini-api/docs/
488
+ // changelog), so a saved session on it falls back to the provider default.
390
489
  {
391
490
  id: "gemini-3.8-flash",
392
491
  name: "Gemini 3.8 Flash",
@@ -398,7 +497,8 @@ var MODELS = [
398
497
  supportsVideo: true,
399
498
  maxVideoBytes: 20 * 1024 * 1024,
400
499
  costTier: "low",
401
- maxThinkingLevel: "high"
500
+ maxThinkingLevel: "high",
501
+ authStorageKeys: GEMINI_AUTH_KEYS
402
502
  },
403
503
  {
404
504
  id: "gemini-3.5-flash-lite",
@@ -411,27 +511,8 @@ var MODELS = [
411
511
  supportsVideo: true,
412
512
  maxVideoBytes: 20 * 1024 * 1024,
413
513
  costTier: "low",
414
- maxThinkingLevel: "high"
415
- },
416
- {
417
- // Gemini 3.7 Flash (released 2026-08-13) — Google's most capable Flash for
418
- // coding, agents, and multi-step execution; GA-stable on the Gemini API as
419
- // `gemini-3.7-flash`. 1M context, 64K output, thinking low/medium/high.
420
- // Sent over our Code Assist (OAuth) transport ahead of gemini-cli — upstream
421
- // hasn't listed 3.7 yet (google-gemini/gemini-cli#28802, still open) — so
422
- // free/personal accounts 404 (entitlement-gated) while Code Assist
423
- // Standard/Enterprise accounts get it.
424
- id: "gemini-3.7-flash",
425
- name: "Gemini 3.7 Flash",
426
- provider: "gemini",
427
- contextWindow: 1048576,
428
- maxOutputTokens: 65536,
429
- supportsThinking: true,
430
- supportsImages: true,
431
- supportsVideo: true,
432
- maxVideoBytes: 20 * 1024 * 1024,
433
- costTier: "low",
434
- maxThinkingLevel: "high"
514
+ maxThinkingLevel: "high",
515
+ authStorageKeys: GEMINI_AUTH_KEYS
435
516
  },
436
517
  {
437
518
  // Wire name `gemini-3-flash` — the Code Assist (OAuth) backend rejects the
@@ -447,7 +528,8 @@ var MODELS = [
447
528
  supportsVideo: true,
448
529
  maxVideoBytes: 20 * 1024 * 1024,
449
530
  costTier: "low",
450
- maxThinkingLevel: "high"
531
+ maxThinkingLevel: "high",
532
+ authStorageKeys: GEMINI_AUTH_KEYS
451
533
  },
452
534
  {
453
535
  // Gemini 3.1 Pro is public preview — gated behind Code Assist preview
@@ -463,7 +545,8 @@ var MODELS = [
463
545
  supportsVideo: true,
464
546
  maxVideoBytes: 20 * 1024 * 1024,
465
547
  costTier: "high",
466
- maxThinkingLevel: "high"
548
+ maxThinkingLevel: "high",
549
+ authStorageKeys: GEMINI_AUTH_KEYS
467
550
  },
468
551
  // ── Moonshot (Kimi) ────────────────────────────────────
469
552
  // K3 is Kimi's 2.8T-parameter flagship for long-horizon coding, knowledge
@@ -652,9 +735,13 @@ var MODELS = [
652
735
  maxVideoBytes: 36 * 1024 * 1024,
653
736
  costTier: "high",
654
737
  maxThinkingLevel: "high",
655
- authStorageKeys: [XIAOMI_CREDITS_KEY]
738
+ authStorageKeys: [XIAOMI_CREDITS_KEY],
739
+ billing: XIAOMI_ULTRASPEED_BILLING
656
740
  },
657
741
  // ── DeepSeek ───────────────────────────────────────────
742
+ // Window 1,000,000 tokens (decimal "1M"), as DeepSeek's own agent sizes it
743
+ // (deepseek-ai/deepseek-harness DEFAULT_CONTEXT_WINDOW = 1_000_000; models.dev
744
+ // via earendil-works/pi agrees) — not 1,048,576.
658
745
  // The live /models list (2026-09-28) serves exactly `deepseek-flash` and
659
746
  // `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
660
747
  // ids only temporarily route to V4.1 Flash, so they are retired here too.
@@ -668,7 +755,7 @@ var MODELS = [
668
755
  id: "deepseek-v4-pro",
669
756
  name: "DeepSeek V4 Pro",
670
757
  provider: "deepseek",
671
- contextWindow: 1048576,
758
+ contextWindow: 1e6,
672
759
  maxOutputTokens: 384e3,
673
760
  supportsThinking: true,
674
761
  supportsImages: false,
@@ -682,7 +769,7 @@ var MODELS = [
682
769
  id: "deepseek-flash",
683
770
  name: "DeepSeek V4.1 Flash",
684
771
  provider: "deepseek",
685
- contextWindow: 1048576,
772
+ contextWindow: 1e6,
686
773
  maxOutputTokens: 384e3,
687
774
  supportsThinking: true,
688
775
  supportsImages: true,
@@ -746,7 +833,7 @@ var MODELS = [
746
833
  id: "deepseek-ai/DeepSeek-V4.1-Flash",
747
834
  name: "DeepSeek V4.1 Flash",
748
835
  provider: "huggingface",
749
- contextWindow: 1048576,
836
+ contextWindow: 1e6,
750
837
  maxOutputTokens: 131072,
751
838
  supportsThinking: false,
752
839
  supportsImages: true,
@@ -793,6 +880,19 @@ function getModel(id) {
793
880
  function getModelsForProvider(provider) {
794
881
  return getAllModels().filter((m) => m.provider === provider);
795
882
  }
883
+ function isPaidModel(modelId) {
884
+ return getModel(modelId)?.billing?.paid === true;
885
+ }
886
+ function withoutPaidTier(modelId) {
887
+ const model = getModel(modelId);
888
+ if (model?.billing?.paid !== true) return modelId;
889
+ const usable = (id) => id !== void 0 && getModel(id) !== void 0 && !isPaidModel(id);
890
+ const standard = model.billing.standardModel;
891
+ if (usable(standard)) return standard;
892
+ const providerDefault = DEFAULT_MODEL_IDS[model.provider];
893
+ if (usable(providerDefault)) return providerDefault;
894
+ return FALLBACK_DEFAULT_MODEL_ID;
895
+ }
796
896
  function getAuthStorageKeys(provider, modelId) {
797
897
  const model = getAllModels().find((m) => m.id === modelId && m.provider === provider);
798
898
  return model?.authStorageKeys ?? [provider];
@@ -874,7 +974,7 @@ var SUMMARY_COST_TIER = {
874
974
  };
875
975
  function getSummaryModel(provider, currentModelId) {
876
976
  const tier = SUMMARY_COST_TIER[provider];
877
- const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier) : void 0;
977
+ const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier && m.billing === void 0) : void 0;
878
978
  return tagged ?? getModel(currentModelId) ?? getDefaultModel(provider);
879
979
  }
880
980
  // Annotate the CommonJS export names for ESM import in node:
@@ -894,7 +994,9 @@ function getSummaryModel(provider, currentModelId) {
894
994
  getSummaryModel,
895
995
  getToolResultCharLimit,
896
996
  getVideoByteLimit,
997
+ isPaidModel,
897
998
  registerRuntimeModels,
898
- usesOpenAICodexTransport
999
+ usesOpenAICodexTransport,
1000
+ withoutPaidTier
899
1001
  });
900
1002
  //# sourceMappingURL=model-registry.cjs.map