@exreve/exk 1.0.27 → 1.0.28

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.
@@ -134,16 +134,22 @@ const PROVIDERS = {
134
134
  models: ['glm-5.1', 'glm-4.7', 'glm-4.5-air'],
135
135
  },
136
136
  minimax: {
137
- apiKey: process.env.MINIMAX_API_KEY || '',
137
+ apiKey: '', // Populated from ai-config.json (served by backend)
138
138
  baseUrl: 'https://api.minimax.io/anthropic',
139
139
  models: ['MiniMax-M2.7', 'MiniMax-M2.7-highspeed'],
140
140
  },
141
141
  };
142
142
  /** Resolve which provider to use based on model name or explicit provider ID.
143
- * 1. If explicit providerId is given and has an API key configured, use that provider.
144
- * 2. Else if model name matches one of a provider's model list, use that provider.
145
- * 3. Else fall back to zai (default). */
143
+ * 1. Populate provider API keys from ai-config.json (served by backend).
144
+ * 2. If explicit providerId is given and has an API key configured, use that provider.
145
+ * 3. Else if model name matches one of a provider's model list, use that provider.
146
+ * 4. Else fall back to zai (default). */
146
147
  function resolveProvider(model, providerId) {
148
+ // Populate provider keys from ai-config.json
149
+ const aiConfig = loadAiConfig();
150
+ PROVIDERS.minimax.apiKey = aiConfig.minimaxApiKey || process.env.MINIMAX_API_KEY || '';
151
+ if (!PROVIDERS.zai.apiKey)
152
+ PROVIDERS.zai.apiKey = aiConfig.apiKey || '';
147
153
  // 1. Explicit provider selection
148
154
  if (providerId && PROVIDERS[providerId]?.apiKey) {
149
155
  const provider = PROVIDERS[providerId];
@@ -156,7 +162,6 @@ function resolveProvider(model, providerId) {
156
162
  }
157
163
  }
158
164
  // 3. Fallback: use ai-config.json credentials (z.ai default)
159
- const aiConfig = loadAiConfig();
160
165
  return {
161
166
  provider: 'zai',
162
167
  apiKey: aiConfig.apiKey,
@@ -172,10 +177,11 @@ function loadAiConfig() {
172
177
  const baseUrl = typeof config.baseUrl === 'string' ? config.baseUrl.trim() : '';
173
178
  const model = typeof config.model === 'string' && config.model.trim() ? config.model.trim() : DEFAULT_AI_MODEL;
174
179
  const proxy = typeof config.proxy === 'string' ? config.proxy.trim() : '';
175
- return { apiKey, baseUrl, model, proxy };
180
+ const minimaxApiKey = typeof config.minimaxApiKey === 'string' ? config.minimaxApiKey.trim() : '';
181
+ return { apiKey, baseUrl, model, proxy, minimaxApiKey };
176
182
  }
177
183
  catch {
178
- return { apiKey: '', baseUrl: '', model: DEFAULT_AI_MODEL, proxy: '' };
184
+ return { apiKey: '', baseUrl: '', model: DEFAULT_AI_MODEL, proxy: '', minimaxApiKey: '' };
179
185
  }
180
186
  }
181
187
  /** Create (or reuse) an empty directory to use as CLAUDE_CONFIG_DIR.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exreve/exk",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "exk - Control Claude CLI with voice and programmable interfaces",
5
5
  "type": "module",
6
6
  "bin": {