CC Switch local proxy failed while handling Codex endpoint /responses. Provider:...
错误信息
CC Switch local proxy failed while handling Codex endpoint /responses. Provider: My Codex; model: deepseek-v4-pro; upstream_status: HTTP 400; cause: invalid tool_call_id
AI 解决方案
🔍 错误分析
1. 🌐 错误翻译
原文:CC Switch local proxy failed while handling Codex endpoint /responses. Provider: My Codex; model: deepseek-v4-pro; upstream_status: HTTP 400; cause: invalid tool_call_id
译文:CC切换本地代理在处理Codex端点/responses时失败。提供商:My Codex;模型:deepseek-v4-pro;上游状态:HTTP 400;原因:无效的tool_call_id
2. 🎯 原因分析
tool_call_id)无效或格式错误/responses端点时,工具调用相关参数不符合要求3. 💡 解决方案
检查工具调用参数的完整性,确保
tool_call_id符合API规范:// 正确的工具调用参数示例
const toolCall = {
// 确保tool_call_id是API要求的格式(通常是UUID或特定字符串格式)
tool_call_id: 'call_' + generateUniqueId(), // 使用符合规范的ID生成方式
// 其他必需参数
arguments: {
// 实际工具参数
},
// 完整的工具调用结构
type: 'function',
name: 'your_tool_name',
// 确保所有必需字段都正确提供
};
// 发送请求前验证参数格式
const response = await callCodexEndpoint({
endpoint: '/responses',
provider: 'My Codex',
model: 'deepseek-v4-pro',
toolCall // 确保结构完整
});
如果使用了现成库,检查参数映射是否正确:
// 使用官方SDK时的正确调用方式
const result = await codexClient.responses.create({
model: 'deepseek-v4-pro',
tools: [
{
type: 'function',
function: {
name: 'your_function',
parameters: { /* 参数定义 */ }
}
}
],
// 确保工具调用ID由SDK自动管理
tool_calls: [{ id: 'valid_tool_call_id' }] // 或使用SDK生成的ID
});
4. 🛡️ 预防措施
tool_call_id格式,确保符合目标API规范(通常为call_xxxxxx格式)