diff options
| author | Aiden Cline <[email protected]> | 2026-01-18 14:21:08 -0600 |
|---|---|---|
| committer | Aiden Cline <[email protected]> | 2026-01-18 14:21:14 -0600 |
| commit | d841e70d2646d84c31f839e8cf7f94bc9bda66a8 (patch) | |
| tree | 2ecf3df5d04cb24bfa2fa55896e8b3eb4519039a | |
| parent | 19cf9344e12891f92662498ee2c9f132ac78480b (diff) | |
| download | opencode-d841e70d2646d84c31f839e8cf7f94bc9bda66a8.tar.gz opencode-d841e70d2646d84c31f839e8cf7f94bc9bda66a8.zip | |
fix: bad variants for grok models
| -rw-r--r-- | packages/opencode/src/provider/transform.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/packages/opencode/src/provider/transform.ts b/packages/opencode/src/provider/transform.ts index 79892db4c..b803bd66c 100644 --- a/packages/opencode/src/provider/transform.ts +++ b/packages/opencode/src/provider/transform.ts @@ -325,9 +325,24 @@ export namespace ProviderTransform { const id = model.id.toLowerCase() if (id.includes("deepseek") || id.includes("minimax") || id.includes("glm") || id.includes("mistral")) return {} + // see: https://docs.x.ai/docs/guides/reasoning#control-how-hard-the-model-thinks + if (id.includes("grok") && id.includes("grok-3-mini")) { + if (model.api.npm === "@openrouter/ai-sdk-provider") { + return { + low: { reasoning: { effort: "low" } }, + high: { reasoning: { effort: "high" } }, + } + } + return { + low: { reasoningEffort: "low" }, + high: { reasoningEffort: "high" }, + } + } + if (id.includes("grok")) return {} + switch (model.api.npm) { case "@openrouter/ai-sdk-provider": - if (!model.id.includes("gpt") && !model.id.includes("gemini-3") && !model.id.includes("grok-4")) return {} + if (!model.id.includes("gpt") && !model.id.includes("gemini-3")) return {} return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }])) // TODO: YOU CANNOT SET max_tokens if this is set!!! |
