Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,16 @@ const HOST_TO_PROVIDER: Record<string, string> = {
"api.openai.com": "openai",
"open.bigmodel.cn": "zhipuai",
"open.bigmodel.com": "zhipuai",
"coding.dashscope.aliyuncs.com": "dashscope",
// DashScope first-party coding-plan endpoint: models.dev lists every
// Qwen model under `alibaba/` — no dashscope/coding-plan provider id
// exists in the catalog, so point at the real one (#1434).
"coding.dashscope.aliyuncs.com": "alibaba",
"api.deepseek.com": "deepseek",
"api.moonshot.cn": "moonshot",
"generativelanguage.googleapis.com": "google",
"ai.comfly.org": "comfly",
// ai.comfly.org deliberately absent: a relay with no models.dev provider
// id — absent hosts take the cross-provider suffix scan (#736), which
// strictly beats a known-provider miss (#1434).
"api.minimax.chat": "minimax",
"api.minimaxi.com": "minimax",
"api.minimax.io": "minimax",
Expand Down
17 changes: 17 additions & 0 deletions tests/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ test("providerFromHost boundary-safe: unrelated hosts do not match", () => {
assert.equal(providerFromHost("evil-minimax.chat"), undefined);
});

test("dashscope coding-plan host maps to the alibaba catalog provider (#1434)", () => {
assert.equal(providerFromHost("coding.dashscope.aliyuncs.com"), "alibaba");
assert.equal(providerFromHost("evil-coding.dashscope.aliyuncs.com"), undefined);
});

test("comfly relay host is deliberately unmapped so it takes the relay scan (#1434)", () => {
assert.equal(providerFromHost("ai.comfly.org"), undefined);
});

test("peekRegistryContext returns undefined with a cold cache (never fetches)", () => {
_resetForTest();
assert.equal(peekRegistryContext("MiniMax-M2.1", "api.minimax.chat"), undefined);
Expand Down Expand Up @@ -176,3 +185,11 @@ test("bundled snapshot resolves the #736 vLLM name offline", () => {
const ctx = bundledSnapshotLookup("qwen/qwen3.8-27b");
assert.ok(typeof ctx === "number" && ctx >= 200_000, `snapshot should resolve qwen/qwen3.8-27b via alibaba/qwen3.8-27b (got ${ctx})`);
});

test("dashscope/comfly hosts reach listed Qwen windows from the bundled snapshot (#1434)", () => {
// Before #1434 both hosts mapped to provider ids absent from the catalog
// ("dashscope", "comfly"): known-provider candidates missed and the relay
// scan was skipped, so alibaba/qwen3-coder-plus was unreachable for them.
assert.equal(bundledSnapshotLookup("qwen3-coder-plus", "coding.dashscope.aliyuncs.com"), 1_048_576);
assert.equal(bundledSnapshotLookup("qwen3-coder-plus", "ai.comfly.org"), 1_048_576);
});
Loading