You've built a chatbot. Every turn, you re-send the whole conversation — the 8,000-token system prompt, the uploaded PDF, the 15 messages of history — just so the model can answer "and what about Mars?"
The model re-reads all of it. Every. Single. Time. You pay full price for all of it. Every. Single. Time.
Prompt caching fixes this. It's roughly one extra line of JSON, and it can cut your input costs by ~90% on the repeated part while making responses noticeably faster.
Let's walk through it.
The one-liner version







