What does a cached token cost on Step 5?
A cached input token on Step 5 costs $0.10 per 1M, one tenth of the $1.00 charged for an uncached input token, and output stays at $2.70 per 1M. StepFun’s pricing page lists those three rates and adds that the cache-miss price already includes writing new content to the cache, so there is no separate write fee. That one detail changes the math: with no write premium there is no break-even hit rate to clear. Any hit saves money, and the only question is how many hits your traffic really gets. This post is part of the complete Step 5 guide and works the arithmetic from a single request up to a 60-turn agent loop.
The rule of thumb to keep: effective input price per 1M tokens is 1.00 minus 0.90 times your hit rate, so 90% hits means $0.19 per 1M and 50% hits means $0.55. Everything in this post is that formula applied to realistic shapes of traffic.
TL;DR
- Prices per 1M tokens: $1.00 input on a miss (includes the cache write), $0.10 on a hit, $2.70 output including reasoning.
- A request with 40,000 input and 4,000 output tokens costs $0.0508 uncached and about $0.0184 at a 90% hit rate, a 63.8% saving.
- Effective input price is 1.00 minus 0.90 times the hit rate per 1M tokens. At 90% hits it is $0.19.
- OpenRouter’s Step 5 page showed 86.3% and later 93.2% cache hits; Plotly’s exam saw 94.1% of prompt tokens as cache reads. A modeled 30-turn agent loop lands at 85% to 95%.
- Once caching works, output is the biggest line: 58.7% of the cost in the 90% example, so reasoning effort matters more than prompt trimming.
- Caching is automatic above 256 tokens, uses LRU eviction, and hits are not guaranteed.
How does the 40,000 in, 4,000 out example work?
The worked example comes from the OrcaRouter comparison and is easy to verify: a request with 40,000 input tokens and 4,000 output tokens costs about $0.051 with no cache and about $0.018 when most of the input is a cache hit. Here is the arithmetic written out, so you can reuse it.
Uncached: input is 40,000 x $1.00 / 1,000,000 = $0.0400. Output is 4,000 x $2.70 / 1,000,000 = $0.0108. Total $0.0508.
With 90% hits: 36,000 tokens are hits and 4,000 are misses. Hits cost 36,000 x $0.10 / 1,000,000 = $0.0036. Misses cost 4,000 x $1.00 / 1,000,000 = $0.0040. Input is $0.0076, output is still $0.0108, and the total is $0.0184. The saving is 1 - 0.0184 / 0.0508, which is 63.8%.
The table runs the same request at other hit rates. Output is $0.0108 in every row, so the whole change comes from input.
| Hit rate | Input cost | Total cost | Output share of total |
|---|---|---|---|
| 0% | $0.0400 | $0.0508 | 21.3% |
| 50% | $0.0220 | $0.0328 | 32.9% |
| 70% | $0.0148 | $0.0256 | 42.2% |
| 80% | $0.0112 | $0.0220 | 49.1% |
| 90% | $0.0076 | $0.0184 | 58.7% |
| 95% | $0.0058 | $0.0166 | 65.1% |
| 100% | $0.0040 | $0.0148 | 73.0% |
Two things follow. The curve has diminishing returns: the first 50 points of hit rate save 1.80 cents, the next 40 save 1.44, and the last 10 save 0.36. And a perfect cache still leaves $0.0148, because 4,000 output tokens and the 4,000 tokens of fresh input never go away. If your requests are mostly output, caching cannot do much for you. The StepFun API pricing explainer covers the three rates, and Step 5 cost per task shows what Artificial Analysis’s per-task figures imply.
How does Step 5’s cache work?
Step 5’s cache is automatic, prefix-based and not guaranteed. The StepFun prompt cache guide lists the rules, and each one has a cost consequence.
- It activates above 256 tokens. Caching uses 256 tokens as the minimum unit, so prompts shorter than 256 tokens never hit. Short chat turns get nothing; long system prompts, documents and tool definitions get most of the benefit.
- There is nothing to enable and no write fee. Uncached tokens, including the first write to the cache, bill at the miss rate; cached tokens bill at the hit rate. For
step-5andstep-5-previewthe hit rate is 10% of the miss rate. - It caches the whole conversation. The guide lists messages (system, user and assistant), images, video, and tool calls with their results as cacheable content.
- Eviction is least recently used. At peak traffic unused entries are evicted more aggressively; off-peak they live longer. The guide recommends sending long prompts off-peak.
- Hits are not guaranteed, and you cannot clear the cache. A request for guaranteed hits has to go through StepFun. To avoid a hit, change the prompt.
- It does not affect quality. Each generation still uses the full prompt.
How you see a hit depends on the format. On Chat Completions, usage.cached_tokens reports prompt tokens served from the cache, and a value above zero is a hit. On Responses, the usage object has input_tokens_details.cached_tokens. On Messages, the reference says usage includes input_tokens and output_tokens and that cache usage fields may also be present, so check what your response returns before you compute a ratio. The three formats are compared in Step 5 API: Chat Completions, Messages and Responses. StepFun’s own illustration shows 512 of 591 prompt tokens cached, billed as 512 at the hit rate and 79 at the miss rate; the total input count does not shrink, and cached tokens are not free.
What hit rates do real Step 5 users see?
Three public readings put the share of input served from cache between 86% and 94%, which is where a long-running agent should land if the prefix stays stable. None of them is your traffic, so treat them as a range to compare against.
| Source | Reading | What it covers |
|---|---|---|
| OpenRouter Step 5 page, first read | 86.3% cache hit rate, weighted input paid $0.1901 | Traffic routed through OpenRouter |
| OpenRouter Step 5 page, later read | 93.2%, weighted input paid $0.161 | Same page, later on 1 December 2026 |
| Plotly data analytics exam | 94.1% of prompt tokens were cache reads | 315 model calls, 15.6M tokens, one agent harness |
The OpenRouter numbers can be checked against the formula. At 93.2%, 1.00 - 0.90 x 0.932 = $0.1612, which matches the $0.161 shown. At 86.3% the formula gives $0.2233, but the first read showed $0.1901, which would imply a 90.0% hit rate. The page does not explain that mismatch, so use the price paid for budgeting and the percentage as a direction. The route comparison is in Step 5 on OpenRouter and Vercel AI Gateway.
Plotly’s figure converts to a price directly. If 94.1% of prompt tokens are hits, the effective input price is 1.00 - 0.90 x 0.941 = $0.1531 per 1M, which is 84.7% below the list price. Plotly processed about 362,000 tokens per question across 43 questions and 315 calls, roughly 49,500 tokens per call, so each call carried a long, mostly repeated history. That is the agent-loop shape, and the next section models it. The exam itself is covered in Step 5 on the Plotly data analytics exam.
Artificial Analysis also states a blended price of $0.54 per 1M tokens for Step 5, using a 7:2:1 ratio of cache-hit input, cache-miss input and output. Check it: 0.7 x $0.10 + 0.2 x $1.00 + 0.1 x $2.70 = $0.07 + $0.20 + $0.27 = $0.54. That blend assumes 70% of tokens are cache hits and 10% are output, a convention for comparing models, not a measurement of your traffic. See Artificial Analysis’s Step 5 page.
How does an agent loop change the math?
In an agent loop every turn resends the whole history, so input grows with the square of the turn count and caching matters more with every turn. The model below is deliberately simple, and its assumptions are stated so you can change them.
Let the loop start with a context of C tokens (system prompt, tools and the first user message). On each turn the model replies with o output tokens, and the next turn adds n new tokens (a tool result or a user message). Turn t then sends C + (t - 1) x (n + o) input tokens. Assume StepFun caches each request’s input, so on turn 2 and later the previous request’s whole input is a cache hit and only the previous reply plus the new tokens, n + o, are misses. Output of the previous turn is not cached until it appears in a later request’s input.
With C = 20,000, n = 1,500, o = 800 and T = 30 turns:
- Total input across all turns: 30 x 20,000 + 2,300 x (30 x 29 / 2) = 600,000 + 1,000,500 = 1,600,500 tokens.
- Misses: 20,000 + 29 x 2,300 = 86,700 tokens. Hits: 1,600,500 - 86,700 = 1,513,800 tokens, a 94.6% hit share.
- Output: 30 x 800 = 24,000 tokens.
- Cost with caching: 86,700 x $1.00 + 1,513,800 x $0.10 gives $0.0867 + $0.1514 = $0.2381 of input, plus 24,000 x $2.70 / 1,000,000 = $0.0648 of output, total $0.3029.
- Cost without caching: 1,600,500 x $1.00 / 1,000,000 = $1.6005 plus $0.0648, total $1.6653.
Caching saves 81.8% in this loop, and $0.0101 per turn on average. The hit share of 94.6% sits next to Plotly’s observed 94.1%, which is a reasonable sanity check on the model, not a proof.
One turn of the loop
Real caches miss sometimes. Suppose only 90% of the repeated prefix actually hits, because of eviction or a request that lands on a cold server. Then hits fall to 1,362,420, misses rise to 238,080, and the loop costs 238,080 x $1.00 + 1,362,420 x $0.10 = $0.2381 + $0.1362 = $0.3743 of input, plus $0.0648 of output, total $0.4391. The overall hit share becomes 85.1%, close to OpenRouter’s first read of 86.3%, and the saving against $1.6653 is still 73.6%. A single full miss late in the loop is expensive too. At turn 15 the prefix is 20,000 + 14 x 2,300 = 52,200 tokens, so losing the cache for that one call costs 52,200 x ($1.00 - $0.10) / 1,000,000 = $0.047 extra, more than the entire average turn.
Length matters because the uncached bill grows with the square of the turns while the cached one grows much more slowly.
Agent loop cost on Step 5, with and without caching
- Total input tokens across the loop
- 1,600,500
- Overall cache hit share
- 94.6%
- Cost with caching
- $0.30
- Cost with no caching
- $1.67
- Saving from caching
- 81.8%
- Output cost alone
- $0.06
Model: turn t sends the previous request's whole input as a cache hit and the previous reply plus new tokens as misses. The defaults are this post's 30-turn example; set the hit share to 0.9 to see the $0.44 case. Prices are StepFun's published rates; change them to model another vendor.
Where does the money go once caching works?
Once the prefix hits, output becomes the largest line, and reasoning is most of output. In the 30-turn loop at full reuse, output is $0.0648 of $0.3029, or 21.4%. In the single 40,000 and 4,000 request at 90% hits, output is $0.0108 of $0.0184, or 58.7%. The more your traffic looks like a long cached prefix with short fresh input, the more the bill is decided by how many tokens the model writes.
That shifts the optimization target. Trimming 2,000 tokens from a cached system prompt saves 2,000 x $0.10 / 1,000,000 = $0.0002 per call. Cutting a 15,000-token reply to 6,000 saves 9,000 x $2.70 / 1,000,000 = $0.0243. The second is about 120 times larger. StepFun’s headline claim is that Step 5 uses 53% fewer output tokens per task than Step 5 Preview, and Step 5 output token efficiency covers what that does and does not mean. For choosing how much the model thinks per request, see Step 5 reasoning effort: low, medium, high, xhigh, max.
What is stabilizing a prefix worth?
Moving tokens from “changes every request” to “stable and cacheable” saves $0.90 per million tokens, per request. The table multiplies that by prefix size and daily volume.
| Tokens made cacheable | Saving per request | 100 requests a day | 1,000 a day | 10,000 a day |
|---|---|---|---|---|
| 2,000 | $0.0018 | $0.18 | $1.80 | $18.00 |
| 10,000 | $0.0090 | $0.90 | $9.00 | $90.00 |
| 50,000 | $0.0450 | $4.50 | $45.00 | $450.00 |
The saving applies only on requests that actually hit, so scale it by your hit rate. A 10,000-token system prompt that is rebuilt with a timestamp at the top on every request is a miss every time, at $0.0100 per call instead of $0.0010. Fixing it is worth $9.00 a day at 1,000 calls. That is the kind of change to do first, because it takes minutes and affects every request.
Daily saving from making 10,000 tokens cacheable, in dollars
- 100 requests a day$0.90
- 1,000 requests a day$9.00
- 10,000 requests a day$90.00
How do you keep prefixes stable?
Keep everything that repeats at the start of the prompt, byte for byte, and put everything that changes at the end. StepFun’s guide gives the same tips, and a few practical consequences follow.
- Static first. System prompt, tool definitions, documents and few-shot examples go first; the user’s question, timestamps and request ids go last.
- No volatile fields near the top. A date, a session id or a random example order in the first lines makes every request a different prefix.
- Do not reorder tools or history. Appending is cache friendly; editing an earlier message is not. If you must summarize old turns, do it in one step and accept one full miss.
- Keep the same images and video. The guide says images and video in user messages cache as long as the same ones are reused.
- Space calls sensibly. Entries unused for a while can be evicted, so a long idle gap can cost a miss. The Claude Code idle session post describes the same effect on another vendor.
- Watch the hit rate. Log
cached_tokensoverprompt_tokens, as the guide recommends, and alert when it falls.
Our own prompt caching documentation gives the same advice for the gateway: keep the prefix byte-for-byte identical, put what changes last, and check cached_tokens. It also explains how caching bills on other vendors; for Claude, writes cost 1.25 times the input rate for the five-minute cache, so a prefix needs one or two reads to pay for itself, while StepFun’s cache has no write premium. For that comparison, read Claude Code prompt caching economics, and for another open-weight vendor’s rules, Qwen4 Max prompt caching guide. For the other tactics, see reduce LLM API costs.
Is your Step 5 prompt cache-friendly?
0 of 6 ticked
Expect misses
Restructure the prompt before you estimate costs from the 90% case.
What does this math not prove?
It does not prove your hit rate. The 86% to 94% readings come from OpenRouter traffic and one agent harness; a chat product with short sessions can sit near 0%. StepFun says hits are not guaranteed, and eviction is more aggressive at peak.
It does not include rate limits or latency. A cached prefix is billed less and, per StepFun, can speed up the first token in some cases, but it still counts as tokens in your tier, and the tier table in the API formats post applies. StepFun’s page in the passage we read does not say whether cached tokens count toward tokens per minute.
It does not account for images, video or long outputs you did not model, and the loop model ignores that the reply may reach 64K tokens. The 1M context window in Step 5 1M context window makes very long prefixes possible, and a long prefix is where a lost cache hurts most. And it does not compare Step 5 with other models: Step 5 Preview versus final covers the two StepFun models, which share the same price.
What should you do next?
Run three steps this week. First, log cached_tokens and prompt_tokens for a day of real traffic and compute your hit rate. Second, put your numbers into the calculator above and compare the output line with the input line. Third, fix the one volatile field at the top of your prompt if there is one. Then use the cost calculator tool for a monthly estimate, and set per-key limits with the cost control documentation.
The rest of the cluster is linked from the complete Step 5 guide. For how routes treat the same cache, read Step 5 on OpenRouter and Vercel AI Gateway; for renting versus hosting, Step 5 API or Preview weights; and for how a self-hosted server handles prefix caching, Step 5 Preview self-hosting with SGLang and vLLM. If you run many models behind one key, the gateway is OpenAI- and Anthropic-compatible, our pricing page shows what we charge, and Step 5 is on it as the free id step-5:free.
Run it on the free lane
On our gateway step-5:free costs $0 per token inside the free daily allowance (33 Step 5 requests a day), so the $1.00, $0.10 and $2.70 rates above are StepFun’s list prices, not what the free lane bills. Caching therefore does not change your balance there. It is still worth sending a stable prefix, because the same prompt shape is what you would run on a paid route later, and you can check the usage object of each reply for a cached_tokens field and compute your own hit rate. We do not promise that field is filled on every reply; if it is absent, measure on StepFun’s API instead. The Step 5 model page has live stats for the id.
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.oneaiapikey.com/v1")
system = open("long_stable_prefix.txt").read() # same bytes on every call
for q in ["Question one", "Question two"]:
r = client.chat.completions.create(
model="step-5:free",
messages=[{"role": "system", "content": system}, {"role": "user", "content": q}],
)
print(r.usage)Measure your own hit rate
Create an account, send a long stable prefix to step-5:free twice, and read the usage object on each reply. It is $0 per token inside the free daily allowance.
FAQ
How much does a cached token cost on Step 5?
Is there a fee to write to the Step 5 cache?
What is the minimum prompt length for caching?
What does a 40,000 in, 4,000 out request cost?
How do I know if a request hit the cache?
Why is my Step 5 hit rate lower than 90%?
Does caching change the quality of the answer?
Can I use Step 5 caching through One AI API Key?
Sources
- StepFun: Prompt cache best practices: 256-token minimum, LRU eviction, no write fee,
cached_tokens. - StepFun: Pricing and rate limits: $1.00, $0.10 and $2.70 per 1M tokens.
- StepFun: Step 5 model page: prompt caching listed as a supported feature.
- StepFun: Chat Completions API reference:
usage.cached_tokens. - StepFun: Responses API reference:
input_tokens_details.cached_tokens. - StepFun: Messages API reference: usage fields and that cache fields may be present.
- OpenRouter: StepFun Step 5: 86.3% and 93.2% cache hit rates and weighted input price paid.
- Plotly: Step 5 data analytics benchmark: 94.1% of prompt tokens as cache reads, 315 calls, 15.6M tokens.
- Artificial Analysis: Step 5: blended price of $0.54 per 1M and the 90% cache discount.
- OrcaRouter: Step 5 vs Step 5 Preview: the 40,000 in, 4,000 out worked example.
- StepFun: Introducing Step 5: the 53% fewer output tokens per task claim.