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 { test } from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname, join } from "node:path";
// Split-guard for the codex executor quota extraction.
// The pure quota-snapshot parsing + reset/cooldown scheduling lives in codex/quota.ts.
// Host re-exports the 4 public symbols for the Codex account module and tests.
const HERE = dirname(fileURLToPath(import.meta.url));
const EXE = join(HERE, "../../open-sse/executors");
const HOST = join(EXE, "codex.ts");
const LEAF = join(EXE, "codex/quota.ts");
test("leaf hosts the quota helpers and does not import the host", () => {
const src = readFileSync(LEAF, "utf8");
for (const sym of [
"parseCodexQuotaHeaders",
"getCodexResetTime",
"getCodexDualWindowCooldownMs",
"CodexQuotaSnapshot",
]) {
assert.match(src, new RegExp(`export (function|interface) ${sym}\\b`));
}
assert.doesNotMatch(src, /from "\.\.\/codex\.ts"/);
});
test("host re-exports the quota symbols for external importers", () => {
const host = readFileSync(HOST, "utf8");
assert.match(host, /from "\.\/codex\/quota\.ts"/);
});
test("parseCodexQuotaHeaders returns null without quota headers", async () => {
const { parseCodexQuotaHeaders } = await import("../../open-sse/executors/codex/quota.ts");
assert.equal(parseCodexQuotaHeaders({}), null);
});