Skip to content

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

fix(api-bridge): make proxy timeout configurable via env

jackd1c62420bfc0
diff --git a/.env.example b/.env.example
index f136792e69..55d3ddc770 100644
--- a/.env.example
+++ b/.env.example
@@ -166,6 +166,8 @@ GEMINI_CLI_USER_AGENT=google-api-nodejs-client/9.15.1
# Timeout settings
# FETCH_TIMEOUT_MS=120000
# STREAM_IDLE_TIMEOUT_MS=60000
+# API bridge timeout for /v1 proxy requests (default: 30000)
+# API_BRIDGE_PROXY_TIMEOUT_MS=120000
# CORS configuration (default: * allows all origins)
# CORS_ORIGINS=*
diff --git a/src/lib/apiBridgeServer.ts b/src/lib/apiBridgeServer.ts
index b8786ab081..8a00b1cd86 100644
--- a/src/lib/apiBridgeServer.ts
+++ b/src/lib/apiBridgeServer.ts
@@ -2,7 +2,7 @@ import http from "node:http";
import type { IncomingMessage, ServerResponse } from "node:http";
import { getRuntimePorts } from "@/lib/runtime/ports";
-const PROXY_TIMEOUT_MS = 30_000; // 30s timeout to prevent resource exhaustion
+const PROXY_TIMEOUT_MS = Number(process.env.API_BRIDGE_PROXY_TIMEOUT_MS || "30000");
const OPENAI_COMPAT_PATHS = [
/^\/v1(?:\/|$)/,