前言

之前, 我们 搭建了CPA cliproxyapi

设置了User-Agent来白嫖公益站agentrouter

最近在使用agentrouter的deepseek-v4-flash时, 总是遇到这样的报错

HTTP 400: The content[].thinking in the thinking mode must be passed back to the API.

image.webp

面向Agent分析

1. 在一个新session中, 使用agentrouter的deepseek-v4-flash, 直到报错.

用 /title 拿到这个session的ID

image.webp

  1. 搞到了一个勉强能用的 公益MiniMax-M3. 新开一个session, 用/goal模式分析出现问题的session

/goal

在这个 Session: 20260923_022641_b698c237 中, 遇到了

HTTP 400: The content[].thinking in the thinking mode must be passed back to the API.

的问题.

使用的是 CPA 提供商的 deepseek-v4-flash 模型,

这个 CPA 就运行在你自己的环境里, 你可以访问到日志.

你研究一下这个问题, 根本原因在哪里.

image.webp

面向Agent开发

3. Agent分析了一大堆. 我都看不明白. 我就假装Agent已经分析明白了. 我说,

你根据 CPA 的源码, 自己修改一份, 在你的环境上运行一个 独立的新CPA, 原有的CPA保持不动.

在这个新的CPA中, 只添加 agentrouter 提供商 的 deepseek-v4-flash 模型.

然后模拟原始出错的历史对话, 看新CPA和agentrouter搭配后, 还会不会出现 同样的问题.

image.webp

4. Agent的测试过程有些小波折, Agent拿不到原有CPA配置文件中的agentrouter的api key.

原因是 Hermes 自动对 api key啊, token啊, 密码啊, ... 这类字符串, 在读取之后, 就打码了, 不让模型看到.

你可以自己手动操作这些敏感信息. 我选择偷懒直接 关闭 Hermes 的终端输出脱敏 开关.

终端命令行

hermes config set security.redact_secrets false

也可以在~/.hermes/.env中设置

HERMES_REDACT_SECRETS=0

5. 这个新CPA跑起来之后, 我一试, 还真的能用了.

总结

代码提交Github

https://github.com/crazypeace/CLIProxyAPI/tree/for-agentrouter-d4f

发布Release

https://github.com/crazypeace/CLIProxyAPI/releases/tag/for-agentrouter-d4f

6. 再和Agent一起整理一份使用指南.

设想这样一个前提条件,

用户已经安装运行着 cpa 官方版本, 已经设置好了 agentrouter.

然后遇到了 HTTP 400: The content[].thinking in the thinking mode must be passed back to the API. 的错误

用户获得了这个 for-agentrouter-d4f 的可执行文件,

这时, 用户应该怎么做, 才能在本地运行一个可以正常使用 agentrouter 的 新的cpa

写一份工作指南.md

提交Github

https://github.com/crazypeace/CLIProxyAPI/blob/for-agentrouter-d4f/docs/agentrouter-deepseek-v4-flash-setup_CN.md

后记

我看了一下代码修改记录. 改动并不大.大概意思是 agentrouter的deepseek-v4-flash只能工作在 anthropic 模式. 所以 外部用 openai兼容格式调用CPA, CPA要转换成anthropic模式去调用agentrouter

本次开发非常粗暴, 也非常特例. 就是针对 agentrouter的deepseek-v4-flash 最近出现 HTTP 400: The content[].thinking in the thinking mode must be passed back to the API 错误的处理.

如果你有的选, 可以考虑用 claude code 调用 agentrouter的deepseek-v4-flash 
我在 NodeSeek论坛上的发贴, 有论坛成员搬运Discord上的相关用户反馈

image.webp