@exreve/exk 1.0.28 → 1.0.29
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/agentSession.js +7 -2
- package/dist/moduleMcpServer.js +2 -1
- package/dist/ttc-cli.tar.gz +0 -0
- package/package.json +1 -1
package/dist/agentSession.js
CHANGED
|
@@ -178,12 +178,17 @@ function loadAiConfig() {
|
|
|
178
178
|
const model = typeof config.model === 'string' && config.model.trim() ? config.model.trim() : DEFAULT_AI_MODEL;
|
|
179
179
|
const proxy = typeof config.proxy === 'string' ? config.proxy.trim() : '';
|
|
180
180
|
const minimaxApiKey = typeof config.minimaxApiKey === 'string' ? config.minimaxApiKey.trim() : '';
|
|
181
|
-
|
|
181
|
+
const openrouterApiKey = typeof config.openrouterApiKey === 'string' ? config.openrouterApiKey.trim() : '';
|
|
182
|
+
return { apiKey, baseUrl, model, proxy, minimaxApiKey, openrouterApiKey };
|
|
182
183
|
}
|
|
183
184
|
catch {
|
|
184
|
-
return { apiKey: '', baseUrl: '', model: DEFAULT_AI_MODEL, proxy: '', minimaxApiKey: '' };
|
|
185
|
+
return { apiKey: '', baseUrl: '', model: DEFAULT_AI_MODEL, proxy: '', minimaxApiKey: '', openrouterApiKey: '' };
|
|
185
186
|
}
|
|
186
187
|
}
|
|
188
|
+
/** Get OpenRouter API key from ai-config.json (served by backend) */
|
|
189
|
+
export function getOpenrouterApiKey() {
|
|
190
|
+
return loadAiConfig().openrouterApiKey || process.env.OPENROUTER_API_KEY || '';
|
|
191
|
+
}
|
|
187
192
|
/** Create (or reuse) an empty directory to use as CLAUDE_CONFIG_DIR.
|
|
188
193
|
* Setting this prevents the spawned Claude CLI from reading ~/.claude/settings.json,
|
|
189
194
|
* which may contain env.ANTHROPIC_BASE_URL pointing to z.ai and would override our
|
package/dist/moduleMcpServer.js
CHANGED
|
@@ -10,6 +10,7 @@ import { z } from 'zod';
|
|
|
10
10
|
import * as fs from 'fs';
|
|
11
11
|
import * as path from 'path';
|
|
12
12
|
import * as os from 'os';
|
|
13
|
+
import { getOpenrouterApiKey } from './agentSession.js';
|
|
13
14
|
/**
|
|
14
15
|
* Create a tool for the user-choice module
|
|
15
16
|
*/
|
|
@@ -99,7 +100,7 @@ function createAnalyzeImageTool(attachmentDir) {
|
|
|
99
100
|
image_path: z.string().describe('Path to the image file to analyze (can be relative to working directory, e.g. "attachments/photo.jpg")'),
|
|
100
101
|
question: z.string().describe('Question or instruction about the image. Be specific about what you want to know.'),
|
|
101
102
|
}, async (args) => {
|
|
102
|
-
const apiKey =
|
|
103
|
+
const apiKey = getOpenrouterApiKey();
|
|
103
104
|
if (!apiKey) {
|
|
104
105
|
return { content: [{ type: 'text', text: 'Error: OPENROUTER_API_KEY not configured.' }], isError: true };
|
|
105
106
|
}
|
package/dist/ttc-cli.tar.gz
CHANGED
|
Binary file
|