Uploaded November 2026 | Updated November 2026, 10 hours ago
When you send a short reply in a long AI chat, it can feel like the model remembers everything and only reads your new words. On the developer API, the model has no memory between requests: every turn, the whole growing conversation is sent again, and the model must process every input token before it writes the first word of its answer. Providers built prompt caching to make that cheap. While processing a prompt, the model computes key-value (KV) tensors, the intermediate math that lets it look back at earlier tokens. The provider saves that math, not the words, for the unchanged start of the prompt, and a later request with an identical start skips it and processes only the new part, without changing the model's output. In Anthropic's own example, a 100,000-token book took 11.5 s to the first word without caching and 2.4 s with it, and cost 90% less. Cache reads cost about a tenth of normal input on most models. The catch: the match must be on the exact start. vLLM hashes the prompt block by block together with all the tokens before it, so changing anything early breaks every block after it, and Anthropic's docs show a timestamp placed ahead of the user message causing a cache write on every request and no reads. Entries expire (5 minutes by default on Anthropic, 30 minutes on OpenAI's newer models), and prompts under the minimum size are not cached. The design rule for agent builders: keep the stable stuff first and the changing stuff last. This describes developer APIs and inference servers, not how consumer chat apps are billed or built.
Sources:
platform.claude.com/docs/en/build-with-claude/prompt-caching
platform.openai.com/docs/guides/prompt-caching
anthropic.com/news/prompt-caching
docs.vllm.ai/en/latest/design/prefix_caching
#AI #PromptCaching #LLM #AIAgents #Shorts #shorts
When you send a short reply in a long AI chat, it can feel like the model remembers everything and only reads your new words. On the developer API, the model has no memory between requests: every turn, the whole growing conversation is sent again, and the model must process every input token before it writes the first word of its answer. Providers built prompt caching to make that cheap. While processing a prompt, the model computes key-value (KV) tensors, the intermediate math that lets it look back at earlier tokens. The provider saves that math, not the words, for the unchanged start of the prompt, and a later request with an identical start skips it and processes only the new part, without changing the model's output. In Anthropic's own example, a 100,000-token book took 11.5 s to the first word without caching and 2.4 s with it, and cost 90% less. Cache reads cost about a tenth of normal input on most models. The catch: the match must be on the exact start. vLLM hashes the prompt block by block together with all the tokens before it, so changing anything early breaks every block after it, and Anthropic's docs show a timestamp placed ahead of the user message causing a cache write on every request and no reads. Entries expire (5 minutes by default on Anthropic, 30 minutes on OpenAI's newer models), and prompts under the minimum size are not cached. The design rule for agent builders: keep the stable stuff first and the changing stuff last. This describes developer APIs and inference servers, not how consumer chat apps are billed or built.
Sources:
platform.claude.com/docs/en/build-with-claude/prompt-caching
platform.openai.com/docs/guides/prompt-caching
anthropic.com/news/prompt-caching
docs.vllm.ai/en/latest/design/prefix_caching
#AI #PromptCaching #LLM #AIAgents #Shorts #shorts










