The proxy arms a keep-warm ping for any Anthropic request that stops on tool_use, whether or not the request carries a cache_control mark.
A request with no mark leaves nothing in the provider's cache, so the ping, which re-sends the whole prompt, is billed at the full input price and finds nothing to read.
- What to change
- Arm keep-warm only when the body that was sent carries a cache_control mark (top-level, system, tools or messages, nested tool_result content included).
- Why it matters
- Each such ping is one full-price read of the whole prompt, on a pause that already passed 270 seconds. It is the same cost the module comment says the feature exists to avoid, and it repeats on every later long tool wait because the next tool_use response arms a new timer.
- How often it happens
- The code shows the problem; how often it happens is assumed. To measure it: how many Anthropic /v1/messages clients behind the proxy send no cache_control anywhere, and how often their tool waits pass 270 seconds (the proxy's own stats rows with keep_warm = 1 and cache_read_tokens = 0 count them)
- Who reaches this
- only clients that send /v1/messages requests with no cache_control
- Estimate
- about 900k prompt tokens per 1,000 calls, only for clients that send no cache_control
What the estimate assumes
60,000-token prompt; half of the calls stop on tool_use; 3% of those waits pass 270 seconds; every affected call comes from an unmarked client. All three rates are assumptions.