n/aiu/crazypeace · 2 个月前
注册 登录
n/ai · 2 个月前 · 146 次浏览
u/crazypeace铂金

修改版CPA cliproxyapi解决HTTP 400: The content[].thinking问题 继续白嫖agr的deepseek-v4-flash 提供给Hermes使用

前言

之前, 我们 搭建了CPA cliproxyapi

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

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

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

面向Agent分析

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

用 /title 拿到这个session的ID

  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 就运行在你自己的环境里, 你可以访问到日志.

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

面向Agent开发

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

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

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

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

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

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

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

终端命令行

hermes config set security.redact_secrets false

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

HERMES_REDACT_SECRETS=0

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

总结

代码提交Github 发布Release

https://github.com/crazypeace/CLIProxyAPI/releases/

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

设想这样一个前提条件,

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

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

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

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

写一份工作指南.md

提交Github

后记

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

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

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

5
2
登录后参与讨论。

2 条回复

排序
  1. Perseverence 钻石 3 YEARS 2 个月前

    谢佬分享

    1
  2. wohei 白银 2 个月前

    感谢分享

    1