{
  "id": 2161231,
  "title": "Prompt Caching: First vs Repeat Request Costs",
  "url": "https://urgent.news/2026/08/20/prompt-caching-first-vs-repeat-request-costs",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-20T15:01:30.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/bettertoken_ai/prompt-caching-first-vs-repeat-request-costs-3o59"
  },
  "original_language": "en",
  "account": "The experiment measures the cost difference between the first prompt request and subsequent repeat requests in a prompt caching scenario. The goal is to determine if caching can lead to cost savings by avoiding reprocessing of unchanged input. The experiment requires three states:\n\nA. The first request creates or prepares a cached prefix along with the initial question.\nB. A cache hit occurs when a subsequent request tries to read the cached prefix.\nC. A cache miss happens when a changed prefix is used or after the TTL has expired.\n\nThe key factors to consider are the model ID, time-to-live (TTL), prefix length, and current pricing. The experiment compares the usage categories and actual charges for one model. To perform the experiment, create a BetterToken account, obtain an API key, and use the current rates from the pricing page. Then, execute the first and repeated requests with the same prefix and analyze the input, output, cache token, and consumption in the dashboard. Verify the cache and TTL rules using the API reference and provider documentation.\n\nOpenAI and Anthropic have different approaches to prompt caching. OpenAI automatically applies caching to the appropriate prefix in supported APIs and models, while Anthropic allows users to mark cache boundaries using the cache_control parameter. The minimum size, TTL, block order, and cost for Anthropic prompt caching vary based on the current contract and model, so they must be verified in Anthropic's official documentation.\n\nTo calculate the cost for each request, use the following formula: cost = I / 1,000,000 × Pi + W / 1,000,000 × Pw + R / 1,000,000 × Pr + O / 1,000,000 × Po, where I is the regular input tokens, W is the cache write tokens, R is the cache read tokens, O is the output tokens, Pi is the regular input price per 1,000,000 tokens, Pw is the cache write price per 1,000,000 tokens, Pr is the cache read price per 1,000,000 tokens, and Po is the output price per 1,000,000 tokens.\n\nIn the first request, both W and R can be greater than zero. However, for automatic caching, the set of fields may differ, and uncached and cached input should be used as is, without creating non-existent categories. Comparing the cost of the first request with the cost of subsequent requests with a cache hit can help determine the payback point. The payback point is the minimum number of requests (n) at which the cache pays off, calculated as C_cached(n) ≤ C_uncached(n).",
  "summary": "Prompt Caching: First vs Repeat Request Costs Measure prompt-cache cost with a controlled request series: the first request creates or prepares a cached prefix, later requests try to read it, and a control request changes the prefix to force a miss. Compare the usage categories and actual charge for one model. A fixed savings percentage means little without the Model ID, TTL, prefix length, and…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}