@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.
@@ -1446,6 +1446,8 @@ function providerStorageKeys(provider) {
1446
1446
  return dual ? [dual.oauthKey, dual.provider] : [provider];
1447
1447
  }
1448
1448
  var XIAOMI_CREDITS_KEY = "xiaomi-credits";
1449
+ var GEMINI_API_KEY = "gemini-api";
1450
+ var GEMINI_API_KEY_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
1449
1451
  var LOCAL_AUTH_KEY_PREFIX = "local:";
1450
1452
  var LOCAL_CREDENTIAL_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
1451
1453
  function activeBaseUrlEntry(data, provider) {
@@ -1549,6 +1551,9 @@ var AuthStorage = class {
1549
1551
  if (provider === "xiaomi") {
1550
1552
  return Boolean(this.data["xiaomi"] || this.data[XIAOMI_CREDITS_KEY]);
1551
1553
  }
1554
+ if (provider === "gemini") {
1555
+ return Boolean(this.data["gemini"] || this.data[GEMINI_API_KEY]);
1556
+ }
1552
1557
  if (provider === "local") {
1553
1558
  return Object.keys(this.data).some((key) => key.startsWith(LOCAL_AUTH_KEY_PREFIX));
1554
1559
  }
@@ -1777,6 +1782,12 @@ var AuthStorage = class {
1777
1782
  ...opts.rejectedToken !== void 0 ? { rejectedToken: opts.rejectedToken } : {}
1778
1783
  });
1779
1784
  }
1785
+ if (key === provider) {
1786
+ return await this.resolveCredentials(provider, {
1787
+ ...opts.forceRefresh ? { forceRefresh: true } : {},
1788
+ ...opts.rejectedToken !== void 0 ? { rejectedToken: opts.rejectedToken } : {}
1789
+ });
1790
+ }
1780
1791
  return creds2;
1781
1792
  }
1782
1793
  throw new NotLoggedInError(provider);
@@ -1918,6 +1929,24 @@ var NotLoggedInError = class extends Error {
1918
1929
  };
1919
1930
 
1920
1931
  // src/model-registry.ts
