
v8.0.36 的 Responses→Claude 路径会把客户端发来的空 text 块原样转出、再点上缓存标记,Anthropic 回 400;本期给三十秒自检、三处源码位置,以及今晚能执行的三条处置。
cache_control cannot be set for empty text blocksmessages: text content blocks must be non-empty
invalid_request_error。对运维要紧的是后面的处理:这个 400 不换号、不冷却、不重试,客户端直接看到上游原文。3/v1/responses,末尾留一个空的 input_text:curl https://<你的中转>/v1/responses \
-H "Authorization: Bearer $KEY" \
-H 'Content-Type: application/json' \
-d '{"model":"claude-sonnet-5",
"input":[{"role":"user","content":[
{"type":"input_text","text":"Reply with exactly OK."},
{"type":"input_text","text":""}]}],
"max_output_tokens":128,"store":false}'input_text 删掉再发一次,变 200 就说明是那个空块把请求打死的,不是账号、不是额度。1"text":"",响应侧搜上面那两句原文。带空块的请求每发一次就 400 一次,不会自己好。
internal/translator/claude/openai/responses/claude_openai-responses_request.go 第 352–370 行,v8.0.36 源码:input_text 与 output_text 只要 text 键存在就写进一个 Claude text 块,空字符串也算存在。4appendSystemText,那里写的是 if text == "" { return }。system 侧挡了空串,message 侧没挡,两处就差这一行。5
internal/runtime/executor/claude_executor_cloaking.go 第 2437–2478 行:injectMessagesCacheControl 从尾部往前找最后一条可缓存消息,取它内容数组的最后一个元素,直接写 cache_control。函数里唯一判空的一处(第 2458–2460 行)只管「尾部 system 字符串」这一种情形。6
shouldEnsureCacheControl 先看 prompt_cache_options.mode=explicit,有就跳过;否则要同时满足「客户端不是被确认的原生 Claude Code」和「被 cloak,或请求里一个 cache_control 都没有」,才注入。7cache_control 的 Responses 请求,第二条正好成立,这个函数就必跑。流式与非流式两处都调(非流式第 163–171 行、流式第 166–169 行),注入完再按上限 4 个裁一次。89
invalid_request_error 还会在第 109 行命中同一个结论。10shouldRetryAfterErrorWithAttempted 第 1382–1384 行遇到这类错误直接返回不重试。11/v1/messages。 报障人在野外用同一套 Pi 加 pi-processes 客户端验证过:把这条链路指到代理的 Anthropic Messages 入口,原本 400 的会话就通了。12cache_control,countCacheControls(payload) 不为 0,第三处那个判定就早退了。这条办法有前提,客户端得自带标记;一个不带标记的客户端走原生入口,照样会被注入,只是它只要不碰空块就不会撞上。input_text,200。prompt_cache_options.mode=explicit 确实会让注入早退,但代理侧没有开关能替你补上这个字段:payload 规则在打点之后才执行(打点在第 163–171 行,规则在 248 行),补了也来不及。13 v8.0.36 的 config.example.yaml 里也没有与这层注入相关的配置项。14internal/translator/antigravity/claude/antigravity_claude_request.go 第 556–560 行,Claude→Gemini 那条路为了躲同一类 400,早就写了 if prompt == "" { continue }。15dev 停在 2 点 21 分;sub2api 还是 v0.2.17,codex-proxy 还是 v2.1.19,codex2api 还是 v3.1.1。16github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
github.com
status.openai.com
status.anthropic.com
status.cloud.google.com
codex-reset.com
opentherank.com
community.openai.com
This story was produced automatically by a channel. One sentence is all it takes for Neodrop to keep producing for you.