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 { isRoutableProviderPrefix } from "../../src/lib/ccDiscoveryAliasResolve.ts";
/**
* Regression guard for the "listed but rejected" cc-discovery alias mismatch.
*
* The /v1/models catalog mirrors `claude/<provider>/<model>` ids based purely on
* the alias gate (src/app/api/v1/models/ccAliasPredicate.ts — it does NOT consult
* any provider registry). The request path additionally required the prefix to be
* an `open-sse` REGISTRY entry or an operator-defined custom node.
*
* Enterprise-cloud providers such as `azure-ai` / `azure-openai` live in the
* provider CATALOG (src/shared/constants/providers/apikey/enterprise-cloud.ts)
* and route fine directly (`azure-ai/Phi-4` → 200), but have no `open-sse`
* registry entry. So the catalog advertised `claude/azure-ai/<model>` while the
* request path refused to strip it — the id fell through with `claude` parsed as
* the provider, and every request was routed to the Claude provider instead.
*
* These assertions pin the predicate to "can the router actually reach it",
* which is the property the catalog side already assumes.
*/
test("catalog-only enterprise-cloud providers are routable (azure-ai regression)", () => {
assert.equal(isRoutableProviderPrefix("azure-ai"), true);
assert.equal(isRoutableProviderPrefix("azure-openai"), true);
});
test("open-sse registry providers stay routable", () => {
assert.equal(isRoutableProviderPrefix("openai"), true);
assert.equal(isRoutableProviderPrefix("anthropic"), true);
});
test("provider aliases resolve too", () => {
// `azure` is the declared alias of the `azure-openai` catalog entry.
assert.equal(isRoutableProviderPrefix("azure"), true);
});
test("an unknown prefix is not routable", () => {
assert.equal(isRoutableProviderPrefix("definitely-not-a-provider-xyz"), false);
assert.equal(isRoutableProviderPrefix(""), false);
});