1932
+ var CLAUDE_FAST_BILLING = {
1933
+ label: "bills usage credits",
1934
+ 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.",
1935
+ paid: true,
1936
+ standardModel: "claude-opus-5-5"
1937
+ };
1938
+ var XIAOMI_ULTRASPEED_BILLING = {
1939
+ label: "bills API Credits",
1940
+ 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.",
1941
+ paid: true,
1942
+ standardModel: "mimo-v2.6-pro"
1943
+ };
1944
+ var CODEX_FAST_BILLING = {
1945
+ label: "2.5x plan usage",
1946
+ detail: "Codex Fast mode uses your ChatGPT plan limits at 2.5x the standard rate (purchased credits at 2x).",
1947
+ paid: false
1948
+ };
1949
+ var GEMINI_AUTH_KEYS = [GEMINI_API_KEY, "gemini"];
1921
1950
  var MODELS = [
1922
1951
  // ── Anthropic ──────────────────────────────────────────
1923
1952
  // NOTE: Claude Mythos 5.1 (`claude-mythos-5-1`, 2026-09-01) is kept commented
@@ -1962,9 +1991,8 @@ var MODELS = [
1962
1991
  // context, 128K output, image input. Same always-on adaptive thinking with
1963
1992
  // the full effort ladder (low→max, xhigh included; the API-side default
1964
1993
  // effort is `medium`) and the same Fable 5.1 constraints gg-ai already
1965
- // handles (no forced tool use, thinking can't be disabled). Also eligible
1966
- // for the gated `speed: "fast"` research preview (waitlist-only, premium
1967
- // $8/$40 pricing — not wired up). Opus 5 is retired here — a session that
1994
+ // handles (no forced tool use, thinking can't be disabled). Fast mode is
1995
+ // the separate `claude-opus-5-5-fast` entry below. Opus 5 is retired here — a session that
1968
1996
  // still has it saved falls back to the provider default on next start.
1969
1997
  id: "claude-opus-5-5",
1970
1998
  name: "Claude Opus 5.5",
@@ -1981,6 +2009,26 @@ var MODELS = [
1981
2009
  defaultThinkingLevel: "medium",
1982
2010
  maxThinkingLevel: "max"
1983
2011
  },
2012
+ {
2013
+ // Opus 5.5 in fast mode (research preview): the same model at up to 2.5x
2014
+ // output tokens/sec, $8/$40 MTok. gg-ai's `stream()` sends it as
2015
+ // `claude-opus-5-5` + `speed: "fast"` + the fast-mode beta. On a Claude
2016
+ // subscription it bills usage credits only — never included plan usage —
2017
+ // and Anthropic 429s "Usage credits are required for fast mode" until they
2018
+ // are turned on. Its prompt cache is separate from standard-speed Opus.
2019
+ id: "claude-opus-5-5-fast",
2020
+ name: "Claude Opus 5.5 Fast",
2021
+ provider: "anthropic",
2022
+ contextWindow: 1e6,
2023
+ maxOutputTokens: 128e3,
2024
+ supportsThinking: true,
2025
+ supportsImages: true,
2026
+ supportsVideo: false,
2027
+ costTier: "high",
2028
+ defaultThinkingLevel: "medium",
2029
+ maxThinkingLevel: "max",
2030
+ billing: CLAUDE_FAST_BILLING
2031
+ },
1984
2032
  {
1985
2033
  // Released 2026-09-28 — replaces Sonnet 5 at $2/$10 MTok, with the same
1986
2034
  // 1M context / 128K output and adaptive thinking, now including xhigh.
@@ -1993,9 +2041,10 @@ var MODELS = [
1993
2041
  supportsImages: true,
1994
2042
  supportsVideo: false,
1995
2043
  costTier: "medium",
1996
- // Anthropic's API and Claude Code both start the 5.5 family at medium; at a
1997
- // given level 5.5 thinks more than 5, so the ladder ceiling (max) made fresh
1998
- // sessions slow and expensive. Users can still opt up.
2044
+ // We start Sonnet 5.5 at medium like the rest of the 5.5 family (the API's
2045
+ // own default for Sonnet 5.5 is high). At a given level 5.5 thinks more
2046
+ // than 5, so the ladder ceiling (max) made fresh sessions slow and
2047
+ // expensive. Users can still opt up.
1999
2048
  defaultThinkingLevel: "medium",
2000
2049
  maxThinkingLevel: "max"
2001
2050
  },
@@ -2048,6 +2097,25 @@ var MODELS = [
2048
2097
  costTier: "high",
2049
2098
  maxThinkingLevel: "ultra"
2050
2099
  },
2100
+ {
2101
+ // Codex Fast mode for Astra (catalog `service_tiers: priority`, "2x speed,
2102
+ // increased usage"). gg-ai's `stream()` sends it as `gpt-6-astra` +
2103
+ // `service_tier: "priority"`, exactly what the Codex CLI sends. On a
2104
+ // ChatGPT plan it draws included limits at 2.5x the standard rate.
2105
+ id: "gpt-6-astra-fast",
2106
+ name: "GPT-6 Astra Fast",
2107
+ provider: "openai",
2108
+ contextWindow: 105e4,
2109
+ codexContextWindow: 272e3,
2110
+ maxOutputTokens: 128e3,
2111
+ supportsThinking: true,
2112
+ defaultThinkingLevel: "low",
2113
+ supportsImages: true,
2114
+ supportsVideo: false,
2115
+ costTier: "high",
2116
+ maxThinkingLevel: "ultra",
2117
+ billing: CODEX_FAST_BILLING
2118
+ },
2051
2119
  // GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
2052
2120
  // GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
2053
2121
  // catalog upgrades 5.6 Terra to 6 Sol). GPT-6.1 Sol (2026-09-29) then replaced
@@ -2076,6 +2144,23 @@ var MODELS = [
2076
2144
  costTier: "medium",
2077
2145
  maxThinkingLevel: "ultra"
2078
2146
  },
2147
+ {
2148
+ // Codex Fast mode for 6.1 Sol ("2x speed, increased usage") — see
2149
+ // `gpt-6-astra-fast` for the wire mapping and billing.
2150
+ id: "gpt-6.1-sol-fast",
2151
+ name: "GPT-6.1 Sol Fast",
2152
+ provider: "openai",
2153
+ contextWindow: 105e4,
2154
+ codexContextWindow: 272e3,
2155
+ maxOutputTokens: 128e3,
2156
+ supportsThinking: true,
2157
+ defaultThinkingLevel: "low",
2158
+ supportsImages: true,
2159
+ supportsVideo: false,
2160
+ costTier: "medium",
2161
+ maxThinkingLevel: "ultra",
2162
+ billing: CODEX_FAST_BILLING
2163
+ },
2079
2164
  {
2080
2165
  // Luna — "Fast and affordable model for easier tasks." (Codex priority 4,
2081
2166
  // default medium, needs a Codex client >= 0.155.0). $0.10/$0.50 MTok.
@@ -2093,6 +2178,24 @@ var MODELS = [
2093
2178
  costTier: "low",
2094
2179
  maxThinkingLevel: "max"
2095
2180
  },
2181
+ {
2182
+ // Codex Fast mode for Luna ("1.5x speed") — see `gpt-6-astra-fast` for the
2183
+ // wire mapping and billing. Listed after Luna so compaction summaries
2184
+ // (first `low` OpenAI model) stay on standard-speed Luna.
2185
+ id: "gpt-6-luna-fast",
2186
+ name: "GPT-6 Luna Fast",
2187
+ provider: "openai",
2188
+ contextWindow: 105e4,
2189
+ codexContextWindow: 272e3,
2190
+ maxOutputTokens: 128e3,
2191
+ supportsThinking: true,
2192
+ defaultThinkingLevel: "medium",
2193
+ supportsImages: true,
2194
+ supportsVideo: false,
2195
+ costTier: "low",
2196
+ maxThinkingLevel: "max",
2197
+ billing: CODEX_FAST_BILLING
2198
+ },
2096
2199
  // ── Sakana (Fugu) ──────────────────────────────────────
2097
2200
  // Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
2098
2201
  // OpenAI-compatible Sakana API (https://api.sakana.ai/v1). All three take
@@ -2175,10 +2278,14 @@ var MODELS = [
2175
2278
  supportsVideo: true,
2176
2279
  maxVideoBytes: 20 * 1024 * 1024,
2177
2280
  costTier: "low",
2178
- maxThinkingLevel: "high"
2281
+ maxThinkingLevel: "high",
2282
+ authStorageKeys: GEMINI_AUTH_KEYS
2179
2283
  },
2180
2284
  // Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
2181
- // New GA models are opt-in; Code Assist access varies by account.
2285
+ // New GA models are opt-in; Code Assist access varies by account. Gemini 3.7
2286
+ // Flash is retired: Google deprecated it on 2026-10-08 and routes every
2287
+ // `gemini-3.7-flash` request to 3.8 Flash (ai.google.dev/gemini-api/docs/
2288
+ // changelog), so a saved session on it falls back to the provider default.
2182
2289
  {
2183
2290
  id: "gemini-3.8-flash",
2184
2291
  name: "Gemini 3.8 Flash",
@@ -2190,7 +2297,8 @@ var MODELS = [
2190
2297
  supportsVideo: true,
2191
2298
  maxVideoBytes: 20 * 1024 * 1024,
2192
2299
  costTier: "low",
2193
- maxThinkingLevel: "high"
2300
+ maxThinkingLevel: "high",
2301
+ authStorageKeys: GEMINI_AUTH_KEYS
2194
2302
  },
2195
2303
  {
2196
2304
  id: "gemini-3.5-flash-lite",
@@ -2203,27 +2311,8 @@ var MODELS = [
2203
2311
  supportsVideo: true,
2204
2312
  maxVideoBytes: 20 * 1024 * 1024,
2205
2313
  costTier: "low",
2206
- maxThinkingLevel: "high"
2207
- },
2208
- {
2209
- // Gemini 3.7 Flash (released 2026-08-13) — Google's most capable Flash for
2210
- // coding, agents, and multi-step execution; GA-stable on the Gemini API as
2211
- // `gemini-3.7-flash`. 1M context, 64K output, thinking low/medium/high.
2212
- // Sent over our Code Assist (OAuth) transport ahead of gemini-cli — upstream
2213
- // hasn't listed 3.7 yet (google-gemini/gemini-cli#28802, still open) — so
2214
- // free/personal accounts 404 (entitlement-gated) while Code Assist
2215
- // Standard/Enterprise accounts get it.
2216
- id: "gemini-3.7-flash",
2217
- name: "Gemini 3.7 Flash",
2218
- provider: "gemini",
2219
- contextWindow: 1048576,
2220
- maxOutputTokens: 65536,
2221
- supportsThinking: true,
2222
- supportsImages: true,
2223
- supportsVideo: true,
2224
- maxVideoBytes: 20 * 1024 * 1024,
2225
- costTier: "low",
2226
- maxThinkingLevel: "high"
2314
+ maxThinkingLevel: "high",
2315
+ authStorageKeys: GEMINI_AUTH_KEYS
2227
2316
  },
2228
2317
  {
2229
2318
  // Wire name `gemini-3-flash` — the Code Assist (OAuth) backend rejects the
@@ -2239,7 +2328,8 @@ var MODELS = [
2239
2328
  supportsVideo: true,
2240
2329
  maxVideoBytes: 20 * 1024 * 1024,
2241
2330
  costTier: "low",
2242
- maxThinkingLevel: "high"
2331
+ maxThinkingLevel: "high",
2332
+ authStorageKeys: GEMINI_AUTH_KEYS
2243
2333
  },
2244
2334
  {
2245
2335
  // Gemini 3.1 Pro is public preview — gated behind Code Assist preview
@@ -2255,7 +2345,8 @@ var MODELS = [
2255
2345
  supportsVideo: true,
2256
2346
  maxVideoBytes: 20 * 1024 * 1024,
2257
2347
  costTier: "high",
2258
- maxThinkingLevel: "high"
2348
+ maxThinkingLevel: "high",
2349
+ authStorageKeys: GEMINI_AUTH_KEYS
2259
2350
  },
2260
2351
  // ── Moonshot (Kimi) ────────────────────────────────────
2261
2352
  // K3 is Kimi's 2.8T-parameter flagship for long-horizon coding, knowledge
@@ -2444,9 +2535,13 @@ var MODELS = [
2444
2535
  maxVideoBytes: 36 * 1024 * 1024,
2445
2536
  costTier: "high",
2446
2537
  maxThinkingLevel: "high",
2447
- authStorageKeys: [XIAOMI_CREDITS_KEY]
2538
+ authStorageKeys: [XIAOMI_CREDITS_KEY],
2539
+ billing: XIAOMI_ULTRASPEED_BILLING
2448
2540
  },
2449
2541
  // ── DeepSeek ───────────────────────────────────────────
2542
+ // Window 1,000,000 tokens (decimal "1M"), as DeepSeek's own agent sizes it
2543
+ // (deepseek-ai/deepseek-harness DEFAULT_CONTEXT_WINDOW = 1_000_000; models.dev
2544
+ // via earendil-works/pi agrees) — not 1,048,576.
2450
2545
  // The live /models list (2026-09-28) serves exactly `deepseek-flash` and
2451
2546
  // `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
2452
2547
  // ids only temporarily route to V4.1 Flash, so they are retired here too.
@@ -2460,7 +2555,7 @@ var MODELS = [
2460
2555
  id: "deepseek-v4-pro",
2461
2556
  name: "DeepSeek V4 Pro",
2462
2557
  provider: "deepseek",
2463
- contextWindow: 1048576,
2558
+ contextWindow: 1e6,
2464
2559
  maxOutputTokens: 384e3,
2465
2560
  supportsThinking: true,
2466
2561
  supportsImages: false,
@@ -2474,7 +2569,7 @@ var MODELS = [
2474
2569
  id: "deepseek-flash",
2475
2570
  name: "DeepSeek V4.1 Flash",
2476
2571
  provider: "deepseek",
2477
- contextWindow: 1048576,
2572
+ contextWindow: 1e6,
2478
2573
  maxOutputTokens: 384e3,
2479
2574
  supportsThinking: true,
2480
2575
  supportsImages: true,
@@ -2538,7 +2633,7 @@ var MODELS = [
2538
2633
  id: "deepseek-ai/DeepSeek-V4.1-Flash",
2539
2634
  name: "DeepSeek V4.1 Flash",
2540
2635
  provider: "huggingface",
2541
- contextWindow: 1048576,
2636
+ contextWindow: 1e6,
2542
2637
  maxOutputTokens: 131072,
2543
2638
  supportsThinking: false,
2544
2639
  supportsImages: true,
@@ -2585,6 +2680,19 @@ function getModel(id) {
2585
2680
  function getModelsForProvider(provider) {
2586
2681
  return getAllModels().filter((m) => m.provider === provider);
2587
2682
  }
2683
+ function isPaidModel(modelId) {
2684
+ return getModel(modelId)?.billing?.paid === true;
2685
+ }
2686
+ function withoutPaidTier(modelId) {
2687
+ const model = getModel(modelId);
2688
+ if (model?.billing?.paid !== true) return modelId;
2689
+ const usable = (id) => id !== void 0 && getModel(id) !== void 0 && !isPaidModel(id);
2690
+ const standard = model.billing.standardModel;
2691
+ if (usable(standard)) return standard;
2692
+ const providerDefault = DEFAULT_MODEL_IDS[model.provider];
2693
+ if (usable(providerDefault)) return providerDefault;
2694
+ return FALLBACK_DEFAULT_MODEL_ID;
2695
+ }
2588
2696
  function getAuthStorageKeys(provider, modelId) {
2589
2697
  const model = getAllModels().find((m) => m.id === modelId && m.provider === provider);
2590
2698
  return model?.authStorageKeys ?? [provider];
@@ -2666,7 +2774,7 @@ var SUMMARY_COST_TIER = {
2666
2774
  };
2667
2775
  function getSummaryModel(provider, currentModelId) {
2668
2776
  const tier = SUMMARY_COST_TIER[provider];
2669
- const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier) : void 0;
2777
+ const tagged = tier ? getModelsForProvider(provider).find((m) => m.costTier === tier && m.billing === void 0) : void 0;
2670
2778
  return tagged ?? getModel(currentModelId) ?? getDefaultModel(provider);
2671
2779
  }
2672
2780
 
@@ -2704,6 +2812,8 @@ export {
2704
2812
  oauthStorageKey,
2705
2813
  providerStorageKeys,
2706
2814
  XIAOMI_CREDITS_KEY,
2815
+ GEMINI_API_KEY,
2816
+ GEMINI_API_KEY_BASE_URL,
2707
2817
  LOCAL_AUTH_KEY_PREFIX,
2708
2818
  readStoredBaseUrlSync,
2709
2819
  AuthStorage,
@@ -2714,6 +2824,8 @@ export {
2714
2824
  getAllModels,
2715
2825
  getModel,
2716
2826
  getModelsForProvider,
2827
+ isPaidModel,
2828
+ withoutPaidTier,
2717
2829
  getAuthStorageKeys,
2718
2830
  getAuthStorageKey,
2719
2831
  DEFAULT_MAX_VIDEO_BYTES,
@@ -2726,4 +2838,4 @@ export {
2726
2838
  getDefaultThinkingLevel,
2727
2839
  getSummaryModel
2728
2840
  };
2729
- //# sourceMappingURL=chunk-BNMQ6VWC.js.map
2841
+ //# sourceMappingURL=chunk-JJED477O.js.map