diff --git a/packages/core/src/variant.ts b/packages/core/src/variant.ts index 4f3cb4e3cef..75731437bd6 100644 --- a/packages/core/src/variant.ts +++ b/packages/core/src/variant.ts @@ -79,6 +79,17 @@ const openaiChat: Protocol = (_, support) => { return efforts(support.values ?? EFFORTS, (effort) => ({ settings: { reasoningEffort: effort } })) } +// Vertex MaaS models switch thinking through the chat template. DeepSeek names the flag `thinking`; the +// others (GLM, Gemma) use `enable_thinking`. +const vertexChat: Protocol = (model, support) => { + if (support.type !== "toggle") return openaiChat(model, support) + const key = modelID(model).toLowerCase().includes("deepseek") ? "thinking" : "enable_thinking" + return toggle( + { body: { chat_template_kwargs: { [key]: false } } }, + { body: { chat_template_kwargs: { [key]: true } } }, + ) +} + const openaiResponses: Protocol = (_, support) => { if (support.type !== "effort") return [] return efforts(support.values ?? ["none", "minimal", ...EFFORTS, "xhigh"], responsesEffort) @@ -576,7 +587,7 @@ const PROTOCOLS: Readonly> = { "@opencode/ai/providers/openai-compatible": openaiCompatible, "@opencode/ai/providers/azure/chat": openaiChat, - "@opencode/ai/providers/google-vertex/chat": openaiChat, + "@opencode/ai/providers/google-vertex/chat": vertexChat, "@opencode/ai/providers/alibaba/chat": alibabaChat, "@opencode/ai/providers/baseten": basetenChat, "@opencode/ai/providers/cerebras": openaiChat,