@poolzin/pool-bot 2026.2.4 → 2026.2.6
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/agents/auth-profiles/profiles.js +9 -0
- package/dist/agents/auth-profiles.js +1 -1
- package/dist/agents/huggingface-models.js +166 -0
- package/dist/agents/model-auth.js +6 -0
- package/dist/agents/model-forward-compat.js +187 -0
- package/dist/agents/pi-embedded-runner/model.js +10 -56
- package/dist/browser/constants.js +1 -1
- package/dist/browser/profiles.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli/config-cli.js +17 -3
- package/dist/cli/program/register.onboard.js +38 -5
- package/dist/commands/auth-choice-options.js +71 -7
- package/dist/commands/auth-choice.apply.api-providers.js +202 -97
- package/dist/commands/auth-choice.apply.huggingface.js +130 -0
- package/dist/commands/auth-choice.apply.openrouter.js +77 -0
- package/dist/commands/auth-choice.apply.plugin-provider.js +1 -56
- package/dist/commands/auth-choice.apply.vllm.js +92 -0
- package/dist/commands/auth-choice.preferred-provider.js +10 -0
- package/dist/commands/models/auth.js +1 -58
- package/dist/commands/models/list.errors.js +14 -0
- package/dist/commands/models/list.list-command.js +32 -21
- package/dist/commands/models/list.registry.js +120 -28
- package/dist/commands/models/list.status-command.js +1 -0
- package/dist/commands/models/shared.js +14 -0
- package/dist/commands/onboard-auth.config-core.js +265 -8
- package/dist/commands/onboard-auth.credentials.js +47 -6
- package/dist/commands/onboard-auth.js +3 -3
- package/dist/commands/onboard-auth.models.js +67 -0
- package/dist/commands/onboard-custom.js +181 -70
- package/dist/commands/onboard-non-interactive/api-keys.js +10 -1
- package/dist/commands/onboard-non-interactive/local/auth-choice-inference.js +15 -7
- package/dist/commands/onboard-non-interactive/local/auth-choice.js +322 -124
- package/dist/commands/provider-auth-helpers.js +61 -0
- package/dist/commands/zai-endpoint-detect.js +97 -0
- package/dist/config/legacy.migrations.part-3.js +57 -0
- package/dist/terminal/theme.js +1 -1
- package/package.json +1 -1
|
@@ -3,15 +3,48 @@ import { buildQianfanProvider, buildXiaomiProvider, QIANFAN_DEFAULT_MODEL_ID, XI
|
|
|
3
3
|
import { buildSyntheticModelDefinition, SYNTHETIC_BASE_URL, SYNTHETIC_DEFAULT_MODEL_REF, SYNTHETIC_MODEL_CATALOG, } from "../agents/synthetic-models.js";
|
|
4
4
|
import { buildTogetherModelDefinition, TOGETHER_BASE_URL, TOGETHER_MODEL_CATALOG, } from "../agents/together-models.js";
|
|
5
5
|
import { buildVeniceModelDefinition, VENICE_BASE_URL, VENICE_DEFAULT_MODEL_REF, VENICE_MODEL_CATALOG, } from "../agents/venice-models.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { buildHuggingfaceModelDefinition, HUGGINGFACE_BASE_URL, HUGGINGFACE_MODEL_CATALOG, } from "../agents/huggingface-models.js";
|
|
7
|
+
import { CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF, HUGGINGFACE_DEFAULT_MODEL_REF, LITELLM_DEFAULT_MODEL_REF, OPENROUTER_DEFAULT_MODEL_REF, TOGETHER_DEFAULT_MODEL_REF, VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF, XIAOMI_DEFAULT_MODEL_REF, ZAI_DEFAULT_MODEL_REF, XAI_DEFAULT_MODEL_REF, NVIDIA_DEFAULT_MODEL_REF, } from "./onboard-auth.credentials.js";
|
|
8
|
+
import { buildMoonshotModelDefinition, buildNvidiaModelDefinition, buildXaiModelDefinition, buildZaiModelDefinition, resolveZaiBaseUrl, ZAI_DEFAULT_MODEL_ID, QIANFAN_BASE_URL, QIANFAN_DEFAULT_MODEL_REF, KIMI_CODING_MODEL_REF, MOONSHOT_BASE_URL, MOONSHOT_CN_BASE_URL, MOONSHOT_DEFAULT_MODEL_ID, MOONSHOT_DEFAULT_MODEL_REF, NVIDIA_BASE_URL, NVIDIA_DEFAULT_MODEL_ID, XAI_BASE_URL, XAI_DEFAULT_MODEL_ID, } from "./onboard-auth.models.js";
|
|
9
|
+
export function applyZaiProviderConfig(cfg, params) {
|
|
10
|
+
const modelId = params?.modelId?.trim() || ZAI_DEFAULT_MODEL_ID;
|
|
11
|
+
const modelRef = `zai/${modelId}`;
|
|
9
12
|
const models = { ...cfg.agents?.defaults?.models };
|
|
10
|
-
models[
|
|
11
|
-
...models[
|
|
12
|
-
alias: models[
|
|
13
|
+
models[modelRef] = {
|
|
14
|
+
...models[modelRef],
|
|
15
|
+
alias: models[modelRef]?.alias ?? "GLM",
|
|
16
|
+
};
|
|
17
|
+
const providers = { ...cfg.models?.providers };
|
|
18
|
+
const existingProvider = providers.zai;
|
|
19
|
+
const existingModels = Array.isArray(existingProvider?.models) ? existingProvider.models : [];
|
|
20
|
+
const defaultModels = [
|
|
21
|
+
buildZaiModelDefinition({ id: "glm-5" }),
|
|
22
|
+
buildZaiModelDefinition({ id: "glm-4.7" }),
|
|
23
|
+
buildZaiModelDefinition({ id: "glm-4.7-flash" }),
|
|
24
|
+
buildZaiModelDefinition({ id: "glm-4.7-flashx" }),
|
|
25
|
+
];
|
|
26
|
+
const mergedModels = [...existingModels];
|
|
27
|
+
const seen = new Set(existingModels.map((m) => m.id));
|
|
28
|
+
for (const model of defaultModels) {
|
|
29
|
+
if (!seen.has(model.id)) {
|
|
30
|
+
mergedModels.push(model);
|
|
31
|
+
seen.add(model.id);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const { apiKey: existingApiKey, ...existingProviderRest } = (existingProvider ?? {});
|
|
35
|
+
const resolvedApiKey = typeof existingApiKey === "string" ? existingApiKey : undefined;
|
|
36
|
+
const normalizedApiKey = resolvedApiKey?.trim();
|
|
37
|
+
const baseUrl = params?.endpoint
|
|
38
|
+
? resolveZaiBaseUrl(params.endpoint)
|
|
39
|
+
: (typeof existingProvider?.baseUrl === "string" ? existingProvider.baseUrl : "") ||
|
|
40
|
+
resolveZaiBaseUrl();
|
|
41
|
+
providers.zai = {
|
|
42
|
+
...existingProviderRest,
|
|
43
|
+
baseUrl,
|
|
44
|
+
api: "openai-completions",
|
|
45
|
+
...(normalizedApiKey ? { apiKey: normalizedApiKey } : {}),
|
|
46
|
+
models: mergedModels.length > 0 ? mergedModels : defaultModels,
|
|
13
47
|
};
|
|
14
|
-
const existingModel = cfg.agents?.defaults?.model;
|
|
15
48
|
return {
|
|
16
49
|
...cfg,
|
|
17
50
|
agents: {
|
|
@@ -19,13 +52,32 @@ export function applyZaiConfig(cfg) {
|
|
|
19
52
|
defaults: {
|
|
20
53
|
...cfg.agents?.defaults,
|
|
21
54
|
models,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
models: {
|
|
58
|
+
mode: cfg.models?.mode ?? "merge",
|
|
59
|
+
providers,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function applyZaiConfig(cfg, params) {
|
|
64
|
+
const modelId = params?.modelId?.trim() || ZAI_DEFAULT_MODEL_ID;
|
|
65
|
+
const modelRef = modelId === ZAI_DEFAULT_MODEL_ID ? ZAI_DEFAULT_MODEL_REF : `zai/${modelId}`;
|
|
66
|
+
const next = applyZaiProviderConfig(cfg, params);
|
|
67
|
+
const existingModel = next.agents?.defaults?.model;
|
|
68
|
+
return {
|
|
69
|
+
...next,
|
|
70
|
+
agents: {
|
|
71
|
+
...next.agents,
|
|
72
|
+
defaults: {
|
|
73
|
+
...next.agents?.defaults,
|
|
22
74
|
model: {
|
|
23
75
|
...(existingModel && "fallbacks" in existingModel
|
|
24
76
|
? {
|
|
25
77
|
fallbacks: existingModel.fallbacks,
|
|
26
78
|
}
|
|
27
79
|
: undefined),
|
|
28
|
-
primary:
|
|
80
|
+
primary: modelRef,
|
|
29
81
|
},
|
|
30
82
|
},
|
|
31
83
|
},
|
|
@@ -565,6 +617,153 @@ export function applyTogetherConfig(cfg) {
|
|
|
565
617
|
},
|
|
566
618
|
};
|
|
567
619
|
}
|
|
620
|
+
/**
|
|
621
|
+
* Apply Hugging Face (Inference Providers) provider configuration without changing the default model.
|
|
622
|
+
*/
|
|
623
|
+
export function applyHuggingfaceProviderConfig(cfg) {
|
|
624
|
+
const models = { ...cfg.agents?.defaults?.models };
|
|
625
|
+
models[HUGGINGFACE_DEFAULT_MODEL_REF] = {
|
|
626
|
+
...models[HUGGINGFACE_DEFAULT_MODEL_REF],
|
|
627
|
+
alias: models[HUGGINGFACE_DEFAULT_MODEL_REF]?.alias ?? "Hugging Face",
|
|
628
|
+
};
|
|
629
|
+
const providers = { ...cfg.models?.providers };
|
|
630
|
+
const existingProvider = providers.huggingface;
|
|
631
|
+
const existingModels = Array.isArray(existingProvider?.models) ? existingProvider.models : [];
|
|
632
|
+
const hfModels = HUGGINGFACE_MODEL_CATALOG.map(buildHuggingfaceModelDefinition);
|
|
633
|
+
const mergedModels = [
|
|
634
|
+
...existingModels,
|
|
635
|
+
...hfModels.filter((model) => !existingModels.some((existing) => existing.id === model.id)),
|
|
636
|
+
];
|
|
637
|
+
const { apiKey: existingApiKey, ...existingProviderRest } = (existingProvider ?? {});
|
|
638
|
+
const resolvedApiKey = typeof existingApiKey === "string" ? existingApiKey : undefined;
|
|
639
|
+
const normalizedApiKey = resolvedApiKey?.trim();
|
|
640
|
+
providers.huggingface = {
|
|
641
|
+
...existingProviderRest,
|
|
642
|
+
baseUrl: HUGGINGFACE_BASE_URL,
|
|
643
|
+
api: "openai-completions",
|
|
644
|
+
...(normalizedApiKey ? { apiKey: normalizedApiKey } : {}),
|
|
645
|
+
models: mergedModels.length > 0 ? mergedModels : hfModels,
|
|
646
|
+
};
|
|
647
|
+
return {
|
|
648
|
+
...cfg,
|
|
649
|
+
agents: {
|
|
650
|
+
...cfg.agents,
|
|
651
|
+
defaults: {
|
|
652
|
+
...cfg.agents?.defaults,
|
|
653
|
+
models,
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
models: {
|
|
657
|
+
mode: cfg.models?.mode ?? "merge",
|
|
658
|
+
providers,
|
|
659
|
+
},
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Apply Hugging Face provider configuration AND set Hugging Face as the default model.
|
|
664
|
+
*/
|
|
665
|
+
export function applyHuggingfaceConfig(cfg) {
|
|
666
|
+
const next = applyHuggingfaceProviderConfig(cfg);
|
|
667
|
+
const existingModel = next.agents?.defaults?.model;
|
|
668
|
+
return {
|
|
669
|
+
...next,
|
|
670
|
+
agents: {
|
|
671
|
+
...next.agents,
|
|
672
|
+
defaults: {
|
|
673
|
+
...next.agents?.defaults,
|
|
674
|
+
model: {
|
|
675
|
+
...(existingModel && "fallbacks" in existingModel
|
|
676
|
+
? {
|
|
677
|
+
fallbacks: existingModel.fallbacks,
|
|
678
|
+
}
|
|
679
|
+
: undefined),
|
|
680
|
+
primary: HUGGINGFACE_DEFAULT_MODEL_REF,
|
|
681
|
+
},
|
|
682
|
+
},
|
|
683
|
+
},
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
// ── LiteLLM ──────────────────────────────────────────────────────────
|
|
687
|
+
export const LITELLM_BASE_URL = "http://localhost:4000";
|
|
688
|
+
export const LITELLM_DEFAULT_MODEL_ID = "claude-opus-4-6";
|
|
689
|
+
const LITELLM_DEFAULT_CONTEXT_WINDOW = 128_000;
|
|
690
|
+
const LITELLM_DEFAULT_MAX_TOKENS = 8_192;
|
|
691
|
+
const LITELLM_DEFAULT_COST = {
|
|
692
|
+
input: 0,
|
|
693
|
+
output: 0,
|
|
694
|
+
cacheRead: 0,
|
|
695
|
+
cacheWrite: 0,
|
|
696
|
+
};
|
|
697
|
+
function buildLitellmModelDefinition() {
|
|
698
|
+
return {
|
|
699
|
+
id: LITELLM_DEFAULT_MODEL_ID,
|
|
700
|
+
name: "Claude Opus 4.6",
|
|
701
|
+
reasoning: true,
|
|
702
|
+
input: ["text", "image"],
|
|
703
|
+
cost: LITELLM_DEFAULT_COST,
|
|
704
|
+
contextWindow: LITELLM_DEFAULT_CONTEXT_WINDOW,
|
|
705
|
+
maxTokens: LITELLM_DEFAULT_MAX_TOKENS,
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
export function applyLitellmProviderConfig(cfg) {
|
|
709
|
+
const models = { ...cfg.agents?.defaults?.models };
|
|
710
|
+
models[LITELLM_DEFAULT_MODEL_REF] = {
|
|
711
|
+
...models[LITELLM_DEFAULT_MODEL_REF],
|
|
712
|
+
alias: models[LITELLM_DEFAULT_MODEL_REF]?.alias ?? "LiteLLM",
|
|
713
|
+
};
|
|
714
|
+
const providers = { ...cfg.models?.providers };
|
|
715
|
+
const existingProvider = providers.litellm;
|
|
716
|
+
const existingModels = Array.isArray(existingProvider?.models) ? existingProvider.models : [];
|
|
717
|
+
const defaultModel = buildLitellmModelDefinition();
|
|
718
|
+
const hasDefaultModel = existingModels.some((model) => model.id === LITELLM_DEFAULT_MODEL_ID);
|
|
719
|
+
const mergedModels = hasDefaultModel ? existingModels : [...existingModels, defaultModel];
|
|
720
|
+
const { apiKey: existingApiKey, ...existingProviderRest } = (existingProvider ?? {});
|
|
721
|
+
const resolvedBaseUrl = typeof existingProvider?.baseUrl === "string" ? existingProvider.baseUrl.trim() : "";
|
|
722
|
+
const resolvedApiKey = typeof existingApiKey === "string" ? existingApiKey : undefined;
|
|
723
|
+
const normalizedApiKey = resolvedApiKey?.trim();
|
|
724
|
+
providers.litellm = {
|
|
725
|
+
...existingProviderRest,
|
|
726
|
+
baseUrl: resolvedBaseUrl || LITELLM_BASE_URL,
|
|
727
|
+
api: "openai-completions",
|
|
728
|
+
...(normalizedApiKey ? { apiKey: normalizedApiKey } : {}),
|
|
729
|
+
models: mergedModels.length > 0 ? mergedModels : [defaultModel],
|
|
730
|
+
};
|
|
731
|
+
return {
|
|
732
|
+
...cfg,
|
|
733
|
+
agents: {
|
|
734
|
+
...cfg.agents,
|
|
735
|
+
defaults: {
|
|
736
|
+
...cfg.agents?.defaults,
|
|
737
|
+
models,
|
|
738
|
+
},
|
|
739
|
+
},
|
|
740
|
+
models: {
|
|
741
|
+
mode: cfg.models?.mode ?? "merge",
|
|
742
|
+
providers,
|
|
743
|
+
},
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
export function applyLitellmConfig(cfg) {
|
|
747
|
+
const next = applyLitellmProviderConfig(cfg);
|
|
748
|
+
const existingModel = next.agents?.defaults?.model;
|
|
749
|
+
return {
|
|
750
|
+
...next,
|
|
751
|
+
agents: {
|
|
752
|
+
...next.agents,
|
|
753
|
+
defaults: {
|
|
754
|
+
...next.agents?.defaults,
|
|
755
|
+
model: {
|
|
756
|
+
...(existingModel && "fallbacks" in existingModel
|
|
757
|
+
? {
|
|
758
|
+
fallbacks: existingModel.fallbacks,
|
|
759
|
+
}
|
|
760
|
+
: undefined),
|
|
761
|
+
primary: LITELLM_DEFAULT_MODEL_REF,
|
|
762
|
+
},
|
|
763
|
+
},
|
|
764
|
+
},
|
|
765
|
+
};
|
|
766
|
+
}
|
|
568
767
|
export function applyXaiProviderConfig(cfg) {
|
|
569
768
|
const models = { ...cfg.agents?.defaults?.models };
|
|
570
769
|
models[XAI_DEFAULT_MODEL_REF] = {
|
|
@@ -722,3 +921,61 @@ export function applyQianfanConfig(cfg) {
|
|
|
722
921
|
},
|
|
723
922
|
};
|
|
724
923
|
}
|
|
924
|
+
export function applyNvidiaProviderConfig(cfg) {
|
|
925
|
+
const models = { ...cfg.agents?.defaults?.models };
|
|
926
|
+
models[NVIDIA_DEFAULT_MODEL_REF] = {
|
|
927
|
+
...models[NVIDIA_DEFAULT_MODEL_REF],
|
|
928
|
+
alias: models[NVIDIA_DEFAULT_MODEL_REF]?.alias ?? "Nemotron",
|
|
929
|
+
};
|
|
930
|
+
const providers = { ...cfg.models?.providers };
|
|
931
|
+
const existingProvider = providers.nvidia;
|
|
932
|
+
const existingModels = Array.isArray(existingProvider?.models) ? existingProvider.models : [];
|
|
933
|
+
const defaultModel = buildNvidiaModelDefinition();
|
|
934
|
+
const hasDefaultModel = existingModels.some((model) => model.id === NVIDIA_DEFAULT_MODEL_ID);
|
|
935
|
+
const mergedModels = hasDefaultModel ? existingModels : [...existingModels, defaultModel];
|
|
936
|
+
const { apiKey: existingApiKey, ...existingProviderRest } = (existingProvider ?? {});
|
|
937
|
+
const resolvedApiKey = typeof existingApiKey === "string" ? existingApiKey : undefined;
|
|
938
|
+
const normalizedApiKey = resolvedApiKey?.trim();
|
|
939
|
+
providers.nvidia = {
|
|
940
|
+
...existingProviderRest,
|
|
941
|
+
baseUrl: NVIDIA_BASE_URL,
|
|
942
|
+
api: "openai-completions",
|
|
943
|
+
...(normalizedApiKey ? { apiKey: normalizedApiKey } : {}),
|
|
944
|
+
models: mergedModels.length > 0 ? mergedModels : [defaultModel],
|
|
945
|
+
};
|
|
946
|
+
return {
|
|
947
|
+
...cfg,
|
|
948
|
+
agents: {
|
|
949
|
+
...cfg.agents,
|
|
950
|
+
defaults: {
|
|
951
|
+
...cfg.agents?.defaults,
|
|
952
|
+
models,
|
|
953
|
+
},
|
|
954
|
+
},
|
|
955
|
+
models: {
|
|
956
|
+
mode: cfg.models?.mode ?? "merge",
|
|
957
|
+
providers,
|
|
958
|
+
},
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
export function applyNvidiaConfig(cfg) {
|
|
962
|
+
const next = applyNvidiaProviderConfig(cfg);
|
|
963
|
+
const existingModel = next.agents?.defaults?.model;
|
|
964
|
+
return {
|
|
965
|
+
...next,
|
|
966
|
+
agents: {
|
|
967
|
+
...next.agents,
|
|
968
|
+
defaults: {
|
|
969
|
+
...next.agents?.defaults,
|
|
970
|
+
model: {
|
|
971
|
+
...(existingModel && "fallbacks" in existingModel
|
|
972
|
+
? {
|
|
973
|
+
fallbacks: existingModel.fallbacks,
|
|
974
|
+
}
|
|
975
|
+
: undefined),
|
|
976
|
+
primary: NVIDIA_DEFAULT_MODEL_REF,
|
|
977
|
+
},
|
|
978
|
+
},
|
|
979
|
+
},
|
|
980
|
+
};
|
|
981
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolvePoolbotAgentDir } from "../agents/agent-paths.js";
|
|
2
2
|
import { upsertAuthProfile } from "../agents/auth-profiles.js";
|
|
3
3
|
export { CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF } from "../agents/cloudflare-ai-gateway.js";
|
|
4
|
-
export { XAI_DEFAULT_MODEL_REF } from "./onboard-auth.models.js";
|
|
4
|
+
export { XAI_DEFAULT_MODEL_REF, NVIDIA_DEFAULT_MODEL_REF } from "./onboard-auth.models.js";
|
|
5
5
|
const resolveAuthAgentDir = (agentDir) => agentDir ?? resolvePoolbotAgentDir();
|
|
6
6
|
export async function writeOAuthCredentials(provider, creds, agentDir) {
|
|
7
7
|
const email = typeof creds.email === "string" && creds.email.trim() ? creds.email.trim() : "default";
|
|
@@ -99,12 +99,15 @@ export async function setVeniceApiKey(key, agentDir) {
|
|
|
99
99
|
agentDir: resolveAuthAgentDir(agentDir),
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
-
export const ZAI_DEFAULT_MODEL_REF = "zai/glm-
|
|
102
|
+
export const ZAI_DEFAULT_MODEL_REF = "zai/glm-5";
|
|
103
103
|
export const XIAOMI_DEFAULT_MODEL_REF = "xiaomi/mimo-v2-flash";
|
|
104
104
|
export const OPENROUTER_DEFAULT_MODEL_REF = "openrouter/auto";
|
|
105
|
+
export const HUGGINGFACE_DEFAULT_MODEL_REF = "huggingface/deepseek-ai/DeepSeek-R1";
|
|
105
106
|
export const TOGETHER_DEFAULT_MODEL_REF = "together/moonshotai/Kimi-K2.5";
|
|
107
|
+
export const LITELLM_DEFAULT_MODEL_REF = "litellm/claude-opus-4-6";
|
|
106
108
|
export const VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF = "vercel-ai-gateway/anthropic/claude-opus-4.6";
|
|
107
109
|
export async function setZaiApiKey(key, agentDir) {
|
|
110
|
+
// Write to resolved agent dir so gateway finds credentials on startup.
|
|
108
111
|
upsertAuthProfile({
|
|
109
112
|
profileId: "zai:default",
|
|
110
113
|
credential: {
|
|
@@ -127,31 +130,47 @@ export async function setXiaomiApiKey(key, agentDir) {
|
|
|
127
130
|
});
|
|
128
131
|
}
|
|
129
132
|
export async function setOpenrouterApiKey(key, agentDir) {
|
|
133
|
+
// Never persist the literal "undefined" (e.g. when prompt returns undefined and caller used String(key)).
|
|
134
|
+
const safeKey = key === "undefined" ? "" : key;
|
|
130
135
|
upsertAuthProfile({
|
|
131
136
|
profileId: "openrouter:default",
|
|
132
137
|
credential: {
|
|
133
138
|
type: "api_key",
|
|
134
139
|
provider: "openrouter",
|
|
135
|
-
key,
|
|
140
|
+
key: safeKey,
|
|
136
141
|
},
|
|
137
142
|
agentDir: resolveAuthAgentDir(agentDir),
|
|
138
143
|
});
|
|
139
144
|
}
|
|
140
145
|
export async function setCloudflareAiGatewayConfig(accountId, gatewayId, apiKey, agentDir) {
|
|
146
|
+
const normalizedAccountId = accountId.trim();
|
|
147
|
+
const normalizedGatewayId = gatewayId.trim();
|
|
148
|
+
const normalizedKey = apiKey.trim();
|
|
141
149
|
upsertAuthProfile({
|
|
142
150
|
profileId: "cloudflare-ai-gateway:default",
|
|
143
151
|
credential: {
|
|
144
152
|
type: "api_key",
|
|
145
153
|
provider: "cloudflare-ai-gateway",
|
|
146
|
-
key:
|
|
154
|
+
key: normalizedKey,
|
|
147
155
|
metadata: {
|
|
148
|
-
accountId:
|
|
149
|
-
gatewayId:
|
|
156
|
+
accountId: normalizedAccountId,
|
|
157
|
+
gatewayId: normalizedGatewayId,
|
|
150
158
|
},
|
|
151
159
|
},
|
|
152
160
|
agentDir: resolveAuthAgentDir(agentDir),
|
|
153
161
|
});
|
|
154
162
|
}
|
|
163
|
+
export async function setLitellmApiKey(key, agentDir) {
|
|
164
|
+
upsertAuthProfile({
|
|
165
|
+
profileId: "litellm:default",
|
|
166
|
+
credential: {
|
|
167
|
+
type: "api_key",
|
|
168
|
+
provider: "litellm",
|
|
169
|
+
key,
|
|
170
|
+
},
|
|
171
|
+
agentDir: resolveAuthAgentDir(agentDir),
|
|
172
|
+
});
|
|
173
|
+
}
|
|
155
174
|
export async function setVercelAiGatewayApiKey(key, agentDir) {
|
|
156
175
|
upsertAuthProfile({
|
|
157
176
|
profileId: "vercel-ai-gateway:default",
|
|
@@ -185,6 +204,17 @@ export async function setTogetherApiKey(key, agentDir) {
|
|
|
185
204
|
agentDir: resolveAuthAgentDir(agentDir),
|
|
186
205
|
});
|
|
187
206
|
}
|
|
207
|
+
export async function setHuggingfaceApiKey(key, agentDir) {
|
|
208
|
+
upsertAuthProfile({
|
|
209
|
+
profileId: "huggingface:default",
|
|
210
|
+
credential: {
|
|
211
|
+
type: "api_key",
|
|
212
|
+
provider: "huggingface",
|
|
213
|
+
key,
|
|
214
|
+
},
|
|
215
|
+
agentDir: resolveAuthAgentDir(agentDir),
|
|
216
|
+
});
|
|
217
|
+
}
|
|
188
218
|
export function setQianfanApiKey(key, agentDir) {
|
|
189
219
|
upsertAuthProfile({
|
|
190
220
|
profileId: "qianfan:default",
|
|
@@ -207,3 +237,14 @@ export function setXaiApiKey(key, agentDir) {
|
|
|
207
237
|
agentDir: resolveAuthAgentDir(agentDir),
|
|
208
238
|
});
|
|
209
239
|
}
|
|
240
|
+
export function setNvidiaApiKey(key, agentDir) {
|
|
241
|
+
upsertAuthProfile({
|
|
242
|
+
profileId: "nvidia:default",
|
|
243
|
+
credential: {
|
|
244
|
+
type: "api_key",
|
|
245
|
+
provider: "nvidia",
|
|
246
|
+
key,
|
|
247
|
+
},
|
|
248
|
+
agentDir: resolveAuthAgentDir(agentDir),
|
|
249
|
+
});
|
|
250
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { SYNTHETIC_DEFAULT_MODEL_ID, SYNTHETIC_DEFAULT_MODEL_REF, } from "../agents/synthetic-models.js";
|
|
2
2
|
export { VENICE_DEFAULT_MODEL_ID, VENICE_DEFAULT_MODEL_REF } from "../agents/venice-models.js";
|
|
3
|
-
export { applyAuthProfileConfig, applyCloudflareAiGatewayConfig, applyCloudflareAiGatewayProviderConfig, applyQianfanConfig, applyQianfanProviderConfig, applyKimiCodeConfig, applyKimiCodeProviderConfig, applyMoonshotConfig, applyMoonshotConfigCn, applyMoonshotProviderConfig, applyMoonshotProviderConfigCn, applyOpenrouterConfig, applyOpenrouterProviderConfig, applySyntheticConfig, applySyntheticProviderConfig, applyTogetherConfig, applyTogetherProviderConfig, applyVeniceConfig, applyVeniceProviderConfig, applyVercelAiGatewayConfig, applyVercelAiGatewayProviderConfig, applyXaiConfig, applyXaiProviderConfig, applyXiaomiConfig, applyXiaomiProviderConfig, applyZaiConfig, } from "./onboard-auth.config-core.js";
|
|
3
|
+
export { applyAuthProfileConfig, applyCloudflareAiGatewayConfig, applyCloudflareAiGatewayProviderConfig, applyHuggingfaceConfig, applyHuggingfaceProviderConfig, applyQianfanConfig, applyQianfanProviderConfig, applyKimiCodeConfig, applyKimiCodeProviderConfig, applyLitellmConfig, applyLitellmProviderConfig, LITELLM_BASE_URL, LITELLM_DEFAULT_MODEL_ID, applyMoonshotConfig, applyMoonshotConfigCn, applyMoonshotProviderConfig, applyMoonshotProviderConfigCn, applyOpenrouterConfig, applyOpenrouterProviderConfig, applySyntheticConfig, applySyntheticProviderConfig, applyTogetherConfig, applyTogetherProviderConfig, applyVeniceConfig, applyVeniceProviderConfig, applyVercelAiGatewayConfig, applyVercelAiGatewayProviderConfig, applyNvidiaConfig, applyNvidiaProviderConfig, applyXaiConfig, applyXaiProviderConfig, applyXiaomiConfig, applyXiaomiProviderConfig, applyZaiConfig, applyZaiProviderConfig, } from "./onboard-auth.config-core.js";
|
|
4
4
|
export { applyMinimaxApiConfig, applyMinimaxApiProviderConfig, applyMinimaxConfig, applyMinimaxHostedConfig, applyMinimaxHostedProviderConfig, applyMinimaxProviderConfig, } from "./onboard-auth.config-minimax.js";
|
|
5
5
|
export { applyOpencodeZenConfig, applyOpencodeZenProviderConfig, } from "./onboard-auth.config-opencode.js";
|
|
6
|
-
export { CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF, OPENROUTER_DEFAULT_MODEL_REF, setAnthropicApiKey, setCloudflareAiGatewayConfig, setQianfanApiKey, setGeminiApiKey, setKimiCodingApiKey, setMinimaxApiKey, setMoonshotApiKey, setOpencodeZenApiKey, setOpenrouterApiKey, setSyntheticApiKey, setTogetherApiKey, setVeniceApiKey, setVercelAiGatewayApiKey, setXiaomiApiKey, setZaiApiKey, setXaiApiKey, writeOAuthCredentials, VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF, XIAOMI_DEFAULT_MODEL_REF, ZAI_DEFAULT_MODEL_REF, TOGETHER_DEFAULT_MODEL_REF, XAI_DEFAULT_MODEL_REF, } from "./onboard-auth.credentials.js";
|
|
7
|
-
export { buildMinimaxApiModelDefinition, buildMinimaxModelDefinition, buildMoonshotModelDefinition, DEFAULT_MINIMAX_BASE_URL, MOONSHOT_CN_BASE_URL, QIANFAN_BASE_URL, QIANFAN_DEFAULT_MODEL_ID, QIANFAN_DEFAULT_MODEL_REF, KIMI_CODING_MODEL_ID, KIMI_CODING_MODEL_REF, MINIMAX_API_BASE_URL, MINIMAX_HOSTED_MODEL_ID, MINIMAX_HOSTED_MODEL_REF, MOONSHOT_BASE_URL, MOONSHOT_DEFAULT_MODEL_ID, MOONSHOT_DEFAULT_MODEL_REF, } from "./onboard-auth.models.js";
|
|
6
|
+
export { CLOUDFLARE_AI_GATEWAY_DEFAULT_MODEL_REF, HUGGINGFACE_DEFAULT_MODEL_REF, LITELLM_DEFAULT_MODEL_REF, OPENROUTER_DEFAULT_MODEL_REF, setAnthropicApiKey, setCloudflareAiGatewayConfig, setQianfanApiKey, setGeminiApiKey, setHuggingfaceApiKey, setKimiCodingApiKey, setLitellmApiKey, setMinimaxApiKey, setMoonshotApiKey, setOpencodeZenApiKey, setOpenrouterApiKey, setSyntheticApiKey, setTogetherApiKey, setVeniceApiKey, setVercelAiGatewayApiKey, setXiaomiApiKey, setZaiApiKey, setNvidiaApiKey, setXaiApiKey, writeOAuthCredentials, VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF, NVIDIA_DEFAULT_MODEL_REF, XIAOMI_DEFAULT_MODEL_REF, ZAI_DEFAULT_MODEL_REF, TOGETHER_DEFAULT_MODEL_REF, XAI_DEFAULT_MODEL_REF, } from "./onboard-auth.credentials.js";
|
|
7
|
+
export { buildMinimaxApiModelDefinition, buildMinimaxModelDefinition, buildMoonshotModelDefinition, buildZaiModelDefinition, DEFAULT_MINIMAX_BASE_URL, MOONSHOT_CN_BASE_URL, QIANFAN_BASE_URL, QIANFAN_DEFAULT_MODEL_ID, QIANFAN_DEFAULT_MODEL_REF, KIMI_CODING_MODEL_ID, KIMI_CODING_MODEL_REF, MINIMAX_API_BASE_URL, MINIMAX_HOSTED_MODEL_ID, MINIMAX_HOSTED_MODEL_REF, MOONSHOT_BASE_URL, MOONSHOT_DEFAULT_MODEL_ID, MOONSHOT_DEFAULT_MODEL_REF, buildNvidiaModelDefinition, NVIDIA_BASE_URL, NVIDIA_DEFAULT_MODEL_ID, resolveZaiBaseUrl, ZAI_CODING_CN_BASE_URL, ZAI_DEFAULT_MODEL_ID, ZAI_CODING_GLOBAL_BASE_URL, ZAI_CN_BASE_URL, ZAI_GLOBAL_BASE_URL, } from "./onboard-auth.models.js";
|
|
@@ -15,6 +15,25 @@ export const KIMI_CODING_MODEL_ID = "k2p5";
|
|
|
15
15
|
export const KIMI_CODING_MODEL_REF = `kimi-coding/${KIMI_CODING_MODEL_ID}`;
|
|
16
16
|
export { QIANFAN_BASE_URL, QIANFAN_DEFAULT_MODEL_ID };
|
|
17
17
|
export const QIANFAN_DEFAULT_MODEL_REF = `qianfan/${QIANFAN_DEFAULT_MODEL_ID}`;
|
|
18
|
+
export const ZAI_CODING_GLOBAL_BASE_URL = "https://api.z.ai/api/coding/paas/v4";
|
|
19
|
+
export const ZAI_CODING_CN_BASE_URL = "https://open.bigmodel.cn/api/coding/paas/v4";
|
|
20
|
+
export const ZAI_GLOBAL_BASE_URL = "https://api.z.ai/api/paas/v4";
|
|
21
|
+
export const ZAI_CN_BASE_URL = "https://open.bigmodel.cn/api/paas/v4";
|
|
22
|
+
export const ZAI_DEFAULT_MODEL_ID = "glm-5";
|
|
23
|
+
export function resolveZaiBaseUrl(endpoint) {
|
|
24
|
+
switch (endpoint) {
|
|
25
|
+
case "coding-cn":
|
|
26
|
+
return ZAI_CODING_CN_BASE_URL;
|
|
27
|
+
case "global":
|
|
28
|
+
return ZAI_GLOBAL_BASE_URL;
|
|
29
|
+
case "cn":
|
|
30
|
+
return ZAI_CN_BASE_URL;
|
|
31
|
+
case "coding-global":
|
|
32
|
+
return ZAI_CODING_GLOBAL_BASE_URL;
|
|
33
|
+
default:
|
|
34
|
+
return ZAI_GLOBAL_BASE_URL;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
18
37
|
// Pricing: MiniMax doesn't publish public rates. Override in models.json for accurate costs.
|
|
19
38
|
export const MINIMAX_API_COST = {
|
|
20
39
|
input: 15,
|
|
@@ -40,12 +59,26 @@ export const MOONSHOT_DEFAULT_COST = {
|
|
|
40
59
|
cacheRead: 0,
|
|
41
60
|
cacheWrite: 0,
|
|
42
61
|
};
|
|
62
|
+
export const ZAI_DEFAULT_COST = {
|
|
63
|
+
input: 0,
|
|
64
|
+
output: 0,
|
|
65
|
+
cacheRead: 0,
|
|
66
|
+
cacheWrite: 0,
|
|
67
|
+
};
|
|
43
68
|
const MINIMAX_MODEL_CATALOG = {
|
|
44
69
|
"MiniMax-M2.1": { name: "MiniMax M2.1", reasoning: false },
|
|
45
70
|
"MiniMax-M2.1-lightning": {
|
|
46
71
|
name: "MiniMax M2.1 Lightning",
|
|
47
72
|
reasoning: false,
|
|
48
73
|
},
|
|
74
|
+
"MiniMax-M2.5": { name: "MiniMax M2.5", reasoning: true },
|
|
75
|
+
"MiniMax-M2.5-Lightning": { name: "MiniMax M2.5 Lightning", reasoning: true },
|
|
76
|
+
};
|
|
77
|
+
const ZAI_MODEL_CATALOG = {
|
|
78
|
+
"glm-5": { name: "GLM-5", reasoning: true },
|
|
79
|
+
"glm-4.7": { name: "GLM-4.7", reasoning: true },
|
|
80
|
+
"glm-4.7-flash": { name: "GLM-4.7 Flash", reasoning: true },
|
|
81
|
+
"glm-4.7-flashx": { name: "GLM-4.7 FlashX", reasoning: true },
|
|
49
82
|
};
|
|
50
83
|
export function buildMinimaxModelDefinition(params) {
|
|
51
84
|
const catalog = MINIMAX_MODEL_CATALOG[params.id];
|
|
@@ -78,6 +111,18 @@ export function buildMoonshotModelDefinition() {
|
|
|
78
111
|
maxTokens: MOONSHOT_DEFAULT_MAX_TOKENS,
|
|
79
112
|
};
|
|
80
113
|
}
|
|
114
|
+
export function buildZaiModelDefinition(params) {
|
|
115
|
+
const catalog = ZAI_MODEL_CATALOG[params.id];
|
|
116
|
+
return {
|
|
117
|
+
id: params.id,
|
|
118
|
+
name: params.name ?? catalog?.name ?? `GLM ${params.id}`,
|
|
119
|
+
reasoning: params.reasoning ?? catalog?.reasoning ?? true,
|
|
120
|
+
input: ["text"],
|
|
121
|
+
cost: params.cost ?? ZAI_DEFAULT_COST,
|
|
122
|
+
contextWindow: params.contextWindow ?? 204800,
|
|
123
|
+
maxTokens: params.maxTokens ?? 131072,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
81
126
|
export const XAI_BASE_URL = "https://api.x.ai/v1";
|
|
82
127
|
export const XAI_DEFAULT_MODEL_ID = "grok-4";
|
|
83
128
|
export const XAI_DEFAULT_MODEL_REF = `xai/${XAI_DEFAULT_MODEL_ID}`;
|
|
@@ -100,3 +145,25 @@ export function buildXaiModelDefinition() {
|
|
|
100
145
|
maxTokens: XAI_DEFAULT_MAX_TOKENS,
|
|
101
146
|
};
|
|
102
147
|
}
|
|
148
|
+
export const NVIDIA_BASE_URL = "https://integrate.api.nvidia.com/v1";
|
|
149
|
+
export const NVIDIA_DEFAULT_MODEL_ID = "llama-3.1-nemotron-ultra-253b-v1";
|
|
150
|
+
export const NVIDIA_DEFAULT_MODEL_REF = `nvidia/${NVIDIA_DEFAULT_MODEL_ID}`;
|
|
151
|
+
export const NVIDIA_DEFAULT_CONTEXT_WINDOW = 131072;
|
|
152
|
+
export const NVIDIA_DEFAULT_MAX_TOKENS = 8192;
|
|
153
|
+
export const NVIDIA_DEFAULT_COST = {
|
|
154
|
+
input: 0,
|
|
155
|
+
output: 0,
|
|
156
|
+
cacheRead: 0,
|
|
157
|
+
cacheWrite: 0,
|
|
158
|
+
};
|
|
159
|
+
export function buildNvidiaModelDefinition() {
|
|
160
|
+
return {
|
|
161
|
+
id: NVIDIA_DEFAULT_MODEL_ID,
|
|
162
|
+
name: "Nemotron Ultra 253B",
|
|
163
|
+
reasoning: false,
|
|
164
|
+
input: ["text"],
|
|
165
|
+
cost: NVIDIA_DEFAULT_COST,
|
|
166
|
+
contextWindow: NVIDIA_DEFAULT_CONTEXT_WINDOW,
|
|
167
|
+
maxTokens: NVIDIA_DEFAULT_MAX_TOKENS,
|
|
168
|
+
};
|
|
169
|
+
}
|