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: route usage API quota fetches through configured proxy (#194)
diegosouzapw8dca8fba6b24
diff --git a/src/app/api/usage/[connectionId]/route.ts b/src/app/api/usage/[connectionId]/route.tsindex b374cdd6a1..9655ea3f62 100644--- a/src/app/api/usage/[connectionId]/route.ts+++ b/src/app/api/usage/[connectionId]/route.ts@@ -1,8 +1,9 @@-import { getProviderConnectionById, updateProviderConnection } from "@/lib/localDb";+import { getProviderConnectionById, updateProviderConnection, resolveProxyForConnection } from "@/lib/localDb";import { getMachineId } from "@/shared/utils/machine";import { getUsageForProvider } from "@omniroute/open-sse/services/usage.ts";import { getExecutor } from "@omniroute/open-sse/executors/index.ts";import { syncToCloud } from "@/lib/cloudSync";+import { runWithProxyContext } from "@omniroute/open-sse/utils/proxyFetch.ts";/*** Sync to cloud if enabled@@ -139,8 +140,13 @@ export async function GET(request: Request, { params }: { params: Promise<{ conn);}- // Fetch usage from provider API- const usage = await getUsageForProvider(connection);+ // Resolve proxy for this connection (key → combo → provider → global → direct)+ const proxyInfo = await resolveProxyForConnection(connectionId);++ // Fetch usage from provider API, wrapped in proxy context+ const usage = await runWithProxyContext(proxyInfo?.proxy || null, () =>+ getUsageForProvider(connection)+ );return Response.json(usage);} catch (error) {console.error("[Usage API] Error fetching usage:", error);