@prestyj/core 5.32.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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ModelInfo } from './model-registry.cjs';
2
- export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, clearRuntimeModels, getAllModels, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getDefaultThinkingLevel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getToolResultCharLimit, getVideoByteLimit, registerRuntimeModels, usesOpenAICodexTransport } from './model-registry.cjs';
2
+ export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, ModelBilling, clearRuntimeModels, getAllModels, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getDefaultThinkingLevel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getToolResultCharLimit, getVideoByteLimit, isPaidModel, registerRuntimeModels, usesOpenAICodexTransport, withoutPaidTier } from './model-registry.cjs';
3
3
  import { ThinkingLevel, Provider } from '@prestyj/ai';
4
4
  export { AppPaths, getAppPaths } from './paths.cjs';
5
5
 
@@ -296,6 +296,16 @@ declare function providerStorageKeys(provider: string): string[];
296
296
  * order, is decided per-model via `getAuthStorageKeys()` in model-registry.ts.
297
297
  */
298
298
  declare const XIAOMI_CREDITS_KEY = "xiaomi-credits";
299
+ /**
300
+ * Storage key for a Gemini API key (Google AI Studio, billed per token), served
301
+ * by the public Gemini API at {@link GEMINI_API_KEY_BASE_URL}. Kept distinct from
302
+ * the `gemini` entry, which holds the Code Assist OAuth login: Google stopped
303
+ * serving Code Assist to personal accounts on 2026-06-18, so an API key is how
304
+ * those accounts reach Gemini at all, and a licensed account may hold both.
305
+ */
306
+ declare const GEMINI_API_KEY = "gemini-api";
307
+ /** Public Gemini API (AI Studio key). The transport routes on this base URL. */
308
+ declare const GEMINI_API_KEY_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
299
309
  /**
300
310
  * Prefix for local-endpoint credentials (`local:ollama`, `local:lmstudio`, …).
301
311
  * One entry per endpoint, each carrying that endpoint's `baseUrl`, so the
@@ -869,4 +879,4 @@ interface AutoUpdater {
869
879
  }
870
880
  declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
871
881
 
872
- export { AUTH_PROVIDERS, type ApiKeyVariant, type AuthMethod, type AuthMethodMeta, type AuthProviderMeta, AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, type DualAuthProvider, FALLBACK_CONTEXT_WINDOW, type InlineButton, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, type LocalEndpoint, type LocalEndpointKind, type LocalEndpointProbe, type LocalModel, type LogLevel, MOONSHOT_OAUTH_KEY, ModelInfo, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, PLAN_MODE_THINKING_CAP, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XAI_OAUTH_KEY, XIAOMI_CREDITS_KEY, authPriorityNote, clampThinkingForPlanMode, clearLocalDiscoveryCache, closeLogger, compareClaudeCodeVersions, createAutoUpdater, decodeOggOpus, describeAuthMethods, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getAuthProvider, getClaudeCliUserAgent, getClaudeCodeVersion, getLowestThinkingLevel, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, grokCliBaseUrl, grokCliHeaders, isGrokCliEndpoint, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, loginXai, oauthStorageKey, openLog, parseLocalModelId, probeEndpoint, providerStorageKeys, readStoredBaseUrlSync, recordRequiredClaudeCodeVersion, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, refreshXaiToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
882
+ export { AUTH_PROVIDERS, type ApiKeyVariant, type AuthMethod, type AuthMethodMeta, type AuthProviderMeta, AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, type DualAuthProvider, FALLBACK_CONTEXT_WINDOW, GEMINI_API_KEY, GEMINI_API_KEY_BASE_URL, type InlineButton, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, type LocalEndpoint, type LocalEndpointKind, type LocalEndpointProbe, type LocalModel, type LogLevel, MOONSHOT_OAUTH_KEY, ModelInfo, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, PLAN_MODE_THINKING_CAP, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XAI_OAUTH_KEY, XIAOMI_CREDITS_KEY, authPriorityNote, clampThinkingForPlanMode, clearLocalDiscoveryCache, closeLogger, compareClaudeCodeVersions, createAutoUpdater, decodeOggOpus, describeAuthMethods, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getAuthProvider, getClaudeCliUserAgent, getClaudeCodeVersion, getLowestThinkingLevel, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, grokCliBaseUrl, grokCliHeaders, isGrokCliEndpoint, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, loginXai, oauthStorageKey, openLog, parseLocalModelId, probeEndpoint, providerStorageKeys, readStoredBaseUrlSync, recordRequiredClaudeCodeVersion, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, refreshXaiToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ModelInfo } from './model-registry.js';
2
- export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, clearRuntimeModels, getAllModels, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getDefaultThinkingLevel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getToolResultCharLimit, getVideoByteLimit, registerRuntimeModels, usesOpenAICodexTransport } from './model-registry.js';
2
+ export { ContextWindowOptions, DEFAULT_MAX_VIDEO_BYTES, MODELS, ModelBilling, clearRuntimeModels, getAllModels, getAuthStorageKey, getAuthStorageKeys, getContextWindow, getDefaultModel, getDefaultThinkingLevel, getMaxThinkingLevel, getModel, getModelsForProvider, getSummaryModel, getToolResultCharLimit, getVideoByteLimit, isPaidModel, registerRuntimeModels, usesOpenAICodexTransport, withoutPaidTier } from './model-registry.js';
3
3
  import { ThinkingLevel, Provider } from '@prestyj/ai';
4
4
  export { AppPaths, getAppPaths } from './paths.js';
5
5
 
@@ -296,6 +296,16 @@ declare function providerStorageKeys(provider: string): string[];
296
296
  * order, is decided per-model via `getAuthStorageKeys()` in model-registry.ts.
297
297
  */
