
Openclaw 3.24版本接入Deepseek V4 Pro/ Flash 报错码 400即使关了reasoningfalse依然报错可能是版本太低的缘故。Thereasoning_contentin the thinking mode must be passed back to the APIopenclaw全局安装目录C:\Users\user\AppData\Roaming\npm\node_modules\openclawStep 1: 创建补丁文件在目录中新建文件deepseek-fix.mjs代码如下// DeepSeek V4 reasoning_content auto-padding patch // 在 openclaw 入口前加载此文件修复 400 错误 import { createRequire } from module; const require createRequire(import.meta.url); // 拦截 fetch — 在请求发送前补齐 reasoning_content const _fetch globalThis.fetch.bind(globalThis); globalThis.fetch async function patchedFetch(url, init {}) { const urlStr typeof url string ? url : url.href || ; const isDeepSeek urlStr.includes(api.deepseek.com); if (isDeepSeek init.body typeof init.body string) { try { const body JSON.parse(init.body); if (body.messages Array.isArray(body.messages)) { let changed false; for (const msg of body.messages) { if (msg.role assistant !(reasoning_content in msg)) { msg.reasoning_content ; changed true; } } if (changed) { init.body JSON.stringify(body); } } } catch (_) { // body 不是 JSON放行 } } return _fetch(url, init); }; console.log([deepseek-fix] Patch applied — reasoning_content auto-padding for DeepSeek V4);Step 2修改 OpenClaw 入口修改dist\index.js在文件第一行加import ../deepseek-fix.mjs;Step 3 验证重新启动 OpenClaw看到[deepseek-fix] Patch applied就说明生效了。原理拦截fetch所有发往api.deepseek.com的请求在发出前自动扫描 messagesassistant 消息缺reasoning_content就加空字符串——跟 Python 版逻辑一样换成 JS 实现。结论方法就是在主目录添加补丁引入入口文件。