Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(auth): align fallback API key format with test setup
diegosouzapwa5e32a6d3287
diff --git a/src/shared/services/apiKeyResolver.ts b/src/shared/services/apiKeyResolver.tsindex 9f14926e61..5896c385c1 100644--- a/src/shared/services/apiKeyResolver.ts+++ b/src/shared/services/apiKeyResolver.ts@@ -39,6 +39,6 @@ export async function getOrCreateApiKey(apiKeyId?: string | null): Promise<strinreturn keyRecord.key as string;} catch {// Fallback: generate a deterministic key if DB write fails- return `sk_${machineId}_fallback_${Date.now()}`;+ return `sk-${machineId}-fallback-${Date.now()}`;}}diff --git a/tests/unit/guide-settings-route.test.ts b/tests/unit/guide-settings-route.test.tsindex b0129287de..28c4debec5 100644--- a/tests/unit/guide-settings-route.test.ts+++ b/tests/unit/guide-settings-route.test.ts@@ -51,6 +51,7 @@ test.beforeEach(async () => {// Force XDG_CONFIG_HOME so resolveOpencodeConfigPath resolves to our dummy dir// (CI runners often have XDG_CONFIG_HOME set, causing path mismatch)process.env.XDG_CONFIG_HOME = path.join(DUMMY_HOME, ".config");+ process.env.API_KEY_SECRET = "test-secret";await fs.mkdir(path.dirname(QWEN_CONFIG_PATH), { recursive: true }).catch(() => {});});diff --git a/tests/unit/qwen-api-key-auto-create.test.ts b/tests/unit/qwen-api-key-auto-create.test.tsindex ba6e7ff05a..fa4f8b4816 100644--- a/tests/unit/qwen-api-key-auto-create.test.ts+++ b/tests/unit/qwen-api-key-auto-create.test.ts@@ -26,6 +26,7 @@ const originalHomedir = os.homedir;test.beforeEach(async () => {process.env.DATA_DIR = DUMMY_HOME;+ process.env.API_KEY_SECRET = "test-secret";os.homedir = () => DUMMY_HOME;await fs.mkdir(DUMMY_HOME, { recursive: true }).catch(() => {});// Initialize DB