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
import path from "node:path";
import os from "node:os";
let yaml: typeof import("js-yaml") | null = null;
async function loadYaml() {
if (!yaml) {
yaml = await import("js-yaml");
}
return yaml;
}
const CONFIG_PATH = path.join(os.homedir(), ".continue", "config.yaml");
export async function generateContinueConfig(options: {
baseUrl: string;
apiKey: string;
model?: string;
}): Promise<string> {
const y = await loadYaml();
let base = options.baseUrl;
let end = base.length;
while (end > 0 && base[end - 1] === "/") end--;
base = end < base.length ? base.slice(0, end) : base;
if (base.endsWith("/v1")) base = base.slice(0, -3);
const config = {
models: [
{
title: "OmniRoute",
apiKey: options.apiKey,
apiBase: `${base}/v1`,
},
],
};
return y.dump(config, { lineWidth: -1 });
}