You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
workers-ai-provider: modelSettings not forwarded to inputs — reasoning_effort and chat_template_kwargs silently ignored #501
modelSettings passed to the provider (2nd arg of workersAi(modelId, modelSettings)) are forwarded to getRunOptions() which becomes the 3rd argument (options) of binding.run(model, inputs, options).
However, Cloudflare Workers AI parameters like reasoning_effort and chat_template_kwargs belong on the inputs level (2nd argument of binding.run()). buildRunInputs() only constructs inputs from AI SDK-mapped args (max_tokens, temperature, top_p, response_format, tools, tool_choice) and never includes anything from modelSettings.
This means these parameters are silently dropped:
constworkersAi=createWorkersAI({binding: env.AI})// reasoning_effort ends up in runOptions (3rd arg), not inputs (2nd arg)constmodel=workersAi('@cf/zai-org/glm-4.7-flash',{reasoning_effort: 'low',})// chat_template_kwargs also silently droppedconstmodel=workersAi('@cf/zai-org/glm-4.7-flash',{chat_template_kwargs: {enable_thinking: false},})
Affected parameters
From @cloudflare/workers-types (ChatCompletionsCommonOptions):
buildRunInputs() in workersai-chat-language-model.ts — hardcoded field list, no passthrough from settings
getRunOptions() in workersai-chat-language-model.ts — rest-spreads settings into options (wrong destination for these params)
Impact
GLM-4.7-flash, Kimi K2.5/K2.6, and any other reasoning model on Workers AI cannot have reasoning controlled via the provider. In our case, GLM-4.7-flash burned all 16,384 output tokens on an infinite reasoning loop because reasoning_effort: 'low' was silently ignored, causing AI_NoOutputGeneratedError after exhausting retries.
Expected behavior
reasoning_effort and chat_template_kwargs from modelSettings should be included in the inputs payload passed to binding.run().
I came across this issue when trying to disable thinking in Kimi models, once fixed it would also be nice to document in the docs as it's not mentioned currently
Activity
Specy commentedon Apr 23, 2026
I came across this issue when trying to disable thinking in Kimi models, once fixed it would also be nice to document in the docs as it's not mentioned currently
Merge pull request #504 from cloudflare/fix/workers-ai-provider-reaso…
fix(workers-ai-provider): forward reasoning_effort and chat_template_…
test(workers-ai-provider): harden reasoning passthrough edge cases
chore: downgrade reasoning passthrough changesets to patch
fix: switch llm-proxy to glm-4.7-flash with OpenAI nested tools + dis…
translation: actually disable gemma thinking (23x cheaper)