From 742b74c86f58ce9636b8df37d87a3159d5217406 Mon Sep 17 00:00:00 2001 From: ezl-keygraph Date: Sat, 21 Feb 2026 02:15:42 +0530 Subject: [PATCH] fix: pass router env vars to SDK subprocess ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN were not forwarded to the SDK subprocess environment, causing router mode to fail with "Authentication failed: Invalid API key" as the subprocess hit Anthropic directly with the placeholder key. --- src/ai/claude-executor.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ai/claude-executor.ts b/src/ai/claude-executor.ts index 3340b56..921c9a7 100644 --- a/src/ai/claude-executor.ts +++ b/src/ai/claude-executor.ts @@ -231,6 +231,12 @@ export async function runClaudePrompt( if (process.env.CLAUDE_CODE_OAUTH_TOKEN) { sdkEnv.CLAUDE_CODE_OAUTH_TOKEN = process.env.CLAUDE_CODE_OAUTH_TOKEN; } + if (process.env.ANTHROPIC_BASE_URL) { + sdkEnv.ANTHROPIC_BASE_URL = process.env.ANTHROPIC_BASE_URL; + } + if (process.env.ANTHROPIC_AUTH_TOKEN) { + sdkEnv.ANTHROPIC_AUTH_TOKEN = process.env.ANTHROPIC_AUTH_TOKEN; + } // 5. Configure SDK options const options = {