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
/**
* GET /api/tools/traffic-inspector/capture-modes
*
* Returns the current status of all 4 capture modes:
* 1. agentBridge — always active when the MITM server is running
* 2. customHosts — count from DB
* 3. httpProxy — running flag + port
* 4. systemProxy — applied flag + guardUntil
*
* LOCAL_ONLY enforced by routeGuard.
*/
import { buildErrorBody, sanitizeErrorMessage } from "@omniroute/open-sse/utils/error.ts";
import { listCustomHosts } from "@/lib/db/inspectorCustomHosts";
import { getHttpProxyHandle, getSystemProxyState } from "@/lib/inspector/captureState";
export async function GET(): Promise<Response> {
try {
const customHosts = listCustomHosts();
const httpProxy = getHttpProxyHandle();
const systemProxy = getSystemProxyState();
return Response.json({
agentBridge: true,
customHosts: {
count: customHosts.length,
enabledCount: customHosts.filter((h) => h.enabled).length,
},
httpProxy: {
running: httpProxy !== null,
port: httpProxy?.port ?? null,
},
systemProxy: {
applied: systemProxy.applied,
guardUntil: systemProxy.guardUntil,
port: systemProxy.port,
},
});
} catch (err) {
const msg = sanitizeErrorMessage(err);
return new Response(
JSON.stringify(buildErrorBody(500, msg || "Failed to get capture mode status")),
{ status: 500, headers: { "content-type": "application/json" } }
);
}
}