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/agent-bridge/agents/[id]/detect
* Run detection probe for an agent and return { installed, version?, path? }.
* LOCAL_ONLY: registered in routeGuard.ts
*/
import { detectAgent } from "@/mitm/detection/index";
import type { AgentId } from "@/mitm/types";
import { sanitizeErrorMessage } from "@omniroute/open-sse/utils/error";
import { createErrorResponse } from "@/lib/api/errorResponse";
const VALID_IDS = new Set<AgentId>([
"antigravity",
"kiro",
"copilot",
"codex",
"cursor",
"zed",
"claude-code",
"open-code",
"trae",
]);
type Params = { params: { id: string } };
export async function GET(_request: Request, { params }: Params): Promise<Response> {
const { id } = params;
if (!VALID_IDS.has(id as AgentId)) {
return createErrorResponse({ status: 404, message: `Unknown agent id: ${id}` });
}
try {
const result = detectAgent(id as AgentId);
return Response.json({ agentId: id, ...result });
} catch (err) {
const msg = sanitizeErrorMessage(err instanceof Error ? err.message : String(err));
return createErrorResponse({ status: 500, message: msg });
}
}