前言

之前, 我们 搭建了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