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(healthcheck): apply proxy resolution per connection in sweeping loop (#1051)

diegosouzapw3c50ffa18efd
diff --git a/src/lib/tokenHealthCheck.ts b/src/lib/tokenHealthCheck.ts
index 95a090b166..f265182205 100644
--- a/src/lib/tokenHealthCheck.ts
+++ b/src/lib/tokenHealthCheck.ts
@@ -10,7 +10,7 @@
* updates the DB, and logs the result.
*/
-import { getProviderConnections, updateProviderConnection, getSettings } from "@/lib/localDb";
+import { getProviderConnections, updateProviderConnection, getSettings, resolveProxyForConnection } from "@/lib/localDb";
import {
getAccessToken,
supportsTokenRefresh,
@@ -228,17 +228,23 @@ async function checkConnection(conn) {
};
const hideLogs = await shouldHideLogs();
- const result = await getAccessToken(conn.provider, credentials, {
- info: (tag, msg) => {
- if (!hideLogs) console.log(`${LOG_PREFIX} [${tag}] ${msg}`);
+ const proxyConfig = await resolveProxyForConnection(conn.id);
+ const result = await getAccessToken(
+ conn.provider,
+ credentials,
+ {
+ info: (tag, msg) => {
+ if (!hideLogs) console.log(`${LOG_PREFIX} [${tag}] ${msg}`);
+ },
+ warn: (tag, msg) => {
+ if (!hideLogs) console.warn(`${LOG_PREFIX} [${tag}] ${msg}`);
+ },
+ error: (tag, msg, extra) => {
+ if (!hideLogs) console.error(`${LOG_PREFIX} [${tag}] ${msg}`, extra || "");
+ },
},
- warn: (tag, msg) => {
- if (!hideLogs) console.warn(`${LOG_PREFIX} [${tag}] ${msg}`);
- },
- error: (tag, msg, extra) => {
- if (!hideLogs) console.error(`${LOG_PREFIX} [${tag}] ${msg}`, extra || "");
- },
- });
+ proxyConfig
+ );
const now = new Date().toISOString();