LLM Proxy Cache Miss: A Troubleshooting and Cost-Reduction Guide
Prompt caching can cut input token costs dramatically in long-context workloads, but many developers calling LLMs through third-party proxy platforms find their bills far higher than expected. This article explains how cache billing works, common reasons caching silently fails on proxy platforms, and how to verify and configure caching correctly.
LLM Proxy Cache Miss: A Troubleshooting and Cost-Reduction Guide
In long-context scenarios, every request carries the system prompt and conversation history, so input token counts grow quickly. LLM providers offer caching to address this: when a cache hits, input costs drop to a fraction of the standard rate. However, many developers calling models through third-party proxy platforms find their bills far exceed expectations. Drawing on hands-on troubleshooting experience, this article explains how cache billing works, why caching often fails in proxy scenarios, and how to verify and configure it.
1. The Symptom: Why Is a Single Request So Expensive?
In one integration, a team used a high-end model accessed through a proxy platform. Connectivity tests passed, but after going live the balance drained fast: the account dropped from $40 to $30, and platform logs showed each request costing between $0.50 and $0.70 with a context length of about 100,000 tokens.
These numbers can be cross-checked. Assuming the model’s standard input price is $5 per million tokens, the input cost for 100,000 tokens is: 100,000 × 5 ÷ 1,000,000 = $0.50. This matches the per-request cost in the logs almost exactly, suggesting those requests were billed at full input price. Note, however, that a $10 balance drop at $0.50–$0.70 per request implies roughly 15 to 20 requests. If you only ran a few conversation rounds, there’s a significant gap. So the first step in troubleshooting is to count actual requests. Coding tools often issue multiple requests per conversation round (tool calls, retries, subtasks), and all of them are billed.
The unit price above is an assumption for illustration; actual pricing depends on the platform and the model provider’s official rates.
2. How Cache Billing Works
Caching is built on prefix reuse. When the model processes a request, it saves the leading portion of the request (system prompt, earlier messages, etc.) as a cache. If a subsequent request starts with an identical prefix, the cached portion is read directly instead of being recomputed.
Billing typically falls into three categories:
- Cache write: on the first request, the prefix is written to cache, usually at a price slightly above the standard input rate.
- Cache read: subsequent requests that hit the cache are billed far below the standard input rate.
- Uncached input: content beyond the cached portion, or content not eligible for caching, is billed at the standard rate.
Several boundary conditions apply:
- The first request only writes the cache; it doesn’t read from it, so no savings on the first call is normal.
- The prefix must match exactly. An extra space in the system prompt, or an inserted timestamp that changes each time, can invalidate the cache.
- Caches have a TTL. If they aren’t accessed within that window, they expire. TTLs vary by platform.
- There is usually a minimum length for cacheable content; prefixes that are too short won’t be cached. The exact threshold depends on the model.
3. Common Reasons Caching Fails Through a Proxy
Cache issues on proxy platforms generally fall into the following categories; the actual behavior depends on the platform’s implementation:
- Cache fields lost in protocol conversion. In the native protocol, cache control fields may live inside message content blocks. If the proxy reorganizes the request into a compatibility protocol, those fields may be dropped. The underlying model never receives the caching instruction and bills at full price.
- Cache passthrough not enabled. Some platforms don’t forward cache parameters by default, or only support caching on certain plans or certain models.
- The prefix is modified. The client inserts dynamic content into the system prompt every round (current time, random IDs, session numbers), so the prefix differs on every request.
- Requests routed to different upstream nodes. If the platform distributes requests across multiple channels and the cache only exists on one of them, hit rates drop. This needs to be confirmed with the platform.
- Request intervals exceed the TTL. After a long gap without conversation, the cache has expired and the next request must rewrite it.
Not all of these causes are observable from the outside, so you need data to verify them.
4. How to Confirm Whether the Cache Actually Hits
Don’t rely on balance or total cost alone—inspect the usage details of each request. Check the following:
| Check | Expected Behavior | Where to Look | Conclusion |
|---|---|---|---|
| Cache write tokens | Non-zero on the first round or after the prefix changes | Cache creation field in the response usage |
A value means the prefix was written |
| Cache read tokens | Non-zero from the second round onward | Cache read field in usage, or platform billing details |
Non-zero and a large share of input means a hit |
| Standard input tokens | Should drop noticeably after a hit | Regular input field in usage |
Consistently near total input means no hit |
| Request IDs and time window | Requests in the same session sent consecutively within the TTL | Platform logs | Long gaps cause expiration |
| Prefix consistency | Byte-identical prefix each round | Compare client request logs | Inconsistency requires client-side changes |
Field names differ across providers. Anthropic’s native API generally returns separate cache creation and cache read fields, while OpenAI-style APIs often return cached_tokens inside prompt_tokens_details. Whether the proxy preserves these fields determines whether you can verify hits directly. If the platform doesn’t return usage details, ask it to provide cache billing breakdowns.
Another approach is to compare direct calls with proxied calls. Send the same set of requests to the official API directly and through the proxy, then compare the usage on both sides. If direct calls show cache reads but the proxy doesn’t, the problem is almost certainly in the proxy chain.
5. How to Enable Caching Through a Proxy
5.1 Check the Platform Documentation First
There is no unified standard for cache configuration. Supported parameters, field names, and toggle locations can differ completely between platforms, so always follow the target platform’s documentation. Some platforms offer a console toggle; others support passing through native parameters.
5.2 Add Cache Markers According to the Protocol
The following covers only structural essentials; refer to the documentation for exact fields:
- Claude’s native Messages API:
systemis a top-level parameter, not part of themessagesarray.cache_controlbelongs inside specific content blocks, marking the parts to cache—for example, the system prompt block or earlier history message blocks. - OpenAI-compatible APIs: some platforms cache prefixes automatically with no manual marking required. If a platform supports explicit marking, the field location and format follow its documentation. If the proxy doesn’t pass through unknown fields, your markers will be silently ignored.
Before changing request structures, test in a staging environment or with low traffic. Confirm requests return successfully and that the expected cache fields appear in usage.
5.3 Be Careful with Header-Based Toggles
Some platforms support controlling caching via HTTP headers, but header names are not standardized. Some platforms use custom headers; others may not support them at all. If a header isn’t in the documentation, the server typically ignores it silently without an error—creating the illusion that caching is configured when it isn’t. Use only the header names listed in the documentation and verify the effect through usage.
6. Precautions Before and After Changes
- Before modifying anything, record a baseline of usage over a period of time, including input, output, and cache fields per request.
- Compare with low traffic first. After the change, compare bills and
usagefor the same tasks to confirm the cache read ratio increases. - Confirm request success rates. If 400-class errors appear after adding a field, that field isn’t supported—roll back.
- Keep a rollback plan. Don’t swap all production configuration at once.
Caching works best with stable prefixes—for example, a fixed system prompt plus a steadily growing conversation history. If the prefix changes every round, hits will be rare no matter how correct the configuration is.
7. A Checklist for Choosing a Proxy Platform
When evaluating proxy platforms, work through these questions:
- Does the platform explicitly support caching for your target model, with documented field formats?
- Does it pass through native parameters? Are unknown parameters rejected with an error or silently dropped?
- Does the response return cache read/write fields in
usage? - Does the bill break out cache reads, cache writes, and regular input separately?
- Are requests consistently routed to the same channel, so caches can be reused within the TTL?
- Is there a clear technical support channel for cache-related issues?
The answers to these questions matter more than the headline unit price. A platform that is slightly more expensive per token but preserves cache fields and routes requests consistently will usually cost far less in long-context workloads than one that silently breaks caching.
