The relevant part is that Claude Code adds an Attribution header, which invalidates the KV Cache for local models. The fix proposed here is to set the following in ~/.claude/settings.json when using Claude Code against a local model:
"env": {
...,
"CLAUDE_CODE_ATTRIBUTION_HEADER" : "0"
},