298
298
  declare const XIAOMI_CREDITS_KEY = "xiaomi-credits";
299
+ /**
300
+ * Storage key for a Gemini API key (Google AI Studio, billed per token), served
301
+ * by the public Gemini API at {@link GEMINI_API_KEY_BASE_URL}. Kept distinct from
302
+ * the `gemini` entry, which holds the Code Assist OAuth login: Google stopped
303
+ * serving Code Assist to personal accounts on 2026-06-18, so an API key is how
304
+ * those accounts reach Gemini at all, and a licensed account may hold both.
305
+ */
306
+ declare const GEMINI_API_KEY = "gemini-api";
307
+ /** Public Gemini API (AI Studio key). The transport routes on this base URL. */
308
+ declare const GEMINI_API_KEY_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
299
309
  /**
300
310
  * Prefix for local-endpoint credentials (`local:ollama`, `local:lmstudio`, …).
301
311
  * One entry per endpoint, each carrying that endpoint's `baseUrl`, so the
@@ -869,4 +879,4 @@ interface AutoUpdater {
869
879
  }
870
880
  declare function createAutoUpdater(config: AutoUpdateConfig): AutoUpdater;
871
881
 
872
- export { AUTH_PROVIDERS, type ApiKeyVariant, type AuthMethod, type AuthMethodMeta, type AuthProviderMeta, AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, type DualAuthProvider, FALLBACK_CONTEXT_WINDOW, type InlineButton, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, type LocalEndpoint, type LocalEndpointKind, type LocalEndpointProbe, type LocalModel, type LogLevel, MOONSHOT_OAUTH_KEY, ModelInfo, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, PLAN_MODE_THINKING_CAP, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XAI_OAUTH_KEY, XIAOMI_CREDITS_KEY, authPriorityNote, clampThinkingForPlanMode, clearLocalDiscoveryCache, closeLogger, compareClaudeCodeVersions, createAutoUpdater, decodeOggOpus, describeAuthMethods, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getAuthProvider, getClaudeCliUserAgent, getClaudeCodeVersion, getLowestThinkingLevel, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, grokCliBaseUrl, grokCliHeaders, isGrokCliEndpoint, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, loginXai, oauthStorageKey, openLog, parseLocalModelId, probeEndpoint, providerStorageKeys, readStoredBaseUrlSync, recordRequiredClaudeCodeVersion, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, refreshXaiToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
882
+ export { AUTH_PROVIDERS, type ApiKeyVariant, type AuthMethod, type AuthMethodMeta, type AuthProviderMeta, AuthStorage, type AutoUpdateConfig, type AutoUpdater, DEFAULT_LOCAL_ENDPOINTS, type DiscoverOptions, type DiscoveryResult, type DualAuthProvider, FALLBACK_CONTEXT_WINDOW, GEMINI_API_KEY, GEMINI_API_KEY_BASE_URL, type InlineButton, LOCAL_API_KEY_PLACEHOLDER, LOCAL_AUTH_KEY_PREFIX, type LocalEndpoint, type LocalEndpointKind, type LocalEndpointProbe, type LocalModel, type LogLevel, MOONSHOT_OAUTH_KEY, ModelInfo, NotLoggedInError, type OAuthCredentials, type OAuthLoginCallbacks, PLAN_MODE_THINKING_CAP, type ProbeOptions, type ProgressCallback, SubscriptionUsageError, type SubscriptionUsageProvider, type SubscriptionUsageSnapshot, type SubscriptionUsageWindow, TelegramBot, type TelegramConfig, type TelegramMessage, type TelegramUpdate, type TelegramVoiceMessage, XAI_OAUTH_KEY, XIAOMI_CREDITS_KEY, authPriorityNote, clampThinkingForPlanMode, clearLocalDiscoveryCache, closeLogger, compareClaudeCodeVersions, createAutoUpdater, decodeOggOpus, describeAuthMethods, discoverLocalModels, downmixToMono, dualAuthProvider, dualAuthProviderByOAuthKey, endpointRoot, fetchSubscriptionUsage, findProbedModel, formatLocalModelId, generatePKCE, getAuthProvider, getClaudeCliUserAgent, getClaudeCodeVersion, getLowestThinkingLevel, getNextThinkingLevel, getSessionId, getSupportedThinkingLevels, grokCliBaseUrl, grokCliHeaders, isGrokCliEndpoint, isKimiCodingEndpoint, isLocalModelId, isLoggerOpen, isModelLoaded, isThinkingLevelSupported, kimiCodeBaseUrl, kimiCodingHeaders, localAuthStorageKey, log, loginAnthropic, loginGemini, loginKimi, loginOpenAI, loginXai, oauthStorageKey, openLog, parseLocalModelId, probeEndpoint, providerStorageKeys, readStoredBaseUrlSync, recordRequiredClaudeCodeVersion, refreshAnthropicToken, refreshGeminiToken, refreshKimiToken, refreshOpenAIToken, refreshXaiToken, registerLogCleanup, resample, setProgressCallback, toModelInfo, transcribeVoice, withFileLock };
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  AuthStorage,
3
3
  DEFAULT_MAX_VIDEO_BYTES,
4
+ GEMINI_API_KEY,
5
+ GEMINI_API_KEY_BASE_URL,
4
6
  LOCAL_AUTH_KEY_PREFIX,
5
7
  MODELS,
6
8
  MOONSHOT_OAUTH_KEY,
@@ -33,6 +35,7 @@ import {
33
35
  isGrokCliEndpoint,
34
36
  isKimiCodingEndpoint,
35
37
  isLoggerOpen,
38
+ isPaidModel,
36
39
  kimiCodeBaseUrl,
37
40
  kimiCodingHeaders,
38
41
  log,
@@ -54,11 +57,12 @@ import {
54
57
  registerLogCleanup,
55
58
  registerRuntimeModels,
56
59
  usesOpenAICodexTransport,
57
- withFileLock
58
- } from "./chunk-7JDCLVUN.js";
60
+ withFileLock,
61
+ withoutPaidTier
62
+ } from "./chunk-XPXWXKRZ.js";
59
63
  import {
60
64
  getAppPaths
61
- } from "./chunk-CRU3SSNX.js";
65
+ } from "./chunk-W4NHU4UL.js";
62
66
 
63
67
  // src/thinking-level.ts
64
68
  var OPENAI_GPT_THINKING_LEVELS = ["medium", "high", "xhigh"];
@@ -474,8 +478,28 @@ var AUTH_PROVIDERS = [
474
478
  {
475
479
  value: "gemini",
476
480
  label: "Gemini",
477
- description: "Gemini 3.8 Flash, 3.5 Flash Lite, 3.7 Flash, 3.1 Flash Lite, 3.5 Flash, 3.1 Pro (Preview)",
478
- methods: ["oauth"]
481
+ description: "Gemini 3.8 Flash, 3.5 Flash Lite, 3.1 Flash Lite, 3.5 Flash, 3.1 Pro (Preview)",
482
+ methods: ["oauth", "apikey"],
483
+ apiKeyLabel: "Gemini",
484
+ apiKeyBaseUrl: GEMINI_API_KEY_BASE_URL,
485
+ // Stored under its own key so it never overwrites the `gemini` OAuth login.
486
+ apiKeyVariants: [
487
+ { key: GEMINI_API_KEY, label: "Google AI Studio", baseUrl: GEMINI_API_KEY_BASE_URL }
488
+ ],
489
+ methodDetails: {
490
+ oauth: {
491
+ method: "oauth",
492
+ label: "Sign in with Google",
493
+ billing: "Gemini Code Assist Standard or Enterprise licence.",
494
+ when: "Personal Google accounts are no longer served here (Google ended it on June 18, 2026)."
495
+ },
496
+ apikey: {
497
+ method: "apikey",
498
+ label: "Gemini API key",
499
+ billing: "Pay-per-token from a Google AI Studio key.",
500
+ when: "Used first whenever it is set."
501
+ }
502
+ }
479
503
  },
480
504
  {
481
505
  value: "xai",
@@ -605,6 +629,9 @@ function describeAuthMethods(provider) {
605
629
  });
606
630
  }
607
631
  function authPriorityNote(provider) {
632
+ if (provider === "gemini") {
633
+ return "Uses the Gemini API key first when one is set; otherwise the Google sign-in.";
634
+ }
608
635
  const dual = dualAuthProvider(provider);
609
636
  if (!dual) return void 0;
610
637
  return `Uses ${dual.oauthLabel} first; the ${dual.apiKeyLabel} takes over when it runs out, then switches back.`;
@@ -1350,6 +1377,8 @@ export {
1350
1377
  DEFAULT_LOCAL_ENDPOINTS,
1351
1378
  DEFAULT_MAX_VIDEO_BYTES,
1352
1379
  FALLBACK_CONTEXT_WINDOW,
1380
+ GEMINI_API_KEY,
1381
+ GEMINI_API_KEY_BASE_URL,
1353
1382
  LOCAL_API_KEY_PLACEHOLDER,
1354
1383
  LOCAL_AUTH_KEY_PREFIX,
1355
1384
  MODELS,
@@ -1405,6 +1434,7 @@ export {
1405
1434
  isLocalModelId,
1406
1435
  isLoggerOpen,
1407
1436
  isModelLoaded,
1437
+ isPaidModel,
1408
1438
  isThinkingLevelSupported,
1409
1439
  kimiCodeBaseUrl,
1410
1440
  kimiCodingHeaders,
@@ -1434,6 +1464,7 @@ export {
1434
1464
  toModelInfo,
1435
1465
  transcribeVoice,
1436
1466
  usesOpenAICodexTransport,
1437
- withFileLock
1467
+ withFileLock,
1468
+ withoutPaidTier
1438
1469
  };
1439
1470
  //# sourceMappingURL=index.js.map