CC Switch local proxy failed while handling Codex endpoint /responses. Provider:...
错误信息
CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DeepSeek; model: deepseek-v4-flash; upstream_status: HTTP 400; cause: The `reasoning_content` in the thinking mode must be passed back to the API.
AI 解决方案
原文:CC Switch local proxy failed while handling Codex endpoint /responses. Provider: DeepSeek; model: deepseek-v4-flash; upstream_status: HTTP 400; cause: The `reasoning_content` in the thinking mode must be passed back to the API.
译文:CC Switch 本地代理在处理 Codex 端点 /responses 时失败。提供商:DeepSeek;模型:deepseek-v4-flash;上游状态:HTTP 400;原因:思维模式下的 `reasoning_content` 必须回传给 API。
🎯 原因分析
该错误发生在思维模式(thinking mode)开启后,DeepSeek API 返回的
reasoning_content 字段未被正确透传回上游 API。具体是代理层在转发响应时,未将包含推理内容的 reasoning_content 字段包含在请求体中,导致上游服务拒绝请求并返回 HTTP 400。💡 解决方案
在代理转发请求时,确保将思维模式的推理内容一并传递:
// 原始响应中提取推理内容
const upstreamResponse = await fetchFromDeepSeek(request);
// 正确回传包含 reasoning_content 的完整请求体
const responsePayload = {
...request.body,
reasoning_content: upstreamResponse.reasoning_content, // 必须回传
messages: request.body.messages.map(msg => {
// 确保思维模式消息保留推理内容
if (msg.role === 'assistant' && msg.reasoning) {
return { ...msg, reasoning_content: msg.reasoning };
}
return msg;
}),
};
const finalResponse = await forwardToUpstream(responsePayload);
若使用 SDK 调用,确保客户端配置中启用思维模式并正确处理响应:
const result = await client.chat.completions.create({
model: 'deepseek-v4-flash',
messages: [...],
thinking: {
enabled: true,
// SDK 会自动处理 reasoning_content 的回传
}
});
// 正确提取推理内容
const reasoning = result.choices[0].message.reasoning_content;
🛡️ 预防措施
reasoning 与 reasoning_content 双向映射,避免字段名差异导致数据丢失/responses 端点的请求体 schema,确认思维模式字段已包含在契约定义中