400 The content[].thinking in the thinking mode must be passed back to the API. ...
错误信息
API Error: 400 The content[].thinking in the thinking mode must be passed back to the API. (request id: 20260527210030777497548k9bs38ZD)
AI 解决方案
🔍 错误翻译
原文:
API Error: 400 The content[].thinking in the thinking mode must be passed back to the API.译文:
API错误:400 必须将思考模式中的content[].thinking(内容中的思考部分)传回给API。🎯 原因分析
这是一个API调用时的参数错误。根本原因是:在调用具有“思考模式”的AI接口时,当开启该模式后,API响应中会包含一个特殊的
thinking字段。在后续的多轮对话请求中,必须将之前返回的完整content(其中包含thinking部分)原样传回,以供API参考上下文。您的请求中可能遗漏了这个字段。💡 解决方案
请检查您发送给API的请求体,特别是
messages数组。确保在多轮对话中,您传回的助手回复(assistant message)的content字段,完整地包含了API上一次返回的所有内容,尤其是thinking对象。修复示例 (JSON):
{
"messages": [
{"role": "user", "content": "你好,我的第一个问题..."},
// ... 中间对话 ...
{
"role": "assistant",
"content": [
{
"type": "thinking",
"thinking": "用户现在问了另一个问题,我需要参考之前的思路..." // 确保此部分被传回
},
{
"type": "text",
"text": "这是上一轮助手根据思考给出的回复。"
}
]
},
{"role": "user", "content": "这是我的下一个问题。"} // 新的用户问题
]
// ... 其他参数如model等
}