All posts

How prompt caching cuts your LLM bill in half (DeepSeek & Kimi cache pricing)

· Pricing· Optimization· DeepSeek

Most teams overpay for input tokens. If you send the same long system prompt, tool definitions, or document context on every request, you're paying full input price to re-process text the model has already seen. Prompt caching fixes that, and on Chinese models the discount is steep.

How prompt caching works

When you send a request, the provider hashes the prefix of your prompt. If that exact prefix was seen recently, it's served from cache at a fraction of the normal input price, typically around one-tenth. Only the new tail of the prompt is charged at full rate.

The rule that matters: caching keys off a stable prefix. Put everything constant (system prompt, tool schemas, few-shot examples, fixed document context) at the *front*, and put the variable user input at the *end*.

The cache prices that matter (2026)

  • DeepSeek pioneered aggressive cache pricing: cache reads around $0.07/M, and V4-Flash near $0.014/M, versus normal input of $0.14–$0.435/M.
  • Kimi K2.6 follows with cache reads around $0.16/M.

For agent workloads with a big stable system prompt, effective input cost can fall to $0.03–$0.07 per million tokens, often cheaper than the output you generate.

Structure your prompt for cache hits

Bad (variable content first, so the cache rarely hits):

messages = [
    {"role": "user", "content": user_question},          # changes every call
    {"role": "system", "content": LONG_SYSTEM_PROMPT},   # wrong place
]

Good (stable prefix first, so the cache hits every call):

messages = [
    {"role": "system", "content": LONG_SYSTEM_PROMPT},   # constant → cached
    {"role": "user", "content": FIXED_CONTEXT},          # constant → cached
    {"role": "user", "content": user_question},          # only this is "new"
]

Now every request after the first reuses the cached prefix, and you only pay full price for user_question.

A worked example

An agent with a 20K-token system prompt and tools, answering 100K short questions a day:

  • Without caching: 20K × 100K = 2B input tokens a day at ~$0.14/M, about $280/day.
  • With caching (prefix cached at ~$0.014/M for Flash): about $28/day on the cached prefix.

A 10× cut on input cost, just from prompt structure, with no quality change.

Put it to work

DeepSeek V4-Pro, V4-Flash and Kimi K2.6 all expose this caching behavior, and you can reach all of them through one OpenAI-compatible key on Turiloop. Keep your stable prefix stable, send variable input last, and the savings are automatic. Billed pay-as-you-go, international card, no Chinese phone number.