AI Help
Why isn’t prompt caching reducing my AI API costs?
Inspect cached-token usage and the actual shared prompt prefix. Cache eligibility and routing rules depend on the model and endpoint.
Steps to follow
- Log model, prompt length, cached input tokens and the stable prefix while protecting private prompt content.
- Keep reusable instructions and reference material at the front and variable user input afterward. Verify current cache eligibility and retention guidance.
- Compare repeated equivalent requests and their usage breakdown. Lower latency alone does not establish a billing cache hit.
Example in practice
Illustrative example. A timestamp at the beginning of every prompt changes the prefix. Move variable metadata after reusable content and measure cached usage again.
Related AI help
- How do I estimate the API cost of one completed AI task?
- How do I handle AI API 429 rate limits without losing requests?