@codexvn一次Claude-Code缓存崩溃的完整溯源 中发帖

# 背景

用 Claude Code 对接 DeepSeek V4 的 Anthropic 兼容接口,发现缓存命中率偶尔**脉冲式突变**:同一轮对话中从 99%+ 暴跌到 0.5%,下一轮自动恢复。

```
10:11:23 cache=122,368/123,641 99.0%
10:11:45 cache= 1,536/119,826 1.3% ← 暴跌
10:11:57 cache= 6,528/123,795 5.3%
10:12:18 cache=124,288/124,430 99.9% ← 恢复
```
![image|690x112](upload://2ifeQsBlirOlEVESHOoalCgXJti.png)

# 根因

**Anthropic(及兼容的 DeepSeek)的 prompt cache 采用 byte-exact ...