@poolzin/pool-bot 2026.2.5 → 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.
@@ -0,0 +1,92 @@
1
+ import { upsertAuthProfileWithLock } from "../agents/auth-profiles.js";
2
+ const VLLM_DEFAULT_BASE_URL = "http://127.0.0.1:8000/v1";
3
+ const VLLM_DEFAULT_CONTEXT_WINDOW = 128000;
4
+ const VLLM_DEFAULT_MAX_TOKENS = 8192;
5
+ const VLLM_DEFAULT_COST = {
6
+ input: 0,
7
+ output: 0,
8
+ cacheRead: 0,
9
+ cacheWrite: 0,
10
+ };
11
+ function applyVllmDefaultModel(cfg, modelRef) {
12
+ const existingModel = cfg.agents?.defaults?.model;
13
+ const fallbacks = existingModel && typeof existingModel === "object" && "fallbacks" in existingModel
14
+ ? existingModel.fallbacks
15
+ : undefined;
16
+ return {
17
+ ...cfg,
18
+ agents: {
19
+ ...cfg.agents,
20
+ defaults: {
21
+ ...cfg.agents?.defaults,
22
+ model: {
23
+ ...(fallbacks ? { fallbacks } : undefined),
24
+ primary: modelRef,
25
+ },
26
+ },
27
+ },
28
+ };
29
+ }
30
+ export async function applyAuthChoiceVllm(params) {
31
+ if (params.authChoice !== "vllm") {
32
+ return null;
33
+ }
34
+ const baseUrlRaw = await params.prompter.text({
35
+ message: "vLLM base URL",
36
+ initialValue: VLLM_DEFAULT_BASE_URL,
37
+ placeholder: VLLM_DEFAULT_BASE_URL,
38
+ validate: (value) => (value?.trim() ? undefined : "Required"),
39
+ });
40
+ const apiKeyRaw = await params.prompter.text({
41
+ message: "vLLM API key",
42
+ placeholder: "sk-... (or any non-empty string)",
43
+ validate: (value) => (value?.trim() ? undefined : "Required"),
44
+ });
45
+ const modelIdRaw = await params.prompter.text({
46
+ message: "vLLM model",
47
+ placeholder: "meta-llama/Meta-Llama-3-8B-Instruct",
48
+ validate: (value) => (value?.trim() ? undefined : "Required"),
49
+ });
50
+ const baseUrl = String(baseUrlRaw ?? "")
51
+ .trim()
52
+ .replace(/\/+$/, "");
53
+ const apiKey = String(apiKeyRaw ?? "").trim();
54
+ const modelId = String(modelIdRaw ?? "").trim();
55
+ const modelRef = `vllm/${modelId}`;
56
+ await upsertAuthProfileWithLock({
57
+ profileId: "vllm:default",
58
+ credential: { type: "api_key", provider: "vllm", key: apiKey },
59
+ agentDir: params.agentDir,
60
+ });
61
+ const nextConfig = {
62
+ ...params.config,
63
+ models: {
64
+ ...params.config.models,
65
+ mode: params.config.models?.mode ?? "merge",
66
+ providers: {
67
+ ...params.config.models?.providers,
68
+ vllm: {
69
+ baseUrl,
70
+ api: "openai-completions",
71
+ apiKey: "VLLM_API_KEY",
72
+ models: [
73
+ {
74
+ id: modelId,
75
+ name: modelId,
76
+ reasoning: false,
77
+ input: ["text"],
78
+ cost: VLLM_DEFAULT_COST,
79
+ contextWindow: VLLM_DEFAULT_CONTEXT_WINDOW,
80
+ maxTokens: VLLM_DEFAULT_MAX_TOKENS,
81
+ },
82
+ ],
83
+ },
84
+ },
85
+ },
86
+ };
87
+ if (!params.setDefaultModel) {
88
+ return { config: nextConfig, agentModelOverride: modelRef };
89
+ }
90
+ await params.prompter.note(`Default model set to ${modelRef}`, "Model configured");
91
+ return { config: applyVllmDefaultModel(nextConfig, modelRef) };
92
+ }
@@ -4,6 +4,7 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE = {
4
4
  "claude-cli": "anthropic",
5
5
  token: "anthropic",
6
6
  apiKey: "anthropic",
7
+ vllm: "vllm",
7
8
  "openai-codex": "openai-codex",
8
9
  "codex-cli": "openai-codex",
9
10
  chutes: "chutes",
@@ -18,10 +19,15 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE = {
18
19
  "google-antigravity": "google-antigravity",
19
20
  "google-gemini-cli": "google-gemini-cli",
20
21
  "zai-api-key": "zai",
22
+ "zai-coding-global": "zai",
23
+ "zai-coding-cn": "zai",
24
+ "zai-global": "zai",
25
+ "zai-cn": "zai",
21
26
  "xiaomi-api-key": "xiaomi",
22
27
  "synthetic-api-key": "synthetic",
23
28
  "venice-api-key": "venice",
24
29
  "together-api-key": "together",
30
+ "huggingface-api-key": "huggingface",
25
31
  "github-copilot": "github-copilot",
26
32
  "copilot-proxy": "copilot-proxy",
27
33
  "minimax-cloud": "minimax",
@@ -30,9 +36,12 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE = {
30
36
  minimax: "lmstudio",
31
37
  "opencode-zen": "opencode",
32
38
  "xai-api-key": "xai",
39
+ "litellm-api-key": "litellm",
33
40
  "qwen-portal": "qwen-portal",
41
+ "minimax-portal": "minimax-portal",
34
42
  "qianfan-api-key": "qianfan",
35
43
  "nvidia-api-key": "nvidia",
44
+ "custom-api-key": "custom",
36
45
  };
37
46
  export function resolvePreferredProviderForAuthChoice(choice) {
38
47
  return PREFERRED_PROVIDER_BY_AUTH_CHOICE[choice];
@@ -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 { CLOUDFLARE_AI_GATEWAY_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";
7
- import { buildMoonshotModelDefinition, buildNvidiaModelDefinition, buildXaiModelDefinition, 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";
8
- export function applyZaiConfig(cfg) {
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[ZAI_DEFAULT_MODEL_REF] = {
11
- ...models[ZAI_DEFAULT_MODEL_REF],
12
- alias: models[ZAI_DEFAULT_MODEL_REF]?.alias ?? "GLM",
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: ZAI_DEFAULT_MODEL_REF,
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] = {
@@ -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-4.7";
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: apiKey.trim(),
154
+ key: normalizedKey,
147
155
  metadata: {
148
- accountId: accountId.trim(),
149
- gatewayId: gatewayId.trim(),
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",
@@ -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, applyNvidiaConfig, applyNvidiaProviderConfig, 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, 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, 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, } 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}`;