What a Cache Read Charges You
A cache read is what you pay when a request reuses a prefix that an earlier request already stored. Those tokens usually come at a reduced rate compared with fresh input, and that discount is the entire reason caching exists. One detail belongs at the top of every checklist: a read still costs money. Cached tokens are cheaper tokens, not free tokens, so a loop that re-reads the same long prefix a hundred times still lands on your meter.
So the first question before the green light is how much of your prompt is actually stable across turns. Split every request into two zones. The fixed zone holds the system prompt, tool definitions, schema descriptions, and reference material that never changes. The moving zone holds the user turn, the retrieved context, and anything that carries a timestamp. Reads only help the fixed zone. If your app rewrites the whole payload on every call, the cache gives you almost nothing.
The second question is ordering. Most providers match a cached prefix from the beginning of the prompt, so the stable material must come first and the variable material must come last. A single swapped sentence near the front can invalidate everything behind it. If your team keeps a helper that decorates requests with random identifiers at the top, that helper is quietly turning every cheap read back into full-price input.
What a Cache Write Charges You
A cache write is what you pay the first time a prefix is stored. Think of it as a setup fee attached to the tokens you were going to send anyway. On many providers the write is priced above ordinary uncached input, because you are covering the cost of keeping that prefix available for later requests. The write is not a mistake and it is not a penalty. It is the investment that makes the later reads cheap.
The checklist question here is how many times you expect to read what you just wrote. A write that is read many times is a good deal. A write that is read once, or never, is the most expensive way to send that prompt. Long-lived prefixes such as a detailed system prompt or a full tool schema are excellent write candidates, because every later call in the session reuses them.
Short-lived prefixes are the opposite. A one-shot script, a single generated file, or a context blob assembled from a fresh search is unlikely to be reused before it expires. Caching those costs you the write premium for no later saving. Give each prefix a rough expected reuse count before you enable caching for it. If that number is one, send it as plain input and move on.
A Pre-Flight Checklist Before the Green Light
Run this list once before you commit real traffic. It is short on purpose, and every item maps to one line on your token bill.
- Split each prompt into a fixed prefix and a variable suffix, and write the split down where the whole team can see it.
- Put stable material first. System prompts, tool definitions, and reference documents lead, while user turns and retrieved context trail.
- Remove random or generated values from the front of the prompt. Request identifiers and timestamps belong at the end.
- Count the expected reads for every prefix you plan to cache, and skip caching for anything reused fewer than twice.
- Budget both sides of the ledger: the write premium on the first send and the read cost on every later call.
- Decide what happens when a session resets, since a fresh session may trigger a new write for the same prefix.
- Log token counts by category so cached input, uncached input, and output appear as separate columns in your own reports.
- Set a spend ceiling before the first run, so a runaway loop shows up as an alert instead of a surprise.
If any item is unanswered, you are not ready for the green light. The list takes minutes to complete, while an unexamined cache strategy keeps charging you every day until you fix it.
Shaping the Prompt So Reads and Writes Both Land Well
Once the checklist passes, the prompt itself becomes the tuning surface. The goal is to make the fixed prefix as long and as useful as possible while keeping the variable suffix small and honest. A long stable prefix is not bloat if every tool in your project needs it. It is exactly the material you want to write once and read on every lap.
A few shaping rules cover most cases:
- Favour explicit tool definitions over prose descriptions that you rewrite each turn, since definitions stay stable and read well.
- Keep retrieved documents out of the cached prefix unless the same documents will still be present on the next call.
- Avoid embedding wall-clock time, random seeds, or user names early in the prompt, because each one breaks the prefix match.
- Trim the suffix aggressively, because anything that changes every turn is charged at full input rates on every single request.
Tool-heavy workflows are where this pays off most. Coding agents with large tool schemas and a long instruction block benefit because the expensive part stays constant across a long session. A research assistant that fetches new documents every turn benefits far less, since its context keeps shifting under it. Match the strategy to the shape of your traffic rather than to a habit.
Revisit the split whenever the prompt grows. A new tool definition or an extra reference document belongs in the fixed prefix, while a new per-turn variable belongs in the suffix. Teams that review the split on a steady cadence keep the write budget predictable and the read savings consistent across the whole month.
Your First Lap on SwiftRelay
SwiftRelay is a pay-as-you-go relay for Claude, GPT, Gemini, DeepSeek, Kimi, GLM, Qwen, Grok and other models, so you can rehearse the same cache behaviour across providers from one place. It works with Claude Code, Codex, Gemini CLI and any OpenAI-compatible SDK. Point Claude Code and Gemini CLI at the bare host https://api.fastapirelay.com, and add /v1 when you configure an OpenAI SDK. Billing is per token, which means the read and write columns in your logs map straight onto the bill.
Start with a model that suits a first run. Claude Haiku 4.5 is a sensible choice for a cheap cache rehearsal, and DeepSeek V4 Flash keeps a long-session agent loop affordable while you tune the prefix split. Repeat the same checklist on a second provider before you commit a workload, because caching rules and expiry windows differ between model families.
New accounts get a small gift credit, so the first lap costs you attention rather than budget. Inviting friends earns 14% of their top-ups, which helps when the whole team starts logging cache categories together. Sign up at SwiftRelay and work through the checklist above before your first real request leaves the pit lane.