---
title: "Cached input tokens explained - cut your LLM API bill"
description: "Cached input costs a fraction of normal input. How prompt caching is billed, how to read cached_tokens in usage, and how to structure prompts to hit it."
url: https://broadrouter.com/blog/cached-input-tokens-explained/
lang: en
updated: 2026-11-14
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Cached input tokens: how to cut an LLM API bill

By the BroadNet Inference team · 5 min read · Published 2026-11-14 · Updated 2026-11-15

Cached input tokens are prompt tokens the provider has already processed and can reuse, so they are billed at a lower rate. On BroadNet Inference, DeepSeek V4.1 Flash bills cached input at $0.0055 per 1M tokens against $0.175 for new input. Keep the stable part of every prompt first and identical between calls to get the discount.

## Key takeaways

-   DeepSeek V4.1 Flash cached input: $0.0055 per 1M tokens; new input: $0.175.
-   The usage block reports `prompt_tokens_details.cached_tokens` when the model reports it, so you can measure your cache rate.
-   Put stable content first (system prompt, tools, documents) and changing content last.
-   Caches match from the start of the prompt. One changed token early on makes everything after it new.
-   Agents that resend the same repository context every turn benefit most.

**On this page**

1.  What is a cached input token?
2.  How much do cached tokens cost on BroadNet Inference?
3.  How much can caching save? A worked example
4.  How do you see cached tokens in the API response?
5.  How does prompt caching differ between OpenAI, Anthropic and DeepSeek?
6.  What lowers your cache rate?
7.  When does caching stop mattering?
8.  Why does caching matter more with long context?
9.  Where BroadNet Inference fits

Most of what an agent sends to an LLM is the same on every turn: the system prompt, the tool definitions, the files it is working on and the conversation so far. Only the last message is new. Prompt caching means the provider does not bill that repeated part at full price.

## What is a cached input token?

