From 8251e7b8fbf332d6ba6c36ef0781e69a69b448ca Mon Sep 17 00:00:00 2001 From: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com> Date: Wed, 24 Jun 2026 00:41:53 -0300 Subject: [PATCH] feat(opencode-go): advertise glm-5.2 and kimi-k2.7-code (align with official Go endpoints) (#4711) Integrated into release/v3.8.36 --- .../providers/registry/opencode/go/index.ts | 6 +++ .../opencode-go-catalog-alignment.test.ts | 45 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/unit/opencode-go-catalog-alignment.test.ts diff --git a/open-sse/config/providers/registry/opencode/go/index.ts b/open-sse/config/providers/registry/opencode/go/index.ts index 224d3deab1..b1c0b4f12e 100644 --- a/open-sse/config/providers/registry/opencode/go/index.ts +++ b/open-sse/config/providers/registry/opencode/go/index.ts @@ -13,8 +13,14 @@ export const opencode_goProvider: RegistryEntry = { authPrefix: "Bearer", defaultContextLength: 200000, models: [ + // Port from decolua/9router 8efacc11: align with official Go endpoints — + // glm-5.2 is now advertised and Kimi chat traffic must route through + // `kimi-k2.7-code` (the live API rejects the plain `kimi-k2.7` alias for + // `/chat/completions`, even though the docs config example uses it). + { id: "glm-5.2", name: "GLM-5.2" }, { id: "glm-5.1", name: "GLM-5.1" }, { id: "glm-5", name: "GLM-5" }, + { id: "kimi-k2.7-code", name: "Kimi K2.7 Code" }, { id: "kimi-k2.6", name: "Kimi K2.6" }, { id: "kimi-k2.5", name: "Kimi K2.5" }, { id: "mimo-v2.5-pro", name: "MiMo-V2.5-Pro" }, diff --git a/tests/unit/opencode-go-catalog-alignment.test.ts b/tests/unit/opencode-go-catalog-alignment.test.ts new file mode 100644 index 0000000000..dd9741a1dd --- /dev/null +++ b/tests/unit/opencode-go-catalog-alignment.test.ts @@ -0,0 +1,45 @@ +/** + * OpenCode Go model catalog alignment with the official Go docs. + * + * Port of decolua/9router 8efacc114 (thanks @nguyenha935): the official Go API + * advertises `glm-5.2` and routes Kimi chat traffic through `kimi-k2.7-code` + * (the live API rejects the plain `kimi-k2.7` alias for `/chat/completions` + * even though the public docs example uses it). OmniRoute previously shipped + * the older registry without these IDs. + */ + +import test from "node:test"; +import assert from "node:assert/strict"; + +const { opencode_goProvider } = await import( + "../../open-sse/config/providers/registry/opencode/go/index.ts" +); + +function modelIds(): string[] { + return (opencode_goProvider.models ?? []).map((m) => m.id); +} + +test("opencode-go advertises glm-5.2 (official Go endpoint addition)", () => { + assert.ok( + modelIds().includes("glm-5.2"), + `expected glm-5.2 in opencode-go catalog, got: ${modelIds().join(", ")}` + ); +}); + +test("opencode-go advertises kimi-k2.7-code (live API rejects plain kimi-k2.7 for chat)", () => { + assert.ok( + modelIds().includes("kimi-k2.7-code"), + `expected kimi-k2.7-code in opencode-go catalog, got: ${modelIds().join(", ")}` + ); +}); + +test("opencode-go preserves the pre-existing minimax-m3 and qwen routing via targetFormat=claude", () => { + // Routing through the /messages endpoint is OmniRoute's declarative + // equivalent of upstream's MESSAGES_FORMAT_MODELS set; the alignment + // change must not regress this. + const byId = new Map( + (opencode_goProvider.models ?? []).map((m) => [m.id, m as Record]) + ); + assert.equal(byId.get("minimax-m3")?.targetFormat, "claude"); + assert.equal(byId.get("qwen3.7-max")?.targetFormat, "claude"); +});