Prompt
Why are my cached LLM responses not getting reused?
Latest observation
Oct 26, 2026
OpenAI APIWeb search: off
Cached LLM responses usually fail to reuse for one of a few common reasons:
1) The prompt isn’t actually identical
Caching is often exact-match or near-exact-match. Tiny differences can break reuse:
- extra spaces/newlines
- different system prompt
- changed tool definitions
- different order of messages
- different temperature / model / max tokens
- hidden metadata added by your framework
2) The cache key includes fields you didn’t expect
Many SDKs hash more than just the visible prompt:
- model name/version
- API endpoint
- tool schemas
- response format / JSON schema
- user/session ID
- conversation state
- tenant/project ID
So even “same prompt” may not be the same cache key.
3) Non-determinism is enabled
If the model call includes:
- temperature > 0
- top_p < 1
- random seed not fixed then the system may avoid caching or treat responses as not safely reusable.
4) Your cache TTL expired or eviction happened
If the cache has:
- a short time-to-live
- limited capacity
- LRU eviction the entry may simply be gone by the time you query again.
5) Streaming responses aren’t cached the same way
Some systems only cache complete responses, not streamed partials, or they cache them differently.
6) Tool calls / external data make the response “dynamic”
If the response depends on:
- function/tool outputs
- web search
- database results
- current time
- retrieved documents then caching may be disabled or bypassed because the result isn’t stable.
7) Cache is enabled but not on the path you’re using
Examples:
- local dev cache but production uses another instance
- per-worker memory cache behind a load balancer
- cache disabled for async/batch requests
- wrong environment variables or config
8) Prompt normalization issues
Some frameworks normalize prompts before caching, others don’t. Mismatches like:
- different Unicode forms
- line ending differences (
\nvs\r\n) - JSON key ordering changes can prevent hits.
Quick checks
- Log the exact cache key or hash used.
- Compare the full serialized request, not just the visible prompt.
- Temporarily set temperature to 0.
- Disable tools/retrieval and test again.
- Check whether the cache entry exists right before the second request.
- Verify you’re using the same model/version and same cache backend.
If you want, I can help debug it
Paste:
- the two requests you expect to match
- your caching config
- the framework/SDK you’re using
and I’ll help identify why the hit is failing.