Check DeepSeek API cache usage
Inspect cache counters; repeated input does not guarantee a hit.
In this article
Reuse a document prefix
The cache guide describes automatic reuse of persisted input prefixes. Suggested exercise for an existing API workflow: send the same fictional project note followed by three different questions, in separate requests. Keep the shared beginning unchanged. The documented pattern first establishes that common prefix, which a later request can reuse. Hits remain best effort. This is an exercise, not our measured result; the response is still generated, not retrieved as a saved answer.
Inspect each response
Use the chat API reference to inspect a nonstreaming response. The request contains a model and conversation messages; the response contains usage statistics. Record prompt_cache_hit_tokens and prompt_cache_miss_tokens for each request. The first counts reused input tokens, the second input tokens that missed the cache. Their sum equals prompt_tokens. Keep completion_tokens separate: it counts generated output. For your exercise, compare these counters across the requests rather than treating the answer’s wording as evidence of a cache hit.
Interpret the cost
Consult the current pricing table for your selected model and applicable peak or off-peak period. Cached input, uncached input and output have separate rates per million tokens. Apply each rate to its corresponding token count; a cached prefix does not make the whole request free. Prices may change.
Original CurioFuse editorial. A guide to explore and evaluate AI, without an implied product test.
