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
"use server";
import { NextResponse } from "next/server";
import { requireCliToolsAuth } from "@/lib/api/requireCliToolsAuth";
import {
CLI_TOOL_IDS,
getCliPrimaryConfigPath,
getCliRuntimeStatus,
} from "@/shared/services/cliRuntime";
export async function GET(request, { params }) {
const authError = await requireCliToolsAuth(request);
if (authError) return authError;
try {
const { toolId } = await params;
const normalizedToolId = String(toolId || "")
.trim()
.toLowerCase();
if (!CLI_TOOL_IDS.includes(normalizedToolId)) {
return NextResponse.json({ error: "Unsupported CLI tool" }, { status: 404 });
}
const runtime = await getCliRuntimeStatus(normalizedToolId);
return NextResponse.json({
...runtime,
toolId: normalizedToolId,
configPath: getCliPrimaryConfigPath(normalizedToolId),
message:
runtime.reason === "not_required"
? "This integration is guide-based and does not require a local CLI binary"
: runtime.installed && runtime.runnable
? "CLI detected and runnable"
: runtime.installed
? "CLI detected but not runnable"
: "CLI not detected",
});
} catch (error) {
console.log("Error checking CLI runtime:", error);
return NextResponse.json({ error: "Failed to check CLI runtime" }, { status: 500 });
}
}