@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.
@@ -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
- return { apiKey, baseUrl, model, proxy, minimaxApiKey };
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
@@ -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 = process.env.OPENROUTER_API_KEY || '';
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
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exreve/exk",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "exk - Control Claude CLI with voice and programmable interfaces",
5
5
  "type": "module",
6
6
  "bin": {