@kenkaiiii/gg-core 5.82.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,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_gg_ai2 = require("@kenkaiiii/gg-ai");
53
54
 
54
55
  // src/oauth/kimi.ts
55
56
  var import_node_child_process = require("child_process");
@@ -123,10 +124,29 @@ var import_promises3 = require("timers/promises");
123
124
  // src/auth-storage.ts
124
125
  var MOONSHOT_OAUTH_KEY = "moonshot-oauth";
125
126
  var XIAOMI_CREDITS_KEY = "xiaomi-credits";
127
+ var GEMINI_API_KEY = "gemini-api";
126
128
  var LOCAL_CREDENTIAL_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
127
129
  var USAGE_EXHAUSTED_DEFAULT_MS = 15 * 60 * 1e3;
128
130
 
129
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"];
130
150
  var MODELS = [
131
151
  // ── Anthropic ──────────────────────────────────────────
132
152
  // NOTE: Claude Mythos 5.1 (`claude-mythos-5-1`, 2026-09-01) is kept commented
@@ -206,7 +226,8 @@ var MODELS = [
206
226
  supportsVideo: false,
207
227
  costTier: "high",
208
228
  defaultThinkingLevel: "medium",
209
- maxThinkingLevel: "max"
229
+ maxThinkingLevel: "max",
230
+ billing: CLAUDE_FAST_BILLING
210
231
  },
211
232
  {
212
233
  // Released 2026-09-28 — replaces Sonnet 5 at $2/$10 MTok, with the same
@@ -220,9 +241,10 @@ var MODELS = [
220
241
  supportsImages: true,
221
242
  supportsVideo: false,
222
243
  costTier: "medium",
223
- // Anthropic's API and Claude Code both start the 5.5 family at medium; at a
224
- // given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
225
- // 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.
226
248
  defaultThinkingLevel: "medium",
227
249
  maxThinkingLevel: "max"
228
250
  },
@@ -291,7 +313,8 @@ var MODELS = [
291
313
  supportsImages: true,
292
314
  supportsVideo: false,
293
315
  costTier: "high",
294
- maxThinkingLevel: "ultra"
316
+ maxThinkingLevel: "ultra",
317
+ billing: CODEX_FAST_BILLING
295
318
  },
296
319
  // GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
297
320
  // GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
@@ -335,7 +358,8 @@ var MODELS = [
335
358
  supportsImages: true,
336
359
  supportsVideo: false,
337
360
  costTier: "medium",
338
- maxThinkingLevel: "ultra"
361
+ maxThinkingLevel: "ultra",
362
+ billing: CODEX_FAST_BILLING
339
363
  },
340
364
  {
341
365
  // Luna — "Fast and affordable model for easier tasks." (Codex priority 4,
@@ -369,7 +393,8 @@ var MODELS = [
369
393
  supportsImages: true,
370
394
  supportsVideo: false,
371
395
  costTier: "low",
372
- maxThinkingLevel: "max"
396
+ maxThinkingLevel: "max",
397
+ billing: CODEX_FAST_BILLING
373
398
  },
374
399
  // ── Sakana (Fugu) ──────────────────────────────────────
375
400
  // Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
@@ -453,10 +478,14 @@ var MODELS = [
453
478
  supportsVideo: true,
454
479
  maxVideoBytes: 20 * 1024 * 1024,
455
480
  costTier: "low",
456
- maxThinkingLevel: "high"
481
+ maxThinkingLevel: "high",
482
+ authStorageKeys: GEMINI_AUTH_KEYS
457
483
  },
458
484
  // Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
459
- // 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.
460
489
  {
461
490
  id: "gemini-3.8-flash",
462
491
  name: "Gemini 3.8 Flash",
@@ -468,7 +497,8 @@ var MODELS = [
468
497
  supportsVideo: true,
469
498
  maxVideoBytes: 20 * 1024 * 1024,
470
499
  costTier: "low",
471
- maxThinkingLevel: "high"
500
+ maxThinkingLevel: "high",
501
+ authStorageKeys: GEMINI_AUTH_KEYS
472
502
  },
473
503
  {
474
504
  id: "gemini-3.5-flash-lite",
@@ -481,27 +511,8 @@ var MODELS = [
481
511
  supportsVideo: true,
482
512
  maxVideoBytes: 20 * 1024 * 1024,
483
513
  costTier: "low",
484
- maxThinkingLevel: "high"
485
- },
486
- {
487
- // Gemini 3.7 Flash (released 2026-08-13) — Google's most capable Flash for
488
- // coding, agents, and multi-step execution; GA-stable on the Gemini API as
489
- // `gemini-3.7-flash`. 1M context, 64K output, thinking low/medium/high.
490
- // Sent over our Code Assist (OAuth) transport ahead of gemini-cli — upstream
491
- // hasn't listed 3.7 yet (google-gemini/gemini-cli#28802, still open) — so
492
- // free/personal accounts 404 (entitlement-gated) while Code Assist
493
- // Standard/Enterprise accounts get it.
494
- id: "gemini-3.7-flash",
495
- name: "Gemini 3.7 Flash",
496
- provider: "gemini",
497
- contextWindow: 1048576,
498
- maxOutputTokens: 65536,
499
- supportsThinking: true,
500
- supportsImages: true,
501
- supportsVideo: true,
502
- maxVideoBytes: 20 * 1024 * 1024,
503
- costTier: "low",
504
- maxThinkingLevel: "high"
514
+ maxThinkingLevel: "high",
515
+ authStorageKeys: GEMINI_AUTH_KEYS
505
516
  },
506
517
  {
507
518
  // Wire name `gemini-3-flash` — the Code Assist (OAuth) backend rejects the
@@ -517,7 +528,8 @@ var MODELS = [
517
528
  supportsVideo: true,
518
529
  maxVideoBytes: 20 * 1024 * 1024,
519
530
  costTier: "low",
520
- maxThinkingLevel: "high"
531
+ maxThinkingLevel: "high",
532
+ authStorageKeys: GEMINI_AUTH_KEYS
521
533
  },
522
534
  {
523
535
  // Gemini 3.1 Pro is public preview — gated behind Code Assist preview
@@ -533,7 +545,8 @@ var MODELS = [
533
545
  supportsVideo: true,
534
546
  maxVideoBytes: 20 * 1024 * 1024,
535
547
  costTier: "high",
536
- maxThinkingLevel: "high"
548
+ maxThinkingLevel: "high",
549
+ authStorageKeys: GEMINI_AUTH_KEYS
537
550
  },
538
551
  // ── Moonshot (Kimi) ────────────────────────────────────
539
552
  // K3 is Kimi's 2.8T-parameter flagship for long-horizon coding, knowledge
@@ -722,9 +735,13 @@ var MODELS = [
722
735
  maxVideoBytes: 36 * 1024 * 1024,
723
736
  costTier: "high",
724
737
  maxThinkingLevel: "high",
725
- authStorageKeys: [XIAOMI_CREDITS_KEY]
738
+ authStorageKeys: [XIAOMI_CREDITS_KEY],
739
+ billing: XIAOMI_ULTRASPEED_BILLING
726
740
  },
727
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.
728
745
  // The live /models list (2026-09-28) serves exactly `deepseek-flash` and
729
746
  // `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
730
747
  // ids only temporarily route to V4.1 Flash, so they are retired here too.
@@ -738,7 +755,7 @@ var MODELS = [
738
755
  id: "deepseek-v4-pro",
739
756
  name: "DeepSeek V4 Pro",
740
757
  provider: "deepseek",
741
- contextWindow: 1048576,
758
+ contextWindow: 1e6,
742
759
  maxOutputTokens: 384e3,
743
760
  supportsThinking: true,
744
761
  supportsImages: false,
@@ -752,7 +769,7 @@ var MODELS = [
752
769
  id: "deepseek-flash",
753
770
  name: "DeepSeek V4.1 Flash",
754
771
  provider: "deepseek",
755
- contextWindow: 1048576,
772
+ contextWindow: 1e6,
756
773
  maxOutputTokens: 384e3,
757
774
  supportsThinking: true,
758
775
  supportsImages: true,
@@ -816,7 +833,7 @@ var MODELS = [
816
833
  id: "deepseek-ai/DeepSeek-V4.1-Flash",
817
834
  name: "DeepSeek V4.1 Flash",
818
835
  provider: "huggingface",
819
- contextWindow: 1048576,
836
+ contextWindow: 1e6,
820
837
  maxOutputTokens: 131072,
821
838
  supportsThinking: false,
822
839
  supportsImages: true,
@@ -863,6 +880,19 @@ function getModel(id) {
863
880
  function getModelsForProvider(provider) {
864
881
  return getAllModels().filter((m) => m.provider === provider);
865
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
+ }
866
896
  function getAuthStorageKeys(provider, modelId) {
867
897
  const model = getAllModels().find((m) => m.id === modelId && m.provider === provider);
868
898
  return model?.authStorageKeys ?? [provider];
@@ -944,9 +974,7 @@ var SUMMARY_COST_TIER = {
944
974
  };
945
975
  function getSummaryModel(provider, currentModelId) {
946
976
  const tier = SUMMARY_COST_TIER[provider];
947
- const tagged = tier ? getModelsForProvider(provider).find(
948
- (m) => m.costTier === tier && !(0, import_gg_ai2.resolveFastModeModel)(provider, m.id).fast
949
- ) : void 0;
977
+ const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier && m.billing === void 0) : void 0;
950
978
  return tagged ?? getModel(currentModelId) ?? getDefaultModel(provider);
951
979
  }
952
980
  // Annotate the CommonJS export names for ESM import in node:
@@ -966,7 +994,9 @@ function getSummaryModel(provider, currentModelId) {
966
994
  getSummaryModel,
967
995
  getToolResultCharLimit,
968
996
  getVideoByteLimit,
997
+ isPaidModel,
969
998
  registerRuntimeModels,
970
- usesOpenAICodexTransport
999
+ usesOpenAICodexTransport,
1000
+ withoutPaidTier
971
1001
  });
972
1002
  //# sourceMappingURL=model-registry.cjs.map