Every request is made of [input and output tokens](https://broadrouter.com/glossary/input-and-output-tokens/). Before a model can answer, it processes the whole prompt. If an earlier request started with exactly the same tokens, the serving system can reuse that work instead of doing it again. The reused part is reported as [cached input tokens](https://broadrouter.com/glossary/cached-input-tokens/) and billed at a lower rate.

Two points follow from how this works:

-   **Only the prefix is cached.** The match runs from the first token forward and stops at the first difference.
-   **The answer is never cached.** The model still generates new output, billed at the full output price.

## How much do cached tokens cost on BroadNet Inference?

Per 1 million tokens, from the published price file:

| Model | New input | Cached input | Output |
| --- | --- | --- | --- |
| [DeepSeek V4.1 Flash](https://broadrouter.com/models/deepseek-v4.1-flash/) | $0.175 | $0.0055 | $0.52 |
| [GLM 5.3](https://broadrouter.com/models/glm-5.3/) | $0.78 | $0.173 | $3.46 |
| [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/) | $0.175 | $0.0435 | $2.17 |

For DeepSeek V4.1 Flash the gap is large: compare $0.0055 per 1M cached tokens with $0.175 per 1M new ones. For an agent that resends a 200,000-token repository on each turn, the cache rate decides most of the bill.

## How much can caching save? A worked example

A coding agent sends a 200,000-token prompt 100 times in a working day. That is 20 million input tokens a day.

| Cache rate | New input tokens | Cached input tokens |
| --- | --- | --- |
| 0% | 20M at $0.175 per 1M | 0 |
| 50% | 10M at $0.175 per 1M | 10M at $0.0055 per 1M |
| 90% | 2M at $0.175 per 1M | 18M at $0.0055 per 1M |

The formula for the daily input bill is `new tokens (M) × input price + cached tokens (M) × cached price`. At 90%, 18M of the 20M input tokens are billed at the cached price instead of the full input price, so the wider the gap between the two prices, the more of the input bill you save. Output is unchanged. Try your own numbers in the [prompt caching calculator](https://broadrouter.com/tools/prompt-caching-calculator/).

## How do you see cached tokens in the API response?

BroadNet’s API reference says that when the model reports them, the `usage` object carries `prompt_tokens_details.cached_tokens`: the prompt tokens read from cache, billed at the cached price. In a [stream](https://broadrouter.com/glossary/streaming/), ask for usage in the last chunk:

```python
from openai import OpenAI
import os

client = OpenAI(base_url="https://inference.broadnet.ai/v1", api_key=os.environ["BROADNET_API_KEY"])
messages = [
    {"role": "system", "content": "You are a code reviewer."},  # stable prefix: keep it identical
    {"role": "user", "content": "Review the diff below."},
]
stream = client.chat.completions.create(
    model="broadnet/deepseek-v4.1-flash",
    messages=messages,
    stream=True,
    stream_options={"include_usage": True},
)
for chunk in stream:
    if chunk.usage:
        u = chunk.usage
        cached = (u.prompt_tokens_details.cached_tokens if u.prompt_tokens_details else 0) or 0
        print(f"prompt={u.prompt_tokens} cached={cached} rate={cached / max(1, u.prompt_tokens):.0%}")
```

Log that rate per request for a day. It tells you what you really pay, and it is the number to put in the [prompt caching calculator](https://broadrouter.com/tools/prompt-caching-calculator/). More on streaming usage in the [streaming guide](https://broadrouter.com/guides/streaming-chat-completions/).

## How does prompt caching differ between OpenAI, Anthropic and DeepSeek?

Caching is not standardised. What the official docs said when we fetched them on 14 November 2026:

|  | OpenAI | Anthropic | DeepSeek (direct API) |
| --- | --- | --- | --- |
| Turned on | By default for supported models | Opt in with a `cache_control` field (automatic or per block) | By default for all users |
| Minimum prompt | 1,024 tokens on GPT-5.6 and later | 512 to 4,096 tokens, by model | No minimum stated |
| Cache lifetime | 30 minutes by default on GPT-5.6 and later; a 12-hour option | 5 minutes by default, 1 hour at extra cost | Best effort; cleared when unused, “a few hours to a few days” |
| Writes | 1.25× input (30 minutes) or 2.5× (12 hours) on GPT-5.6 and later | 1.25× input for 5 minutes, 2× for 1 hour | No write charge mentioned |
| Reads | 0.1× input on GPT-5.6 and later (0.05× on GPT-6.1 Sol and Terra) | 0.1× input on most models, lower on some | Separate “cache hit” price |
| Usage field | `cached_tokens` in the token details | `cache_read_input_tokens` | `prompt_cache_hit_tokens` |

Sources: [OpenAI prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching), [Anthropic prompt caching docs](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) and [DeepSeek context caching docs](https://api-docs.deepseek.com/guides/kv_cache). Where writes cost extra, a cache that is written but never read costs more than no cache at all. Caching pays off only on prompts you actually repeat. To compare list prices per model, see the [LLM API pricing table](https://broadrouter.com/llm-api-pricing/).

## What lowers your cache rate?

Caches match an exact prefix, so anything that changes early in the prompt makes the rest of it new. The usual causes:

-   a timestamp, request ID or user name near the top of the system prompt;
-   tool definitions or JSON serialised in a different key order on each call, which changes the [tokens](https://broadrouter.com/glossary/token/);
-   an agent that rewrites or summarises its history instead of appending to it;
-   long pauses, after which the cache has expired.

The fix is a fixed layer order (system prompt, tools, documents, history, new message) with each layer byte-identical between calls. Our guide on [how to structure prompts so the prefix caches](https://broadrouter.com/blog/prompt-structure-for-caching/) walks through that layout in code, with a test that proves the prefix is reused.

## When does caching stop mattering?

On a flat plan the bill does not depend on tokens at all. Full Moon is $60 a month per session for unlimited DeepSeek V4.1 Flash. If your agent already crosses the [break-even point](https://broadrouter.com/blog/flat-rate-vs-pay-per-token-llm-api/), the cache rate stops being a cost problem. On long prompts the habits above still help with speed, so they are worth keeping either way.

## Why does caching matter more with long context?

DeepSeek V4.1 Flash and GLM 5.3 accept up to 1,048,576 tokens per request. Caching is what makes very long prompts affordable on a per-token key, because the large, repeated part of the [context window](https://broadrouter.com/glossary/context-window/) is billed at the cached rate. See [when a 1M-token context window is worth it](https://broadrouter.com/blog/million-token-context-window-guide/).

## Where BroadNet Inference fits

BroadNet publishes a cached-input price for each chat model that has one and reports cached tokens in usage when the model reports them, so you can measure your rate before you commit. It does not publish a cache lifetime or minimum prompt length, so measure those on your own traffic. If your agent runs all day, a flat plan removes the question entirely.

Free tools for this

-   [LLM API cost calculator](https://broadrouter.com/tools/llm-api-cost-calculator/) Price a workload on every model at once, with cache hits, reasoning and a flat-plan check.
-   [Flat-rate vs per-token LLM cost calculator](https://broadrouter.com/tools/flat-rate-vs-per-token-calculator/) Break-even between an unlimited plan and paying per token, per agent.
-   [Prompt caching savings calculator](https://broadrouter.com/tools/prompt-caching-calculator/) Bill with and without caching, by prefix share and hit rate.
-   [Prompt token diff](https://broadrouter.com/tools/prompt-token-diff/) Two prompt versions side by side: changed lines, exact token delta and the monthly cost difference.

[All free tools](https://broadrouter.com/tools/)

## Terms in this article

[Token](https://broadrouter.com/glossary/token/)

A token is the unit of text a language model reads and writes: a word, part of a word, a punctuation mark or a byte sequence produced by the model's tokenizer. LLM APIs count, limit and usually bill usage in tokens.

[Cached input tokens](https://broadrouter.com/glossary/cached-input-tokens/)

Cached input tokens are prompt tokens that an LLM provider has recently processed and can reuse from a cache instead of computing again, usually a repeated prefix such as a system prompt or document. Providers bill them at a lower rate than new input tokens.

[Input and output tokens](https://broadrouter.com/glossary/input-and-output-tokens/)

Input tokens are the tokens a language model reads in a request, including the system prompt, conversation history, tool definitions and images. Output tokens are the tokens it generates in reply, including any reasoning. LLM APIs usually price them separately, and output usually costs more.

[Streaming](https://broadrouter.com/glossary/streaming/)

Streaming is a way of returning a language model response in small chunks while it is still being generated, instead of as one reply at the end. OpenAI-compatible APIs stream over server-sent events when the request sets stream to true.

[System prompt](https://broadrouter.com/glossary/system-prompt/)

A system prompt is the instruction text an application sends to a language model ahead of the conversation, usually as a message with the system or developer role. It sets the model's role, rules, tone and output format, and the model is meant to follow it over conflicting user messages.

[Tool calling](https://broadrouter.com/glossary/tool-calling/)

Tool calling, also called function calling, is an LLM API feature in which the model returns a structured request to run a function the developer has defined, with JSON arguments. The application runs the function and sends the result back; the model never runs code itself.

[Context window](https://broadrouter.com/glossary/context-window/)

A context window is the maximum number of tokens a language model can work with in a single request. It covers the prompt, conversation history, tool definitions, images and the generated output, including any reasoning tokens. Anything that does not fit must be cut, summarised or split across several requests.

[AI coding agent](https://broadrouter.com/glossary/coding-agent/)

An AI coding agent is a software tool in which a language model works on a codebase in a loop: it reads files, edits them, runs commands such as tests, reads the output and decides the next step until the task is done or a limit is reached.

## Questions

### Do I need to turn prompt caching on?

It depends on the provider. OpenAI and DeepSeek cache automatically; Anthropic needs a cache\_control field. On BroadNet Inference, check the usage block: when the model reports cached tokens, they appear as prompt\_tokens\_details.cached\_tokens and are billed at the cached input price.

### How do I check if prompt caching is working?

Ask for usage on every request and compute cached\_tokens divided by prompt\_tokens. A rate near zero on the second call of a long, repeated prompt means something early in the prompt is changing between calls.

### Why is my cache rate low?

Usually because something early in the prompt changes on every call, such as a timestamp, a request ID or a reordered tool list. Move changing content to the end.

### What is the difference between prompt caching and response caching?

Prompt caching reuses the provider's work on a repeated prompt prefix, and the model still writes a fresh answer. Response caching is something you build yourself, storing whole answers and returning them for identical questions without calling the model.

### Are cached tokens free?

No. They are billed at a lower rate, not at zero. On DeepSeek V4.1 Flash, cached input is $0.0055 per 1M tokens, and output is billed in full.

### Does caching matter on an unlimited plan?

Not for the bill, because plan sessions have no token meter. It still shortens the time to first token on long prompts in many serving systems, so the same habits help.

## Keep reading

-   [How to structure prompts so the prefix caches](https://broadrouter.com/blog/prompt-structure-for-caching/)
-   [LLM API pricing explained: input, cached, output and reasoning](https://broadrouter.com/blog/llm-api-pricing-explained/)
-   [Flat-rate vs pay-per-token LLM API: the break-even math](https://broadrouter.com/blog/flat-rate-vs-pay-per-token-llm-api/)
-   [When a 1M-token context window is worth it (and when not)](https://broadrouter.com/blog/million-token-context-window-guide/)
-   [Cache LLM API responses to cut cost: an exact-match cache in Python](https://broadrouter.com/blog/cache-llm-responses-cut-cost/)
-   [LLM API price changes in October 2026: 3 rises, no cuts](https://broadrouter.com/blog/llm-api-price-changes-october-2026/)
-   [Do LLM API prices only go down? 52 rises and how to budget for them](https://broadrouter.com/blog/llm-api-price-increases/)
-   [Guide: Stream chat completions and handle dropped connections](https://broadrouter.com/guides/streaming-chat-completions/)
-   [Guide: Use the OpenAI Python SDK with BroadNet Inference](https://broadrouter.com/guides/openai-python-sdk/)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-cached-input-tokens-explained&utm_content=page-cta) ·

**Sources**

-   [BroadNet Inference API reference, reasoning and cached tokens (fetched 2026-11-14)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-cached-input-tokens-explained&utm_content=sources)
-   [BroadNet Inference machine-readable prices (pricing.json, fetched 2026-11-14)](https://inference.broadnet.ai/pricing.json?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-cached-input-tokens-explained&utm_content=sources)
-   [OpenAI prompt caching guide (fetched 2026-11-14)](https://developers.openai.com/api/docs/guides/prompt-caching)
-   [Anthropic prompt caching documentation (fetched 2026-11-14)](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
-   [DeepSeek API docs, context caching (fetched 2026-11-14)](https://api-docs.deepseek.com/guides/kv_cache)
