Skip to content

Commit 24df698

Browse files
committed
fix(providers): wire thinking/reasoning_effort into Z.ai requests
request.thinkingLevel and request.reasoningEffort were computed but never mapped onto the Z.ai payload, so the thinking toggle and GLM-5.2's reasoning_effort control silently no-op'd and always ran on Z.ai's server-side default instead of the user's selection.
1 parent f6c0117 commit 24df698

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

apps/sim/providers/zai/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ export const zaiProvider: ProviderConfig = {
8686
if (request.temperature !== undefined) payload.temperature = request.temperature
8787
if (request.maxTokens != null) payload.max_completion_tokens = request.maxTokens
8888

89+
// GLM's `thinking` toggle (models where `capabilities.thinking.levels` is
90+
// ['disabled', 'enabled']) maps directly to Z.ai's `thinking: { type }` request param.
91+
if (request.thinkingLevel === 'enabled' || request.thinkingLevel === 'disabled') {
92+
payload.thinking = { type: request.thinkingLevel }
93+
}
94+
95+
// GLM-5.2's `reasoningEffort` capability maps directly to Z.ai's `reasoning_effort`
96+
// request param — the only model in this catalog that documents it.
97+
if (request.reasoningEffort !== undefined && request.reasoningEffort !== 'auto') {
98+
payload.reasoning_effort = request.reasoningEffort
99+
}
100+
89101
// Z.ai's chat-completions API supports `text` and `json_object` response formats but
90102
// does not have confirmed `json_schema` support, unlike the shared OpenAI-compatible
91103
// template — request a plain JSON-object hint instead of a strict schema.

0 commit comments

Comments
 (0)