[解答贴]如何在CodeX中通过CPA接入DeepSeek官方API?

先上结论: 切一个新会话即可。 历程: 今天看DeepSeek又降低了缓存读取的价格,遂萌发出直接使用DeepSeek官key来写代码的想法,使用CPA配置了DeepSeek的供应商内容之后,无论是Claude供应商还是OpenAI供应商,都会出现类似下面内容的提示: The `content[]....
[解答贴]如何在CodeX中通过CPA接入DeepSeek官方API?
[解答贴]如何在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 ,定位到这篇(无正确解答):

github.com/router-for-me/CLIProxyAPI 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" />

然而老大只表示:

image

而真正解决的帖子是makoMakoGo在下面这个帖子里说的(节选):

github.com/farion1231/cc-switch 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 Max

由此给各位佬友分享一下经验…希望大家能顺利用上DeepSeek-V4.

以上。

3 个帖子 - 2 位参与者

阅读完整话题

来源: linux.do查看原文