MCPcopy Index your code
hub / github.com/anomalyco/opencode / variants

Function variants

packages/opencode/src/provider/transform.ts:673–1073  ·  view source on GitHub ↗
(model: Provider.Model)

Source from the content-addressed store, hash-verified

671}
672
673export function variants(model: Provider.Model): Record<string, Record<string, any>> {
674 if (!model.capabilities.reasoning) return {}
675
676 const id = model.id.toLowerCase()
677 const glm52 = ["glm-5.2", "glm-5-2", "glm-5p2"].some(
678 (name) => id.includes(name) || model.api.id.toLowerCase().includes(name),
679 )
680 if (
681 model.api.id.toLowerCase().includes("minimax-m3") &&
682 ["@ai-sdk/anthropic", "@ai-sdk/openai-compatible"].includes(model.api.npm)
683 ) {
684 return {
685 none: { thinking: { type: "disabled" } },
686 thinking: { thinking: { type: "adaptive" } },
687 }
688 }
689 const adaptiveThinkingOmitted = anthropicOmitsThinking(model.api.id)
690 const adaptiveEfforts = anthropicAdaptiveEfforts(model.api.id)
691 if (glm52 && model.api.npm === "@openrouter/ai-sdk-provider") {
692 // OpenRouter maps xhigh to GLM-5.2's native max effort.
693 return {
694 high: { reasoning: { effort: "high" } },
695 xhigh: { reasoning: { effort: "xhigh" } },
696 }
697 }
698 if (glm52 && model.api.npm === "@ai-sdk/openai-compatible") {
699 return {
700 high: { reasoningEffort: "high" },
701 max: { reasoningEffort: "max" },
702 }
703 }
704 if (glm52 && model.api.npm === "@ai-sdk/anthropic") {
705 return {
706 high: { effort: "high" },
707 max: { effort: "max" },
708 }
709 }
710 if (
711 id.includes("deepseek-chat") ||
712 id.includes("deepseek-reasoner") ||
713 id.includes("deepseek-r1") ||
714 id.includes("deepseek-v3") ||
715 id.includes("minimax") ||
716 (id.includes("glm") && !glm52) ||
717 id.includes("kimi") ||
718 id.includes("k2p") ||
719 id.includes("qwen") ||
720 id.includes("big-pickle")
721 )
722 return {}
723
724 // see: https://docs.x.ai/docs/guides/reasoning#control-how-hard-the-model-thinks
725 if (id.includes("grok") && id.includes("grok-3-mini")) {
726 if (model.api.npm === "@openrouter/ai-sdk-provider") {
727 return {
728 low: { reasoning: { effort: "low" } },
729 high: { reasoning: { effort: "high" } },
730 }

Callers

nothing calls this directly

Calls 9

iifeFunction · 0.90
anthropicOmitsThinkingFunction · 0.85
anthropicAdaptiveEffortsFunction · 0.85
openaiReasoningEffortsFunction · 0.85
googleThinkingBudgetMaxFunction · 0.85
googleThinkingVariantsFunction · 0.85
wrapInSapModelParamsFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected