@kenkaiiii/gg-core 5.79.0 → 5.79.2
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.cjs +161 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -1
- package/dist/index.d.ts +82 -1
- package/dist/index.js +157 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AUTH_PROVIDERS: () => AUTH_PROVIDERS,
|
|
33
34
|
AuthStorage: () => AuthStorage,
|
|
34
35
|
DEFAULT_LOCAL_ENDPOINTS: () => DEFAULT_LOCAL_ENDPOINTS,
|
|
35
36
|
DEFAULT_MAX_VIDEO_BYTES: () => DEFAULT_MAX_VIDEO_BYTES,
|
|
@@ -44,12 +45,14 @@ __export(index_exports, {
|
|
|
44
45
|
TelegramBot: () => TelegramBot,
|
|
45
46
|
XAI_OAUTH_KEY: () => XAI_OAUTH_KEY,
|
|
46
47
|
XIAOMI_CREDITS_KEY: () => XIAOMI_CREDITS_KEY,
|
|
48
|
+
authPriorityNote: () => authPriorityNote,
|
|
47
49
|
clampThinkingForPlanMode: () => clampThinkingForPlanMode,
|
|
48
50
|
clearLocalDiscoveryCache: () => clearLocalDiscoveryCache,
|
|
49
51
|
clearRuntimeModels: () => clearRuntimeModels,
|
|
50
52
|
closeLogger: () => closeLogger,
|
|
51
53
|
createAutoUpdater: () => createAutoUpdater,
|
|
52
54
|
decodeOggOpus: () => decodeOggOpus,
|
|
55
|
+
describeAuthMethods: () => describeAuthMethods,
|
|
53
56
|
discoverLocalModels: () => discoverLocalModels,
|
|
54
57
|
downmixToMono: () => downmixToMono,
|
|
55
58
|
dualAuthProvider: () => dualAuthProvider,
|
|
@@ -61,6 +64,7 @@ __export(index_exports, {
|
|
|
61
64
|
generatePKCE: () => generatePKCE,
|
|
62
65
|
getAllModels: () => getAllModels,
|
|
63
66
|
getAppPaths: () => getAppPaths,
|
|
67
|
+
getAuthProvider: () => getAuthProvider,
|
|
64
68
|
getAuthStorageKey: () => getAuthStorageKey,
|
|
65
69
|
getAuthStorageKeys: () => getAuthStorageKeys,
|
|
66
70
|
getClaudeCliUserAgent: () => getClaudeCliUserAgent,
|
|
@@ -3196,6 +3200,159 @@ function findProbedModel(probes, modelId) {
|
|
|
3196
3200
|
return void 0;
|
|
3197
3201
|
}
|
|
3198
3202
|
|
|
3203
|
+
// src/auth-providers.ts
|
|
3204
|
+
var AUTH_PROVIDERS = [
|
|
3205
|
+
{
|
|
3206
|
+
value: "anthropic",
|
|
3207
|
+
label: "Anthropic",
|
|
3208
|
+
description: "Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5",
|
|
3209
|
+
methods: ["oauth"]
|
|
3210
|
+
},
|
|
3211
|
+
{
|
|
3212
|
+
value: "openai",
|
|
3213
|
+
label: "OpenAI",
|
|
3214
|
+
description: "GPT-6 Astra, GPT-6.1 Sol, GPT-6 Luna",
|
|
3215
|
+
methods: ["oauth"]
|
|
3216
|
+
},
|
|
3217
|
+
{
|
|
3218
|
+
value: "gemini",
|
|
3219
|
+
label: "Gemini",
|
|
3220
|
+
description: "Gemini 3.8 Flash, 3.5 Flash Lite, 3.7 Flash, 3.1 Flash Lite, 3.5 Flash, 3.1 Pro (Preview)",
|
|
3221
|
+
methods: ["oauth"]
|
|
3222
|
+
},
|
|
3223
|
+
{
|
|
3224
|
+
value: "xai",
|
|
3225
|
+
label: "xAI (Grok)",
|
|
3226
|
+
description: "Grok 4.7 \xB7 OAuth or API key",
|
|
3227
|
+
methods: ["oauth", "apikey"],
|
|
3228
|
+
apiKeyLabel: "xAI",
|
|
3229
|
+
methodDetails: {
|
|
3230
|
+
oauth: {
|
|
3231
|
+
method: "oauth",
|
|
3232
|
+
label: "Sign in with Grok",
|
|
3233
|
+
billing: "Included with SuperGrok or X Premium.",
|
|
3234
|
+
when: ""
|
|
3235
|
+
},
|
|
3236
|
+
apikey: {
|
|
3237
|
+
method: "apikey",
|
|
3238
|
+
label: "xAI API key",
|
|
3239
|
+
billing: "Pay-per-token on console.x.ai credits.",
|
|
3240
|
+
when: ""
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
},
|
|
3244
|
+
{
|
|
3245
|
+
value: "moonshot",
|
|
3246
|
+
label: "Moonshot",
|
|
3247
|
+
description: "Kimi K3, K2.8 Preview (Kimi sign-in), K2.7 Code, K2.7 Code HighSpeed \xB7 OAuth or API key",
|
|
3248
|
+
methods: ["oauth", "apikey"],
|
|
3249
|
+
apiKeyLabel: "Moonshot",
|
|
3250
|
+
methodDetails: {
|
|
3251
|
+
oauth: {
|
|
3252
|
+
method: "oauth",
|
|
3253
|
+
label: "Sign in with Kimi",
|
|
3254
|
+
billing: "Included with a Kimi For Coding plan.",
|
|
3255
|
+
when: ""
|
|
3256
|
+
},
|
|
3257
|
+
apikey: {
|
|
3258
|
+
method: "apikey",
|
|
3259
|
+
label: "Moonshot API key",
|
|
3260
|
+
billing: "Pay-per-token on Moonshot credits.",
|
|
3261
|
+
when: ""
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
},
|
|
3265
|
+
{
|
|
3266
|
+
value: "glm",
|
|
3267
|
+
label: "Z.AI (GLM)",
|
|
3268
|
+
description: "GLM-5.3, GLM-5.3-Flash",
|
|
3269
|
+
methods: ["apikey"],
|
|
3270
|
+
apiKeyLabel: "Z.AI"
|
|
3271
|
+
},
|
|
3272
|
+
{
|
|
3273
|
+
value: "minimax",
|
|
3274
|
+
label: "MiniMax",
|
|
3275
|
+
description: "MiniMax M3",
|
|
3276
|
+
methods: ["apikey"],
|
|
3277
|
+
apiKeyLabel: "MiniMax"
|
|
3278
|
+
},
|
|
3279
|
+
{
|
|
3280
|
+
value: "xiaomi",
|
|
3281
|
+
label: "Xiaomi (MiMo)",
|
|
3282
|
+
description: "MiMo-V2.6-Pro, MiMo-V2.6-Flash, MiMo-V2.6-Pro-UltraSpeed \xB7 Token Plan or API Credits",
|
|
3283
|
+
methods: ["apikey"],
|
|
3284
|
+
apiKeyLabel: "Xiaomi MiMo",
|
|
3285
|
+
apiKeyBaseUrl: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
3286
|
+
apiKeyVariants: [
|
|
3287
|
+
{
|
|
3288
|
+
key: "xiaomi",
|
|
3289
|
+
label: "Token Plan",
|
|
3290
|
+
baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1"
|
|
3291
|
+
},
|
|
3292
|
+
{
|
|
3293
|
+
key: XIAOMI_CREDITS_KEY,
|
|
3294
|
+
label: "API Credits (required for UltraSpeed)",
|
|
3295
|
+
baseUrl: "https://api.xiaomimimo.com/v1"
|
|
3296
|
+
}
|
|
3297
|
+
]
|
|
3298
|
+
},
|
|
3299
|
+
{
|
|
3300
|
+
value: "deepseek",
|
|
3301
|
+
label: "DeepSeek",
|
|
3302
|
+
description: "DeepSeek V4 Pro, V4.1 Flash",
|
|
3303
|
+
methods: ["apikey"],
|
|
3304
|
+
apiKeyLabel: "DeepSeek"
|
|
3305
|
+
},
|
|
3306
|
+
{
|
|
3307
|
+
value: "sakana",
|
|
3308
|
+
label: "Sakana (Fugu)",
|
|
3309
|
+
description: "Fugu, Fugu Max, Fugu Ultra",
|
|
3310
|
+
methods: ["apikey"],
|
|
3311
|
+
apiKeyLabel: "Sakana"
|
|
3312
|
+
},
|
|
3313
|
+
{
|
|
3314
|
+
value: "openrouter",
|
|
3315
|
+
label: "OpenRouter",
|
|
3316
|
+
description: "Qwen3.8 Max \xB7 multi-provider gateway",
|
|
3317
|
+
methods: ["apikey"],
|
|
3318
|
+
apiKeyLabel: "OpenRouter"
|
|
3319
|
+
},
|
|
3320
|
+
{
|
|
3321
|
+
value: "huggingface",
|
|
3322
|
+
label: "Hugging Face",
|
|
3323
|
+
description: "Kimi K2.7 Code, DeepSeek V4.1 Flash, GPT-OSS 120B",
|
|
3324
|
+
methods: ["apikey"],
|
|
3325
|
+
apiKeyLabel: "Hugging Face"
|
|
3326
|
+
}
|
|
3327
|
+
];
|
|
3328
|
+
function getAuthProvider(value) {
|
|
3329
|
+
return AUTH_PROVIDERS.find((p) => p.value === value);
|
|
3330
|
+
}
|
|
3331
|
+
function describeAuthMethods(provider) {
|
|
3332
|
+
const meta = getAuthProvider(provider);
|
|
3333
|
+
if (!meta) return [];
|
|
3334
|
+
return meta.methods.map((method) => {
|
|
3335
|
+
const override = meta.methodDetails?.[method];
|
|
3336
|
+
if (override) return { ...override };
|
|
3337
|
+
return method === "oauth" ? {
|
|
3338
|
+
method,
|
|
3339
|
+
label: `Sign in with ${meta.label}`,
|
|
3340
|
+
billing: "Uses your existing plan with this provider.",
|
|
3341
|
+
when: ""
|
|
3342
|
+
} : {
|
|
3343
|
+
method,
|
|
3344
|
+
label: `${meta.apiKeyLabel ?? meta.label} API key`,
|
|
3345
|
+
billing: "Pay-per-token on this provider's API credits.",
|
|
3346
|
+
when: ""
|
|
3347
|
+
};
|
|
3348
|
+
});
|
|
3349
|
+
}
|
|
3350
|
+
function authPriorityNote(provider) {
|
|
3351
|
+
const dual = dualAuthProvider(provider);
|
|
3352
|
+
if (!dual) return void 0;
|
|
3353
|
+
return `Uses ${dual.oauthLabel} first; the ${dual.apiKeyLabel} takes over when it runs out, then switches back.`;
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3199
3356
|
// src/provider-usage.ts
|
|
3200
3357
|
var SubscriptionUsageError = class extends Error {
|
|
3201
3358
|
constructor(message, status, retryAfterMs2) {
|
|
@@ -3932,6 +4089,7 @@ function createAutoUpdater(config) {
|
|
|
3932
4089
|
}
|
|
3933
4090
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3934
4091
|
0 && (module.exports = {
|
|
4092
|
+
AUTH_PROVIDERS,
|
|
3935
4093
|
AuthStorage,
|
|
3936
4094
|
DEFAULT_LOCAL_ENDPOINTS,
|
|
3937
4095
|
DEFAULT_MAX_VIDEO_BYTES,
|
|
@@ -3946,12 +4104,14 @@ function createAutoUpdater(config) {
|
|
|
3946
4104
|
TelegramBot,
|
|
3947
4105
|
XAI_OAUTH_KEY,
|
|
3948
4106
|
XIAOMI_CREDITS_KEY,
|
|
4107
|
+
authPriorityNote,
|
|
3949
4108
|
clampThinkingForPlanMode,
|
|
3950
4109
|
clearLocalDiscoveryCache,
|
|
3951
4110
|
clearRuntimeModels,
|
|
3952
4111
|
closeLogger,
|
|
3953
4112
|
createAutoUpdater,
|
|
3954
4113
|
decodeOggOpus,
|
|
4114
|
+
describeAuthMethods,
|
|
3955
4115
|
discoverLocalModels,
|
|
3956
4116
|
downmixToMono,
|
|
3957
4117
|
dualAuthProvider,
|
|
@@ -3963,6 +4123,7 @@ function createAutoUpdater(config) {
|
|
|
3963
4123
|
generatePKCE,
|
|
3964
4124
|
getAllModels,
|
|
3965
4125
|
getAppPaths,
|
|
4126
|
+
getAuthProvider,
|
|
3966
4127
|
getAuthStorageKey,
|
|
3967
4128
|
getAuthStorageKeys,
|
|
3968
4129
|
getClaudeCliUserAgent,
|