[解答贴]如何在CodeX中通过CPA接入DeepSeek官方API?
- 内容介绍
- 文章标签
- 相关推荐
先上结论: 切一个新会话即可。
历程: 今天看DeepSeek又降低了缓存读取的价格,遂萌发出直接使用DeepSeek官key来写代码的想法,使用CPA配置了DeepSeek的供应商内容之后,无论是Claude供应商还是OpenAI供应商,都会出现类似下面内容的提示:
The `content[].thinking` in the thinking mode must be passed back to the
API
于是乎我在CPA的issue区搜索了 codex DeepSeek ,定位到这篇(无正确解答):
DeepSeek v4 系列模型在调用工具轮次中未正确回传`reasoning_content` 导致报错
已打开 04:42AM - 24 Apr 26 UTC 已关闭 03:44AM - 26 Apr 26 UTC GD-Slime**Is it a request payload issue?** - [x] Yes, this is a request payload issue. I… am using a client/cURL to send a request payload, but I received an unexpected error. - [ ] No, it's another issue. **If it's a request payload issue, you MUST know** Our team doesn't have any GODs or ORACLEs or MIND READERs. Please make sure to attach the request log or curl payload. **Describe the bug** 使用 OpenAI 兼容格式提供商接入DeepSeek官方API. 然而, DeepSeek v4 系列模型要求必须在调用工具的轮次后回传`reasoning_content`, 否则会400报错. 当前CPA版本未实现这一功能. 见 https://api-docs.deepseek.com/zh-cn/guides/thinking_mode **CLI Type** Codex CLI **Model Name** DeepSeek v4 Series **LLM Client** Codex CLI **Request Information** {"error":{"message":"The `reasoning_content` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}} **Expected behavior** 正常调用工具 **Screenshots** <img width="566" height="193" alt="Image" src="https://github.com/user-attachments/assets/b7a2eb51-7300-4f1b-b3f5-8ea4a0984745" />
然而老大只表示:
image1646×548 79.7 KB
而真正解决的帖子是makoMakoGo在下面这个帖子里说的(节选):
cc switch接deepseek V4报“API Error: 400 {"error":{"message":"The `content[].thinking` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}”
已打开 05:10AM - 24 Apr 26 UTC cl851111 bug### Self Checks / 自检 - [x] I have read the [FAQ](https://github.com/farion1231/…cc-switch#faq) section in README. 我已阅读 README 中的[常见问题](https://github.com/farion1231/cc-switch#常见问题)。 - [x] I have searched for [existing issues](https://github.com/farion1231/cc-switch/issues), including closed ones. 我已搜索过[已有的 Issue](https://github.com/farion1231/cc-switch/issues),包括已关闭的。 ### CC Switch Version / 版本号 v3.14.1 ### Operating System / 操作系统 Windows ### Related App / 涉及应用 Claude Code ### Steps to Reproduce / 重现步骤 希望能接deepseek最新模型deepseek-v4-pro ### Expected Behavior / 期望行为 希望能接deepseek最新模型deepseek-v4-pro ### Actual Behavior / 实际行为 _No response_ ### Additional Context / 补充信息 _No response_
你是不是在旧对话切换到ds了,请注意:
DeepSeek V4 thinking mode 不兼容“从其他 provider 切过来的旧 Claude Code 会话历史”。
这一刻我恍然大悟!对哦…前天DeepSeek-V4刚出的时候,在Rikkahub中调用也是发现旧窗口会报错,而新建窗口却又马上好了!
在想到这一层时,我马上在codex中新建了一个窗口测试,你猜怎么着…成了
5.4 xhigh即中转后的V4-Pro Max513×375 5.82 KB
由此给各位佬友分享一下经验…希望大家能顺利用上DeepSeek-V4.
以上。
网友解答:--【壹】--:
你的新对话只是因为最开始请求,不需要tool_calls回传,所以不报错
只要后续请求有tool_calls回传的动作,就还是报错了.
--【贰】--:
为什么要接入codex呢 个人感觉没cc好用
--【叁】--:
稍等,在实际对话后,codex中依然会报
■ {"error":{"message":"The `reasoning_content` in the thinking mode must be passed back to the
API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
请容我想想…
--【肆】--:
image1119×501 40.2 KB
反代中关闭思考就可以了
--【伍】--:
所以我现在直接在OpenCode接DeepSeek了
--【陆】--:
没搞明白…可能需要额外做插件什么的,蹲蹲看有没有佬友做插件或是中间件吧(深思)
--【柒】--:
佬 这个问题有解决办法吗 上了这么久 我还没用上ds
--【捌】--:
ds这个扩展实在是有点不合理,影响太大了
这个还只能是client侧去主动兼容这种回传,凡是当做openai api去兼容的,都会有问题
--【玖】--:
我今天在cc用opus4.7也会出现一有toolcall就立马截断不报错的情况,真是摸不着头脑
--【拾】--:
ds官方的 api 在现有的 openai 对话标准格式进行了扩展,感觉不兼容已有的 openai 生态,要额外适配
--【拾壹】--:
我也发现了,我是在codebuddy中接入的时候,调用工具就报错了
--【拾贰】--: 幻墨如烟:
请容我想想…
佬,想明白了吗?好难啊,接入后用不了 不想换Claude Code
先上结论: 切一个新会话即可。
历程: 今天看DeepSeek又降低了缓存读取的价格,遂萌发出直接使用DeepSeek官key来写代码的想法,使用CPA配置了DeepSeek的供应商内容之后,无论是Claude供应商还是OpenAI供应商,都会出现类似下面内容的提示:
The `content[].thinking` in the thinking mode must be passed back to the
API
于是乎我在CPA的issue区搜索了 codex DeepSeek ,定位到这篇(无正确解答):
DeepSeek v4 系列模型在调用工具轮次中未正确回传`reasoning_content` 导致报错
已打开 04:42AM - 24 Apr 26 UTC 已关闭 03:44AM - 26 Apr 26 UTC GD-Slime**Is it a request payload issue?** - [x] Yes, this is a request payload issue. I… am using a client/cURL to send a request payload, but I received an unexpected error. - [ ] No, it's another issue. **If it's a request payload issue, you MUST know** Our team doesn't have any GODs or ORACLEs or MIND READERs. Please make sure to attach the request log or curl payload. **Describe the bug** 使用 OpenAI 兼容格式提供商接入DeepSeek官方API. 然而, DeepSeek v4 系列模型要求必须在调用工具的轮次后回传`reasoning_content`, 否则会400报错. 当前CPA版本未实现这一功能. 见 https://api-docs.deepseek.com/zh-cn/guides/thinking_mode **CLI Type** Codex CLI **Model Name** DeepSeek v4 Series **LLM Client** Codex CLI **Request Information** {"error":{"message":"The `reasoning_content` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}} **Expected behavior** 正常调用工具 **Screenshots** <img width="566" height="193" alt="Image" src="https://github.com/user-attachments/assets/b7a2eb51-7300-4f1b-b3f5-8ea4a0984745" />
然而老大只表示:
image1646×548 79.7 KB
而真正解决的帖子是makoMakoGo在下面这个帖子里说的(节选):
cc switch接deepseek V4报“API Error: 400 {"error":{"message":"The `content[].thinking` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}”
已打开 05:10AM - 24 Apr 26 UTC cl851111 bug### Self Checks / 自检 - [x] I have read the [FAQ](https://github.com/farion1231/…cc-switch#faq) section in README. 我已阅读 README 中的[常见问题](https://github.com/farion1231/cc-switch#常见问题)。 - [x] I have searched for [existing issues](https://github.com/farion1231/cc-switch/issues), including closed ones. 我已搜索过[已有的 Issue](https://github.com/farion1231/cc-switch/issues),包括已关闭的。 ### CC Switch Version / 版本号 v3.14.1 ### Operating System / 操作系统 Windows ### Related App / 涉及应用 Claude Code ### Steps to Reproduce / 重现步骤 希望能接deepseek最新模型deepseek-v4-pro ### Expected Behavior / 期望行为 希望能接deepseek最新模型deepseek-v4-pro ### Actual Behavior / 实际行为 _No response_ ### Additional Context / 补充信息 _No response_
你是不是在旧对话切换到ds了,请注意:
DeepSeek V4 thinking mode 不兼容“从其他 provider 切过来的旧 Claude Code 会话历史”。
这一刻我恍然大悟!对哦…前天DeepSeek-V4刚出的时候,在Rikkahub中调用也是发现旧窗口会报错,而新建窗口却又马上好了!
在想到这一层时,我马上在codex中新建了一个窗口测试,你猜怎么着…成了
5.4 xhigh即中转后的V4-Pro Max513×375 5.82 KB
由此给各位佬友分享一下经验…希望大家能顺利用上DeepSeek-V4.
以上。
网友解答:--【壹】--:
你的新对话只是因为最开始请求,不需要tool_calls回传,所以不报错
只要后续请求有tool_calls回传的动作,就还是报错了.
--【贰】--:
为什么要接入codex呢 个人感觉没cc好用
--【叁】--:
稍等,在实际对话后,codex中依然会报
■ {"error":{"message":"The `reasoning_content` in the thinking mode must be passed back to the
API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
请容我想想…
--【肆】--:
image1119×501 40.2 KB
反代中关闭思考就可以了
--【伍】--:
所以我现在直接在OpenCode接DeepSeek了
--【陆】--:
没搞明白…可能需要额外做插件什么的,蹲蹲看有没有佬友做插件或是中间件吧(深思)
--【柒】--:
佬 这个问题有解决办法吗 上了这么久 我还没用上ds
--【捌】--:
ds这个扩展实在是有点不合理,影响太大了
这个还只能是client侧去主动兼容这种回传,凡是当做openai api去兼容的,都会有问题
--【玖】--:
我今天在cc用opus4.7也会出现一有toolcall就立马截断不报错的情况,真是摸不着头脑
--【拾】--:
ds官方的 api 在现有的 openai 对话标准格式进行了扩展,感觉不兼容已有的 openai 生态,要额外适配
--【拾壹】--:
我也发现了,我是在codebuddy中接入的时候,调用工具就报错了
--【拾贰】--: 幻墨如烟:
请容我想想…
佬,想明白了吗?好难啊,接入后用不了 不想换Claude Code

![[解答贴]如何在CodeX中通过CPA接入DeepSeek官方API?](/imgrand/yzSdnWXW.webp)