Tool schemas render before the system prompt, so a non-deterministic tool list silently blocks the cache for everything after it. Sort and freeze the tool array to make tools cacheable.
Cache Your Tool Definitions, Not Just the System Prompt
🔒 Pro tip · Intermediate
Unlock this tip — and 37 more
This is one of 38 advanced, fact-checked tactics reserved for Pro. Get the full 60-tip library, a searchable archive, and a new tip every morning for $9/mo.
Prefer to browse? The 22 Beginner tips are free forever.
More in Prompt Caching & Reuse
♻️Prompt Caching & Reuse
up to 90% on the cached portion
Freeze the Prefix: One Stray Timestamp Kills Your Whole Cache
Prompt caching is a prefix match. A single dynamic byte near the top of your prompt silently invalidates everything after it, so you pay full price every call without realizing it.
♻️Prompt Caching & Reuse
Cache reads run roughly 0.1x of base input price; the more users hit the same prefix, the closer your shared instructions get to free
Share One Cached System Prompt Across All Your Users
A single per-user byte (name, ID, locale) in the system prompt forks the cache into one entry per user. Strip personalization out of the prefix so every user reads the same cached block.
♻️Prompt Caching & Reuse
avoids paying write premiums for zero benefit
Know Your Minimum: Short Prompts Silently Refuse to Cache
Below a model-specific token floor, a cache_control marker does nothing — no error, just a full-price bill. Know the floor before you rely on caching.