Caching AI answers
Saving work
Theo reads the Garden Guide's first monthly bill and spots the waste: every question sends the same 5,000 tokens of instructions. Two kinds of caching help an AI feature: saving the part of the prompt that never changes, and saving whole answers to common questions.
Prompt caching
Anthropic: "Prompt caching optimizes your API usage by allowing resuming from specific prefixes in your prompts." Reading cached tokens costs "0.1 times the base input tokens price", and "By default, the cache has a 5-minute lifetime."
Quick check
Remy caches the Garden Guide's 5,000-token instructions, the same for every player. What does that do?
- Each question reads them at a tenth of the price
- It makes answers longer
- Nothing: every question is different
Show the answer
Each question reads them at a tenth of the price
The identical start of the prompt is read from the cache, at 0.1 times the input price.
Same start, new ending
Caching works on the start of the prompt. Shard Garden puts the instructions and game rules first and the player's question last, so every question shares the same start.
Order the prompt
Which order lets the cache work?
- Instructions, game rules, then the question
- The question, then the instructions, then the rules
- A different order each time
Show the answer
Instructions, game rules, then the question
The part that never changes goes first. The question, which always changes, goes last.
Saving whole answers
"How do I water seeds?" is asked thousands of times a day. The studio saves a checked answer to common questions and shows it without calling the AI at all: instant and free.
When a saved answer goes stale
Saved answers go out of date when the game changes. Each one is tagged with the game version, and an update clears the answers about anything that changed.
Quick check
An update changes the greenhouse price. What happens to saved answers about it?
- They are cleared, and new ones are checked
- They stay forever
- Players must ask twice
Show the answer
They are cleared, and new ones are checked
An old price in a saved answer would be a wrong answer, shown instantly to everyone.
Quick check
Caching the instructions changes what the prompt says.
- True
- False
Show the answer
False
The model reads the same prompt either way. The cache only saves work on the part that repeats.
Changing the prompt safely
Every word in the prompt can change the answers. Changes need care.
Bolt says: Next: prompt versions.
Fact-checked 12 October 2026
- Claude Docs: Prompt caching platform.claude.com