[Bug] deepseek-v4-flash 思考模式多轮对话报 400:The `reasoning_content` in the thinking mode must be passed back to the API.
What happened / 发生了什么
在更新了v4.23.5之后,使用“deepseek-v4-flash”模型ID时会返回400报错,但降级到旧模型ID “deepseek-reasoner”后可以正常使用。
Reproduce / 如何复现?
使用v4.23.5版本,添加OpenAI格式的DeepSeek模型提供商,选择使用“deepseek-v4-flash”模型ID,我在自定义请求体参数中添加了{"reasoning_effort":"max"},不过这个自定义请求体参数可能没有什么影响。
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
v4.23.5 Linux Docker DeepSeek(OpenAI API) QQ Bot(官方)
OS
Linux
Logs / 报错日志
[2026-04-27 07:18:06.512] [Core] [WARN] [v4.23.5] [runners.tool_loop_agent_runner:555]: Chat Model deepseek/deepseek-v4-flash request error: Error code: 400 - {'error': {'message': 'The reasoning_content in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
Traceback (most recent call last):
File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 510, in _iter_llm_responses_with_fallback
async for attempt in retrying:
File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/init.py", line 170, in anext
do = await self.iter(retry_state=self._retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/init.py", line 157, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/_utils.py", line 111, in inner
return call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/tenacity/init.py", line 393, in reasoning_content in the thinking mode must be passed back to the API.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_request_error'}}
[2026-04-27 07:18:06.532] [Core] [WARN] [v4.23.5] [runners.tool_loop_agent_runner:492]: Switched from deepseek/deepseek-v4-flash to fallback chat provider: deepseek/deepseek-reasoner
Are you willing to submit a PR? / 你愿意提交 PR 吗?
- [ ] Yes!
Code of Conduct
- [x] I have read and agree to abide by the project's Code of Conduct。
Hi @LWDJD! I'm Dosu and I’m helping the AstrBot team.
这是一个已知的重复问题,与 #7782 和 #7798 相同 [1] [2]。
原因:DeepSeek API 要求多轮对话中 assistant 消息的 reasoning_content 必须原样回传,但 AstrBot 的 Message 类缺少该字段,导致构建历史消息时推理内容丢失。
修复进展:PR #7759 已提交修复,但尚未合并 [1]。此外社区讨论中还发现 fallback 到其他模型再切回 DeepSeek 时也会因"脏历史"触发同样的错误,需要额外的 sanitizer 逻辑 [2]。
临时解决:使用 /new 清除对话历史后重新开始对话,或暂时降级使用 deepseek-reasoner 模型 ID(你已经发现这个方法有效)。
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
#7823 已经修复了