cchx-anthropic-billing-header 里的五个字符

turn 2
x-anthropic-billing-header: cc_version=2.1.119.af2; cc_entrypoint=cli; cch=97bd6;
turn 3
x-anthropic-billing-header: cc_version=2.1.119.af2; cc_entrypoint=cli; cch=24c2d;
turn 4
x-anthropic-billing-header: cc_version=2.1.119.af2; cc_entrypoint=cli; cch=ead88;
cc_version
版本号 + 三位 hex 完整性 hash · 锁第一条用户消息 · 三轮都是 2.1.119.af2
cc_entrypoint
调用入口 · cli / sdk-cli / claude-vscode · 交互模式恒定 cli
cch
5 位 hex · 每一轮都换 · 97bd6 → 24c2d → ead88
turn 2 的前缀
tools
工具定义
system[0]
cch=97bd6
system[1]
身份提示词
breakpoint1
system[2]
行为准则
breakpoint2
user msg
第一轮
breakpoint3
turn 3 的前缀
tools
工具定义
system[0]
cch=24c2d
system[1]
身份提示词
breakpoint1
system[2]
行为准则
breakpoint2
user msg
续上一轮
breakpoint3
同一个 session, turn 2 → turn 3 · cch 在 sys[0] 排在所有 breakpoint 前面 · 它一变, 3 个 breakpoint 算 hash 的字节全跟着变 · 一个 miss, 全部 miss
① JS 层 getAttributionHeader()
src/constants/system.ts
const cch = feature('NATIVE_CLIENT_ATTESTATION')
  ? ' cch=00000;'
  : '';
JS 永远只拿到 00000 · 抓 fetch、hook XHR 都看不到真值
请求 body 进入 HTTP 缓冲区
② HTTP buffer 请求 body 完整字节
{ ..., system: [ { text: "x-anthropic-billing-header: ...; cch=00000;" }, ... ], ... }
5 个 0 = 5 位 hex 长度 · Content-Length 不动, buffer 不重分配
Bun Zig native HTTP 栈接管
③ Zig 层 native HTTP 覆盖
bun-anthropic/src/http/Attestation.zig
扫描 buffer · 定位 "cch=00000;" · in-place 覆盖
{ ..., system: [ { text: "...; cch=97bd6;" }, ... ], ... }
Zig 在 JS 沙箱之外执行 · 第三方代理只看到最终结果, 摸不到生成逻辑
真正发到服务端
④ 上线请求 on the wire
POST /v1/messages → system[0].text = "x-anthropic-billing-header: ...; cch=97bd6;"
~/.claude/settings.json
{
  "env": {
    "CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
  }
}
关掉前3 个 system block
sys[0]
x-anthropic-billing-header: ...; cch=97bd6;
每次变
sys[1]
You are a Claude agent...
不变
sys[2]
行为准则 / 工具说明 / ...
不变
前缀 hash 每次都变 · cache_read = 0 · 每次都重新算缓存写入
关掉后2 个 system block
sys[0]
You are a Claude agent...
不变
sys[1]
行为准则 / 工具说明 / ...
不变
前缀字节完全一致 · cache_read 命中 · token 账单立刻降下来