@@ -3,9 +3,9 @@ import type { ModelInfo } from "../model.js"
33// Opencode "Go" plan — OpenAI-compatible gateway.
44// https://opencode.ai/docs/go/ · base URL: https://opencode.ai/zen/go/v1
55//
6- // The full model list (and metadata) is fetched dynamically from
7- // `https://opencode.ai/zen/go/v1/models`, so models can be switched on the fly.
8- // The values below are only a fallback used before the live list resolves .
6+ // Model IDs are fetched dynamically from `https://opencode.ai/zen/go/v1/models`
7+ // so models can be switched on the fly. The endpoint currently omits metadata,
8+ // so Zoo Code supplies limits and capabilities from the registries below .
99export const opencodeGoDefaultModelId = "glm-5.2"
1010
1111export const opencodeGoDefaultModelInfo : ModelInfo = {
@@ -16,11 +16,36 @@ export const opencodeGoDefaultModelInfo: ModelInfo = {
1616 // Pricing is intentionally omitted: ModelInfoView renders a `0` field as "$0.00 / 1M tokens"
1717 // (implying the service is free), so we leave it unknown — consistent with the dynamically
1818 // fetched models, which also leave price fields absent. See PR #319 review.
19- description : "Opencode Go plan model. Available models and metadata are resolved dynamically from /v1/models ." ,
19+ description : "Opencode Go plan model. Model IDs are fetched dynamically; metadata uses Zoo Code's model registry ." ,
2020}
2121
2222export const OPENCODE_GO_DEFAULT_TEMPERATURE = 0
2323
24+ /**
25+ * Limits for Go models that do not yet have a full native configuration below.
26+ *
27+ * The Go `/v1/models` endpoint currently returns only model IDs, so these
28+ * values prevent newly listed models from inheriting the generic 200k context
29+ * window. Keep this table aligned with the endpoint and models.dev metadata.
30+ */
31+ export const opencodeGoModelLimits : Record < string , Pick < ModelInfo , "contextWindow" | "maxTokens" > > = {
32+ "kimi-k2.7-code" : { contextWindow : 262_144 , maxTokens : 262_144 } ,
33+ "longcat-2.0" : { contextWindow : 1_000_000 , maxTokens : 131_072 } ,
34+ "glm-5.3-flash" : { contextWindow : 1_000_000 , maxTokens : 131_072 } ,
35+ "deepseek-v4-flash-vision-exp" : { contextWindow : 1_000_000 , maxTokens : 384_000 } ,
36+ "qwen3.8-flash" : { contextWindow : 1_000_000 , maxTokens : 131_072 } ,
37+ "qwen3.5-plus" : { contextWindow : 262_144 , maxTokens : 65_536 } ,
38+ "mimo-v2-pro" : { contextWindow : 1_048_576 , maxTokens : 128_000 } ,
39+ "mimo-v2-omni" : { contextWindow : 262_144 , maxTokens : 128_000 } ,
40+ "hy4-preview" : { contextWindow : 1_024_000 , maxTokens : 64_000 } ,
41+ hy3 : { contextWindow : 256_000 , maxTokens : 64_000 } ,
42+ "hy3-preview" : { contextWindow : 256_000 , maxTokens : 64_000 } ,
43+ "gpt-5.6-luna" : { contextWindow : 1_050_000 , maxTokens : 128_000 } ,
44+ "grok-4.5" : { contextWindow : 500_000 , maxTokens : 500_000 } ,
45+ "grok-4.6" : { contextWindow : 500_000 , maxTokens : 500_000 } ,
46+ "muse-spark-1.2-contributor" : { contextWindow : 1_048_576 , maxTokens : 131_072 } ,
47+ }
48+
2449/**
2550 * Native per-model configuration for the Opencode Go plan.
2651 *
@@ -463,3 +488,11 @@ export function isOpencodeGoResponsesFormatModel(modelId: string): boolean {
463488export function getOpencodeGoModelInfo ( modelId : string ) : ModelInfo | undefined {
464489 return opencodeGoModels [ modelId ]
465490}
491+
492+ /** Returns explicit model limits when Go omits them from `/v1/models`. */
493+ export function getOpencodeGoModelLimits ( modelId : string ) : Pick < ModelInfo , "contextWindow" | "maxTokens" > | undefined {
494+ const native = getOpencodeGoModelInfo ( modelId )
495+ return native
496+ ? { contextWindow : native . contextWindow , maxTokens : native . maxTokens }
497+ : opencodeGoModelLimits [ modelId ]
498+ }
0 commit comments