status_code=400, status_code=400, The `reasoning_text` in the thinking mode must...

2026年10月07日 03:04 8.18 秒 success

错误信息

status_code=400, status_code=400, The `reasoning_text` in the thinking mode must be passed back to the API. (request_id: 1f6615e9-5cae-4c72-b82c-dbaaadd6f2eb) (request id: 202610060641462939050428268d9d6hWwyXHmq)

AI 解决方案

原文:status_code=400, status_code=400, The `reasoning_text` in the thinking mode must be passed back to the API. (request_id: 1f6615e9-5cae-4c72-b82c-dbaaadd6f2eb) (request id: 202610060641462939050428268d9d6hWwyXHmq)
译文:状态码=400, 状态码=400,思考模式下的 `reasoning_text` 必须传回API。

🎯 原因分析


当使用思考模式(thinking mode)调用 API 时,API 期望收到生成过程中产生的 reasoning_text(推理文本),但客户端没有将其正确传回,导致请求被拒绝,返回 400 错误。

💡 解决方案


请确保在发起请求时,将上一次响应中的 reasoning_text 字段原样传回。

// 示例:正确的请求方式
const requestBody = {
  model: "your-model",
  messages: [
    // ... 消息列表
  ],
  // 关键:将上一次响应中的 reasoning_text 传回
  reasoning_text: previousResponse.reasoning_text  // 必须是上一次响应中返回的值
};

const response = await fetch("your-api-endpoint", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
  },
  body: JSON.stringify(requestBody)
});

🛡️ 预防措施


  • 始终保留上一次 API 响应的完整数据,确保枚举所需字段,避免遗漏。

  • 在开发阶段加入完整性校验,验证 reasoning_text 是否存在后再发起下一次请求。