Skip to content

Commit 07f0966

Browse files
zoomote[bot]roomotenavedmerchant
authored andcommitted
[Fix] OpenCode Go context meter shows incorrect limits (Zoo-Code-Org#1428)
* fix(opencode-go): use explicit model limits * refactor(opencode-go): consolidate model metadata * fix(opencode-go): complete responses model metadata * fix(opencode-go): correct current model pricing * fix(opencode-go): use conservative peak pricing * fix(opencode-go): route Grok 4.5 via chat completions --------- Co-authored-by: Roomote <[email protected]> Co-authored-by: @navedmerchant <[email protected]> (cherry picked from commit cc9c0af)
1 parent 10079cb commit 07f0966

6 files changed

Lines changed: 594 additions & 23 deletions

File tree

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

Lines changed: 221 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
describe("opencode-go registry", () => {
1414
const anthropicFormatModels = [
1515
"qwen3.8-max",
16+
"qwen3.8-flash",
1617
"qwen3.7-max",
1718
"qwen3.7-plus",
1819
"qwen3.6-plus",
@@ -32,6 +33,14 @@ describe("opencode-go registry", () => {
3233
"mimo-v2.5-pro",
3334
"deepseek-v4-pro",
3435
"deepseek-v4-flash",
36+
"omen-alpha",
37+
"grok-4.5",
38+
]
39+
const responsesFormatModels = [
40+
"gpt-5.6-luna",
41+
"grok-4.6",
42+
"muse-spark-1.3-contributor",
43+
"muse-spark-1.2-contributor",
3544
]
3645

3746
describe("isOpencodeGoAnthropicFormatModel", () => {
@@ -133,11 +142,13 @@ describe("opencode-go registry", () => {
133142

134143
describe("OPENCODE_GO_RESPONSES_FORMAT_MODELS", () => {
135144
it("contains exactly the Responses-only models", () => {
136-
expect([...OPENCODE_GO_RESPONSES_FORMAT_MODELS].sort()).toEqual(["gpt-5.6-luna"])
145+
expect([...OPENCODE_GO_RESPONSES_FORMAT_MODELS].sort()).toEqual([...responsesFormatModels].sort())
137146
})
138147

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

143154
it("classifies Anthropic-format and OpenAI-compatible models as non-Responses-format", () => {
@@ -156,6 +167,7 @@ describe("opencode-go registry", () => {
156167

157168
it("curates gpt-5.6-luna with its Go Responses capabilities", () => {
158169
expect(getOpencodeGoModelInfo("gpt-5.6-luna")).toMatchObject({
170+
supportsMaxTokens: true,
159171
maxTokens: 128_000,
160172
contextWindow: 1_050_000,
161173
supportsImages: true,
@@ -184,6 +196,212 @@ describe("opencode-go registry", () => {
184196
})
185197

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

0 commit comments

Comments
 (0)