Skip to content

Commit d375cf8

Browse files
committed
fix(opencode-go): complete responses model metadata
1 parent b8142c7 commit d375cf8

5 files changed

Lines changed: 248 additions & 10 deletions

File tree

‎packages/types/src/__tests__/opencode-go.test.ts‎

Lines changed: 202 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ describe("opencode-go registry", () => {
3434
"deepseek-v4-pro",
3535
"deepseek-v4-flash",
3636
]
37+
const responsesFormatModels = [
38+
"gpt-5.6-luna",
39+
"grok-4.5",
40+
"grok-4.6",
41+
"muse-spark-1.3-contributor",
42+
"muse-spark-1.2-contributor",
43+
]
3744

3845
describe("isOpencodeGoAnthropicFormatModel", () => {
3946
it("classifies Qwen and MiniMax models as Anthropic-format", () => {
@@ -134,11 +141,13 @@ describe("opencode-go registry", () => {
134141

135142
describe("OPENCODE_GO_RESPONSES_FORMAT_MODELS", () => {
136143
it("contains exactly the Responses-only models", () => {
137-
expect([...OPENCODE_GO_RESPONSES_FORMAT_MODELS].sort()).toEqual(["gpt-5.6-luna"])
144+
expect([...OPENCODE_GO_RESPONSES_FORMAT_MODELS].sort()).toEqual([...responsesFormatModels].sort())
138145
})
139146

140-
it("classifies gpt-5.6-luna as Responses-format", () => {
141-
expect(isOpencodeGoResponsesFormatModel("gpt-5.6-luna")).toBe(true)
147+
it("classifies every Responses-only model as Responses-format", () => {
148+
for (const id of responsesFormatModels) {
149+
expect(isOpencodeGoResponsesFormatModel(id)).toBe(true)
150+
}
142151
})
143152

144153
it("classifies Anthropic-format and OpenAI-compatible models as non-Responses-format", () => {
@@ -157,6 +166,7 @@ describe("opencode-go registry", () => {
157166

158167
it("curates gpt-5.6-luna with its Go Responses capabilities", () => {
159168
expect(getOpencodeGoModelInfo("gpt-5.6-luna")).toMatchObject({
169+
supportsMaxTokens: true,
160170
maxTokens: 128_000,
161171
contextWindow: 1_050_000,
162172
supportsImages: true,
@@ -185,6 +195,195 @@ describe("opencode-go registry", () => {
185195
})
186196

187197
describe("opencodeGoModels registry invariants", () => {
198+
it.each([
199+
{
200+
id: "glm-5.3-flash",
201+
expected: {
202+
maxTokens: 131_072,
203+
contextWindow: 1_000_000,
204+
supportsImages: true,
205+
supportsPromptCache: true,
206+
supportsMaxTokens: true,
207+
supportsReasoningEffort: ["low", "high", "max"],
208+
inputPrice: 0.075,
209+
outputPrice: 0.25,
210+
cacheReadsPrice: 0.015,
211+
},
212+
},
213+
{
214+
id: "kimi-k2.7-code",
215+
expected: {
216+
maxTokens: 262_144,
217+
contextWindow: 262_144,
218+
supportsImages: true,
219+
supportsPromptCache: true,
220+
supportsMaxTokens: true,
221+
inputPrice: 0.95,
222+
outputPrice: 4,
223+
cacheReadsPrice: 0.19,
224+
},
225+
},
226+
{
227+
id: "longcat-2.0",
228+
expected: {
229+
maxTokens: 131_072,
230+
contextWindow: 1_000_000,
231+
supportsImages: false,
232+
supportsReasoningBinary: true,
233+
inputPrice: 0.3,
234+
outputPrice: 1.2,
235+
cacheReadsPrice: 0.006,
236+
},
237+
},
238+
{
239+
id: "mimo-v2-pro",
240+
expected: {
241+
maxTokens: 128_000,
242+
contextWindow: 1_048_576,
243+
supportsImages: false,
244+
supportsPromptCache: false,
245+
inputPrice: 1,
246+
outputPrice: 3,
247+
cacheReadsPrice: 0.2,
248+
longContextPricing: {
249+
thresholdTokens: 256_000,
250+
inputPriceMultiplier: 2,
251+
outputPriceMultiplier: 2,
252+
cacheReadsPriceMultiplier: 2,
253+
},
254+
},
255+
},
256+
{
257+
id: "mimo-v2-omni",
258+
expected: {
259+
maxTokens: 128_000,
260+
contextWindow: 262_144,
261+
supportsImages: true,
262+
supportsPromptCache: false,
263+
inputPrice: 0.4,
264+
outputPrice: 2,
265+
cacheReadsPrice: 0.08,
266+
},
267+
},
268+
{
269+
id: "qwen3.5-plus",
270+
expected: {
271+
maxTokens: 65_536,
272+
contextWindow: 262_144,
273+
supportsImages: true,
274+
supportsReasoningBudget: true,
275+
supportsReasoningBinary: true,
276+
inputPrice: 0.2,
277+
outputPrice: 1.2,
278+
cacheReadsPrice: 0.02,
279+
cacheWritesPrice: 0.25,
280+
},
281+
},
282+
{
283+
id: "qwen3.8-flash",
284+
expected: {
285+
maxTokens: 131_072,
286+
contextWindow: 1_000_000,
287+
supportsImages: true,
288+
supportsMaxTokens: true,
289+
supportsReasoningBudget: true,
290+
supportsReasoningBinary: true,
291+
inputPrice: 0.15,
292+
outputPrice: 0.47,
293+
cacheReadsPrice: 0.016,
294+
cacheWritesPrice: 0.2,
295+
},
296+
},
297+
{
298+
id: "deepseek-v4-flash-vision-exp",
299+
expected: {
300+
maxTokens: 384_000,
301+
contextWindow: 1_000_000,
302+
supportsImages: true,
303+
supportsReasoningEffort: ["disable", "low", "high", "max"],
304+
inputPrice: 0.22,
305+
outputPrice: 0.66,
306+
cacheReadsPrice: 0.007,
307+
},
308+
},
309+
{
310+
id: "hy4-preview",
311+
expected: {
312+
maxTokens: 64_000,
313+
contextWindow: 1_024_000,
314+
supportsImages: false,
315+
supportsReasoningEffort: ["disable", "high"],
316+
inputPrice: 0.834,
317+
outputPrice: 2.501,
318+
cacheReadsPrice: 0.042,
319+
},
320+
},
321+
...(["hy3", "hy3-preview"] as const).map((id) => ({
322+
id,
323+
expected: {
324+
maxTokens: 64_000,
325+
contextWindow: 256_000,
326+
supportsImages: false,
327+
supportsReasoningEffort: ["disable", "low", "high"],
328+
inputPrice: 0.0175,
329+
outputPrice: 0.0725,
330+
cacheReadsPrice: 0.004375,
331+
},
332+
})),
333+
{
334+
id: "grok-4.5",
335+
expected: {
336+
maxTokens: 500_000,
337+
contextWindow: 500_000,
338+
supportsImages: true,
339+
supportsReasoningEffort: ["low", "medium", "high"],
340+
inputPrice: 2,
341+
outputPrice: 6,
342+
cacheReadsPrice: 0.3,
343+
longContextPricing: {
344+
thresholdTokens: 200_000,
345+
inputPriceMultiplier: 2,
346+
outputPriceMultiplier: 2,
347+
cacheReadsPriceMultiplier: 2,
348+
},
349+
},
350+
},
351+
{
352+
id: "grok-4.6",
353+
expected: {
354+
maxTokens: 500_000,
355+
contextWindow: 500_000,
356+
supportsImages: true,
357+
supportsReasoningEffort: ["low", "medium", "high", "xhigh"],
358+
inputPrice: 2,
359+
outputPrice: 6,
360+
cacheReadsPrice: 0.5,
361+
longContextPricing: {
362+
thresholdTokens: 200_000,
363+
inputPriceMultiplier: 2,
364+
outputPriceMultiplier: 2,
365+
cacheReadsPriceMultiplier: 2,
366+
},
367+
},
368+
},
369+
...(["muse-spark-1.3-contributor", "muse-spark-1.2-contributor"] as const).map((id) => ({
370+
id,
371+
expected: {
372+
maxTokens: 131_072,
373+
contextWindow: 1_048_576,
374+
supportsImages: true,
375+
supportsPromptCache: true,
376+
supportsMaxTokens: true,
377+
supportsReasoningEffort: ["minimal", "low", "medium", "high", "xhigh"],
378+
inputPrice: 0.1,
379+
outputPrice: 0.2,
380+
cacheReadsPrice: 0.002,
381+
},
382+
})),
383+
])("keeps independently asserted metadata for $id", ({ id, expected }) => {
384+
expect(getOpencodeGoModelInfo(id)).toMatchObject(expected)
385+
})
386+
188387
it("every entry has a positive maxTokens and contextWindow", () => {
189388
for (const [id, info] of Object.entries(opencodeGoModels)) {
190389
expect(info.maxTokens).toBeGreaterThan(0)

‎packages/types/src/providers/opencode-go.ts‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,20 @@ export const opencodeGoModels: Record<string, ModelInfo> = {
595595
description:
596596
"Grok 4.6 is xAI's multimodal reasoning and agent model with a 500k context window. Available via the Opencode Go plan.",
597597
},
598+
"muse-spark-1.3-contributor": {
599+
maxTokens: 131_072,
600+
contextWindow: 1_048_576,
601+
supportsImages: true,
602+
supportsPromptCache: true,
603+
supportsMaxTokens: true,
604+
supportsReasoningEffort: ["minimal", "low", "medium", "high", "xhigh"],
605+
reasoningEffort: "medium",
606+
inputPrice: 0.1,
607+
outputPrice: 0.2,
608+
cacheReadsPrice: 0.002,
609+
description:
610+
"Muse Spark 1.3 Contributor is Meta's multimodal reasoning model for coding and agentic workflows. Available via the Opencode Go plan.",
611+
},
598612
"muse-spark-1.2-contributor": {
599613
maxTokens: 131_072,
600614
contextWindow: 1_048_576,
@@ -645,10 +659,9 @@ export const OPENCODE_GO_ANTHROPIC_FORMAT_MODELS = new Set<string>([
645659
* (`/v1/responses`), not the OpenAI-compatible Chat Completions endpoint
646660
* (`/v1/chat/completions`).
647661
*
648-
* The Go gateway maps every model to exactly one wire format. Some models
649-
* (currently only `gpt-5.6-luna`) are Responses-only and are also explicitly
650-
* curated in `opencodeGoModels`: the gateway's
651-
* `/v1/chat/completions` adapter for them fails with an opaque HTTP 500
662+
* The Go gateway maps every model to exactly one wire format. Responses-only
663+
* models are explicitly curated in `opencodeGoModels`: the gateway's
664+
* `/v1/chat/completions` adapter for these models can fail with an opaque HTTP 500
652665
* (`{"type":"error","error":{"type":"error","message":"Internal server error"}}`),
653666
* while `/v1/responses` succeeds (Zoo-Code-Org/Zoo-Code#1431).
654667
*
@@ -660,6 +673,12 @@ export const OPENCODE_GO_ANTHROPIC_FORMAT_MODELS = new Set<string>([
660673
export const OPENCODE_GO_RESPONSES_FORMAT_MODELS = new Set<string>([
661674
// --- OpenAI ---
662675
"gpt-5.6-luna",
676+
// --- xAI ---
677+
"grok-4.5",
678+
"grok-4.6",
679+
// --- Meta ---
680+
"muse-spark-1.3-contributor",
681+
"muse-spark-1.2-contributor",
663682
])
664683

665684
/**

‎src/api/providers/__tests__/opencode-go.spec.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,8 +1362,12 @@ describe("OpencodeGoHandler", () => {
13621362
}).rejects.toThrow("Opencode Go completion error: internal server error")
13631363
})
13641364

1365-
it("classifies gpt-5.6-luna as Responses-format and other models as not", () => {
1365+
it("classifies documented Responses models as Responses-format and other models as not", () => {
13661366
expect(isOpencodeGoResponsesFormatModel("gpt-5.6-luna")).toBe(true)
1367+
expect(isOpencodeGoResponsesFormatModel("grok-4.5")).toBe(true)
1368+
expect(isOpencodeGoResponsesFormatModel("grok-4.6")).toBe(true)
1369+
expect(isOpencodeGoResponsesFormatModel("muse-spark-1.3-contributor")).toBe(true)
1370+
expect(isOpencodeGoResponsesFormatModel("muse-spark-1.2-contributor")).toBe(true)
13671371
expect(isOpencodeGoResponsesFormatModel("glm-5.3")).toBe(false)
13681372
expect(isOpencodeGoResponsesFormatModel("qwen3.7-max")).toBe(false)
13691373
expect(isOpencodeGoResponsesFormatModel("some-unknown-model")).toBe(false)

‎src/api/providers/fetchers/__tests__/opencode-go.spec.ts‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ describe("Opencode Go Fetchers", () => {
9090
it("uses native model info when the endpoint returns only an OpenCode Go model ID", async () => {
9191
mockedAxios.get.mockResolvedValue({
9292
data: {
93-
data: [{ id: "gpt-5.6-luna" }, { id: "hy4-preview" }, { id: "deepseek-v4-flash-vision-exp" }],
93+
data: [
94+
{ id: "gpt-5.6-luna" },
95+
{ id: "hy4-preview" },
96+
{ id: "deepseek-v4-flash-vision-exp" },
97+
{ id: "muse-spark-1.3-contributor" },
98+
],
9499
},
95100
})
96101

@@ -102,6 +107,16 @@ describe("Opencode Go Fetchers", () => {
102107
contextWindow: 1_000_000,
103108
maxTokens: 384_000,
104109
})
110+
expect(models["muse-spark-1.3-contributor"]).toMatchObject({
111+
contextWindow: 1_048_576,
112+
maxTokens: 131_072,
113+
supportsImages: true,
114+
supportsMaxTokens: true,
115+
supportsReasoningEffort: ["minimal", "low", "medium", "high", "xhigh"],
116+
inputPrice: 0.1,
117+
outputPrice: 0.2,
118+
cacheReadsPrice: 0.002,
119+
})
105120
})
106121

107122
it("returns an empty map on network error", async () => {
@@ -172,6 +187,7 @@ describe("Opencode Go Fetchers", () => {
172187
"gpt-5.6-luna",
173188
"grok-4.5",
174189
"grok-4.6",
190+
"muse-spark-1.3-contributor",
175191
"muse-spark-1.2-contributor",
176192
]
177193
expect(Object.keys(opencodeGoModels).sort()).toEqual([...modelIds].sort())

‎src/api/providers/opencode-go.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ export class OpencodeGoHandler extends RouterProvider implements SingleCompletio
690690
* Performs a non-streaming chat completion and returns the full response text.
691691
*
692692
* Anthropic-format models are completed via the `/v1/messages` endpoint;
693-
* Responses-format models (gpt-5.6-luna) via `/v1/responses`; all other
693+
* Responses-format models via `/v1/responses`; all other
694694
* models use the OpenAI-compatible chat completions endpoint.
695695
*
696696
* @param prompt - The user prompt to send as a single user message.

0 commit comments

Comments
 (0)