feat(opencode-go): advertise glm-5.2 and kimi-k2.7-code (align with official Go endpoints) (#4711)

Integrated into release/v3.8.36
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-06-24 00:41:53 -03:00
committed by GitHub
parent 7a6f43209c
commit 8251e7b8fb
2 changed files with 51 additions and 0 deletions

View File

@@ -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" },

View File

@@ -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<string, unknown>])
);
assert.equal(byId.get("minimax-m3")?.targetFormat, "claude");
assert.equal(byId.get("qwen3.7-max")?.targetFormat, "claude");
});