Vendors shipped four multimodal models the registry did not carry: - glm-5.3-flash — z.ai's first natively multimodal GLM-5, 1M context, image + video + pdf input (glm, glm-cn, opencode-go) - deepseek-v4-flash-vision-exp — image input at V4-Flash text parity, 1M context / 384k output (deepseek, opencode-go) - grok-4.6, grok-4.5 — 500k context; 4.6 has no text output limit (xai) Capabilities needed hand entries because the existing globs mis-matched: *glm-5* and *deepseek-v4* carry no vision, and *grok-4* would have capped grok-4.6 at 256k instead of 500k. The grok-4.6 pattern sits above the generic *grok-4* so it wins the first-match lookup. Also corrects glm-4.6v / glm-4.5v, which were missing video input and declared no maxOutput, and backfills glm-4.6v on glm-cn — zhipuai serves it and the sibling provider already listed it. tests/unit/opencode-go-models.test.js pins the opencode-go model list, so its expected array moves with the registry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
98 lines
4.3 KiB
JavaScript
98 lines
4.3 KiB
JavaScript
import { describe, expect, it } from "vitest";
|
|
import { PROVIDER_MODELS, getModelSupportedFormats } from "../../open-sse/config/providerModels.js";
|
|
import { PROVIDERS } from "../../open-sse/config/providers.js";
|
|
import { resolveTransport } from "../../open-sse/services/provider.js";
|
|
|
|
// Chat-only models (no /messages, no /responses support on opencode-go)
|
|
const CHAT_ONLY = ["glm-5.2", "glm-5.1", "kimi-k2.7-code", "kimi-k2.6", "mimo-v2.5", "mimo-v2.5-pro"];
|
|
// Models that also expose the Anthropic /messages endpoint
|
|
const CLAUDE_CAPABLE = ["minimax-m3", "minimax-m2.7", "minimax-m2.5", "qwen3.7-max", "qwen3.7-plus", "qwen3.6-plus"];
|
|
// Models that also expose the OpenAI /responses endpoint
|
|
const RESPONSES_CAPABLE = ["deepseek-v4-pro", "deepseek-v4-flash"];
|
|
|
|
// Mirror of chatCore's per-model transport guard: use the sourceFormat-matched
|
|
// transport only when the model declares support for that sourceFormat.
|
|
function pickTransport(provider, sourceFormat, alias, model) {
|
|
const supported = getModelSupportedFormats(alias, model);
|
|
const rt = resolveTransport(provider, sourceFormat);
|
|
return supported?.includes(sourceFormat) ? rt : null;
|
|
}
|
|
|
|
describe("OpenCode Go model catalog", () => {
|
|
it("matches the documented model IDs", () => {
|
|
const ids = (PROVIDER_MODELS["opencode-go"] || []).map((m) => m.id);
|
|
expect(ids).toEqual([
|
|
"glm-5.3-flash", "glm-5.2", "glm-5.1", "kimi-k2.7-code", "kimi-k2.6",
|
|
"deepseek-v4-pro", "deepseek-v4-flash", "deepseek-v4-flash-vision-exp",
|
|
"mimo-v2.5", "mimo-v2.5-pro",
|
|
"minimax-m3", "minimax-m2.7", "minimax-m2.5",
|
|
"qwen3.7-max", "qwen3.7-plus", "qwen3.6-plus",
|
|
]);
|
|
});
|
|
});
|
|
|
|
describe("OpenCode Go per-model supportedFormats", () => {
|
|
it("declares [openai, claude] for MiniMax + Qwen models", () => {
|
|
for (const m of CLAUDE_CAPABLE) {
|
|
expect(getModelSupportedFormats("opencode-go", m)).toEqual(["openai", "claude"]);
|
|
}
|
|
});
|
|
|
|
it("declares [openai, claude, openai-responses] for DeepSeek models", () => {
|
|
for (const m of RESPONSES_CAPABLE) {
|
|
expect(getModelSupportedFormats("opencode-go", m)).toEqual(["openai", "claude", "openai-responses"]);
|
|
}
|
|
});
|
|
|
|
it("declares [openai] only for chat-only models (GLM/Kimi/MiMo) → guards /messages routing", () => {
|
|
for (const m of CHAT_ONLY) {
|
|
expect(getModelSupportedFormats("opencode-go", m)).toEqual(["openai"]);
|
|
}
|
|
});
|
|
});
|
|
|
|
describe("OpenCode Go multi-endpoint transports", () => {
|
|
it("declares openai / claude / openai-responses transports", () => {
|
|
const formats = (PROVIDERS["opencode-go"].transports || []).map((t) => t.format);
|
|
expect(formats).toEqual(["openai", "claude", "openai-responses"]);
|
|
});
|
|
|
|
it("resolveTransport picks the endpoint matching the client sourceFormat", () => {
|
|
expect(resolveTransport("opencode-go", "claude").baseUrl).toBe("https://opencode.ai/zen/go/v1/messages");
|
|
expect(resolveTransport("opencode-go", "openai-responses").baseUrl).toBe("https://opencode.ai/zen/go/v1/responses");
|
|
expect(resolveTransport("opencode-go", "openai").baseUrl).toBe("https://opencode.ai/zen/go/v1/chat/completions");
|
|
});
|
|
|
|
it("uses x-api-key + anthropicVersion on the claude transport", () => {
|
|
const t = resolveTransport("opencode-go", "claude");
|
|
expect(t.auth.header).toBe("x-api-key");
|
|
expect(t.auth.anthropicVersion).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("OpenCode Go per-model transport guard (chatCore logic)", () => {
|
|
it("routes MiniMax/Qwen + claude-format client to /messages", () => {
|
|
for (const m of CLAUDE_CAPABLE) {
|
|
expect(pickTransport("opencode-go", "claude", "opencode-go", m)?.baseUrl).toBe("https://opencode.ai/zen/go/v1/messages");
|
|
}
|
|
});
|
|
|
|
it("does NOT route chat-only models to /messages on a claude-format request", () => {
|
|
for (const m of CHAT_ONLY) {
|
|
expect(pickTransport("opencode-go", "claude", "opencode-go", m)).toBeNull();
|
|
}
|
|
});
|
|
|
|
it("routes DeepSeek + responses-format client to /responses", () => {
|
|
for (const m of RESPONSES_CAPABLE) {
|
|
expect(pickTransport("opencode-go", "openai-responses", "opencode-go", m)?.baseUrl).toBe("https://opencode.ai/zen/go/v1/responses");
|
|
}
|
|
});
|
|
|
|
it("does NOT route MiniMax (no responses support) to /responses", () => {
|
|
for (const m of CLAUDE_CAPABLE) {
|
|
expect(pickTransport("opencode-go", "openai-responses", "opencode-go", m)).toBeNull();
|
|
}
|
|
});
|
|
});
|