<!-- llms-explorer concept facts · https://llms-explorer.com/tree/llama-cpp-normalisation-of-claude-code-billing-h/ · pack 2026-10-05 · ~1004 tokens -->

# llama.cpp normalisation of Claude Code billing header cch

> The converter's code comment calls the cch stamp "a whitebox end-to-end integrity hint" that is not meaningful as system-prompt data to llama.cpp, and notes it changes on each request so the prefix cache "will not get past it".

Parent: [Mac local LLMs: Agent clients, context and compaction](https://llms-explorer.com/tree/mac-local-llms-agent-clients-context-and-compaction/) · 1 facets · 13 facts · page: https://llms-explorer.com/tree/llama-cpp-normalisation-of-claude-code-billing-h/

## Facts

- The converter's code comment calls the cch stamp "a whitebox end-to-end integrity hint" that is not meaningful as system-prompt data to llama.cpp, and notes it changes on each request so the prefix cache "will not get past it". — [source](https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/server/server-chat.cpp)
- The function does nothing unless the system text starts with the exact prefix `x-anthropic-billing-header:`. — [source](https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/server/server-chat.cpp)
- The function replaces exactly five characters after `cch=` with `f` only when the character after them is `;`; otherwise it logs `anthropic string not as expected: <text>` at error level and leaves the text unchanged. — [source](https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/server/server-chat.cpp)
- The normaliser is called both for a string-typed `system` field and for each `text` block in an array-typed `system` field, before the blocks are concatenated into one system message. — [source](https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/server/server-chat.cpp)
- The code comment's example header is `x-anthropic-billing-header: cc_version=2.1.101.e51; cc_entrypoint=cli; cch=a5145;You are Claude Code, Anthropic's official CLI for Claude.`, so the checksum and the identity sentence can share one system text. — [source](https://raw.githubusercontent.com/ggml-org/llama.cpp/master/tools/server/server-chat.cpp)
- Before the change, the PR author saw prefix reuse stop at `n_past` about 18,577 even with a 60k context, and the `/slots` prompt diff showed line 62 (the billing header) differing while over 5,000 following lines matched. — [source](https://github.com/ggml-org/llama.cpp/pull/21793)
- On the second request after the change, slot selection moved from `sim_best = 0.566, f_keep = 0.704` to `sim_best = 0.805, f_keep = 1.000`, and later requests showed `sim_best = 0.994`. — [source](https://github.com/ggml-org/llama.cpp/pull/21793)
- The PR author reasoned the cost for non-Claude traffic is a single-position prefix check per system message, and chose to replace the value instead of deleting the header because a meaningful string sometimes follows it. — [source](https://github.com/ggml-org/llama.cpp/pull/21793)
- The author wrote the replacement defensively because the checksum is always five hexadecimal characters today but the protocol could change. — [source](https://github.com/ggml-org/llama.cpp/pull/21793)
- Reviewer ngxson approved PR 21793 on 2026-04-12 and the PR title was changed to `server: (anthropic API) fix prefix caching`; after the converter code moved, the author migrated the helper by hand, and ServeurpersoCom merged it on 2026-04-23 as commit c807c6e3b0c74b77ad4c7a8213a1d5690d34e462. — [source](https://github.com/ggml-org/llama.cpp/pull/21793)
- PR 21793 declares AI usage disclosure as "NO", with the code and PR text hand-written. — [source](https://github.com/ggml-org/llama.cpp/pull/21793)
- Inferred: a server that is not llama.cpp (oMLX, Rapid-MLX, LM Studio, Ollama) has no such normalisation in the sources read, so for them `CLAUDE_CODE_ATTRIBUTION_HEADER=0` or Claude Code v2.1.181 or later remains the control. — source: `asserted`
- Inferred: the `cc_version` hash suffix is a second possible cache-breaker on Claude Code builds older than v2.1.181 that this normaliser does not touch. — source: `asserted`
