Which Managed Inference Providers Support Prefix Caching for Open Models? Seven, at 50% to 98% Off
Fireworks, Together, DeepInfra, Baseten, Groq, DigitalOcean and Friendli all cache prompt prefixes on open models automatically. What differs is the cached-token discount, which models qualify and how long the cache lives.
Prefix caching (also called prompt caching) is now automatic on open models at Fireworks AI, Together AI, DeepInfra, Baseten, DigitalOcean, Friendli and Groq, according to each provider's own documentation, and none of them needs a code change to turn it on. All of them bill cached input tokens below the standard rate, but the discount ranges from 50% at Groq to about 98% on DeepSeek V4.1 Flash at Together and Fireworks, and coverage is uneven: Groq caches only its three gpt-oss models, and several models at Together and DeepInfra list no cached price at all. Amazon Bedrock's caching guide does not mention any open-weight model. The useful question is not which provider caches, but what your model costs cached at each one.
What prefix caching actually does
Every request to a language model starts with a prefill step: the model reads the whole prompt and builds a key/value (K/V) cache, the internal state it needs to generate the answer. For an agent or a chat app, most of that prompt is the same on every call: the system prompt, the tool definitions, the documents, the earlier turns of the conversation. Prefix caching keeps the K/V state for that shared beginning and reuses it, so the provider only computes the new tail.
The rule that follows from this is strict. Fireworks' guide says "Prompt caching works only for exact prefix matches within a prompt," and that even a one-token change invalidates the cache from that point on. It names a common culprit: a timestamp at the top of the system prompt, which makes every request's prefix unique. Groq's documentation says the same about exact matching, and lists message arrays, tool definitions, structured-output schemas and images as cacheable content. Caching does not change what the model says; Fireworks notes that generations are still sampled fresh.
Two savings follow. The provider skips work, so the first token arrives sooner; Fireworks says caching can cut time to first token "by as much as 80%," a figure it gives without a benchmark. And on per-token serverless pricing, the provider passes part of the saving on as a cheaper rate for the cached tokens.
Who caches, and on what terms
All seven providers make caching automatic. The differences sit in four places: the discount, which models are covered, how long an entry lives, and how the cache is scoped.
Fireworks AI is the broadest. Its guide says caching "is enabled by default for all Fireworks models and deployments," and its pricing page says cached input is "billed at half price or less, with no write fee." Entries usually persist for at least several minutes and up to several hours, oldest evicted first. The cache lives on a single replica, and each serverless account gets its own; to keep a conversation on the same replica, send a stable ID in the user field or an x-session-affinity header.
Together AI caches automatically on both serverless and dedicated inference, with free cache writes and entries that "typically last about an hour," on a best-effort basis. Discounts are listed per model on its pricing page, and models with no cached price bill all input at the standard rate. Its docs add that cache hits still count toward rate limits.
DeepInfra caches automatically on "supported models" and tells users to "check the model page for details," so there is no single list. Its docs say only that cached input is billed "at a reduced rate"; the figures are on its pricing page. It is the one provider here that sells longer retention: a 5-minute or 1-hour window through prompt_cache_options, billed "at a cache-write premium upfront." Caches are scoped per model and per account.
Baseten serves reused prefixes from the K/V cache "at a discounted rate," with no flags required, and supports an x-session-affinity header. Its limits page says plainly that "cached and uncached input tokens count equally toward token rate limits."
Groq gives a flat 50% discount with no extra fee, but its docs say caching "is currently only supported" for gpt-oss-20b, gpt-oss-120b and gpt-oss-safeguard-20b. Entries expire after two hours unused, the minimum cacheable prompt is 128 to 1,024 tokens depending on the model, and cached tokens do not count toward rate limits, though Groq notes they are subtracted only after processing, so large parallel requests can still hit a limit. The cache discount does not stack with Groq's 50% batch discount.
DigitalOcean Serverless Inference, in docs updated October 20, 2026, caches every DigitalOcean-hosted model, discounts cached input "by up to 90% depending on the model," and charges nothing to write the cache. Entries have no fixed expiry and are evicted least-recently-used; a prefix has to fill a block of up to 256 tokens before it counts. Caches are isolated per account, and on these models caching cannot be switched off.
Friendli confirms in its help center that cached input "is billed at a lower rate than standard input" and that the discount applies automatically, but names no models or figure.
Cloudflare's Workers AI also enables prefix caching by default, but only "for select models," with compatibility listed on each model page and no discount figure on the caching page.
The discount depends on the model, not just the provider
Because most providers price cached tokens per model, the same provider can be generous on one model and stingy on the next. The list prices on November 17, 2026 show how far apart they are.
| Model | Provider | Input / cached, per 1M tokens | Cached discount |
|---|---|---|---|
| GLM-5.3 | Together, Fireworks | $1.40 / $0.26 | 81% |
| GLM-5.3 | Baseten | $1.40 / $0.14 | 90% |
| gpt-oss-120b | Groq | $0.15 / $0.075 | 50% |
| gpt-oss-120b | Fireworks | $0.15 / $0.015 | 90% |
| DeepSeek V4.1 Flash | Together, Fireworks | $0.30 / $0.006 | 98% |
| Kimi K3 | Together, Fireworks, Baseten, DigitalOcean | $3.00 / $0.30 | 90% |
Two gaps are worth naming. On GLM-5.3, Baseten's cached rate is about half of Together's and Fireworks', at the same uncached price. On gpt-oss-120b, Fireworks' cached rate is a fifth of Groq's, and Together and Baseten list no cached price for the model at all, so every input token there bills at the full rate. DeepInfra lists GLM-5.3 lower across the board, at $0.90 input and $0.20 cached on its list price, and it too shows no cached price for several models, including Llama 3.3 70B Instruct Turbo.
What a cache hit is worth in dollars
Take an agent that sends 100,000 requests a month on GLM-5.3, each with 10,000 input tokens and 500 output tokens. Assume 8,000 of those input tokens are a stable prefix that hits the cache and 2,000 are new. That is 800 million cached tokens, 200 million uncached and 50 million output a month.
At Together or Fireworks the bill is $280 for uncached input ($1.40 x 200), $208 for cached input ($0.26 x 800) and $220 for output ($4.40 x 50): $708. Without caching it would be $1,620. Baseten's lower cached rate brings the same workload to $612. DeepInfra's list prices give $540, against $1,100 uncached; its pricing page also shows a lower current price that would bring it to $337.50. The assumption that carries the result is the 80% hit rate. A cache that is evicted between turns, or a prompt that changes near the top, pushes the bill back toward the uncached figure.
Making hits happen
The prompt structure every provider recommends is the same: put the static parts first and the variable parts last.
- System prompt and instructions, with no timestamp or request ID in them.
- Tool and function definitions, in a fixed order.
- Reference documents and few-shot examples.
- The conversation history, appended rather than rewritten.
- The new user message last.
If the time matters, Fireworks suggests rounding it to the hour or moving it into the user message. For multi-replica serving, send the session-affinity header where it exists (Fireworks, Baseten, Cloudflare) or a prompt_cache_key (Together, DeepInfra); Fireworks adds that when moving traffic to a new deployment, routing by a hash of the session ID keeps hit rates higher than random sampling.
Checking that it works
The OpenAI-compatible field is usage.prompt_tokens_details.cached_tokens, documented by DeepInfra, Together, Baseten, Groq and DigitalOcean. Send the same long prompt twice to your provider's chat completions endpoint and read it on the second response (the model ID here is the one in DeepInfra's own example):
curl "$BASE_URL/chat/completions" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek-ai/DeepSeek-V4-Flash-0731",
"messages": [{"role": "system", "content": "<long static prompt>"},
{"role": "user", "content": "First question"}]}'
DeepInfra's documented response shows the pattern:
"usage": {
"prompt_tokens": 5000,
"completion_tokens": 50,
"total_tokens": 5050,
"prompt_tokens_details": { "cached_tokens": 4800 }
}
The hit rate is cached_tokens divided by prompt_tokens, here 96%. Together notes that some of its models report cached_tokens at the top level of usage instead. Fireworks' guide does not describe a cached-token field for serverless responses; on dedicated deployments it returns fireworks-prompt-tokens and fireworks-cached-prompt-tokens headers.
Dedicated deployments and switching models
Two cases fall outside the per-token discount. On dedicated GPUs, you pay for the hardware, not the tokens. Together's docs say its dedicated endpoints have no cached-token discount because billing is by GPU time; Fireworks says cached tokens on dedicated deployments are nearly free and that caching can raise throughput on the same hardware. Either way, the saving shows up as more requests per GPU rather than a cheaper line item.
The second case is a conversation that changes model between turns. Together's docs put the limit plainly: "KV states are specific to the model that computed them." None of the providers above documents carrying a cached prefix from one model to another, so an app that routes each turn to a different model pays full prefill on every switch. Parsec, which routes per turn to models it post-trains on a customer's traffic and runs them on a shared cluster, says on its comparison page that its universal K/V cache keeps the prefix usable across a switch and that a switch costs 15 to 19% of a full re-read. That is Parsec's own figure, with no independent measurement published; Parsec publishes no price for this service, its pages do not mention VPC or on-prem hosting for it, and its effect on time to first token has not been measured.
Bottom line
If you run a single open model on serverless inference, caching is already on wherever you are; compare the cached rate for your exact model, because it varies more than the uncached price. For GLM-5.3, Baseten has the lowest cached list rate and DeepInfra the lowest total bill on these assumptions; for gpt-oss-120b, Fireworks' 90% beats Groq's 50%, and Together and Baseten list no cached price. If rate limits are your constraint rather than cost, Groq is the only provider here whose docs keep cached tokens out of them. On dedicated GPUs, caching buys throughput, not a discount. Whatever you pick, fix the prompt order first and read cached_tokens on the second request before you trust any saving.
Last updated November 17, 2026. All prices are list prices per million tokens on that date.
Sources
- Fireworks AI, Prompt caching: https://docs.fireworks.ai/guides/prompt-caching
- Fireworks AI, Pricing: https://fireworks.ai/pricing
- DeepInfra, Prompt caching: https://docs.deepinfra.com/chat/prompt-caching
- DeepInfra, Pricing: https://deepinfra.com/pricing
- Together AI, Prompt caching: https://docs.together.ai/docs/inference/chat/prompt-caching.md
- Together AI, Pricing: https://www.together.ai/pricing
- Baseten, Model APIs pricing and limits: https://docs.baseten.co/inference/model-apis/pricing-and-limits
- Baseten, Pricing: https://www.baseten.co/pricing
- Groq, Prompt caching: https://console.groq.com/docs/prompt-caching
- Groq, gpt-oss-120b model page: https://console.groq.com/docs/model/openai/gpt-oss-120b
- DigitalOcean, How to use prompt caching in Serverless Inference: https://docs.digitalocean.com/products/inference/how-to/use-prompt-caching/
- Friendli, Do you have prompt/prefix caching?: https://learn.friendli.ai/articles/1642519275-q7-2-do-you-have-prompt-prefix-caching-to-reduce-cost-for-shared-system-prompts
- Cloudflare Workers AI, Prompt caching: https://developers.cloudflare.com/workers-ai/features/prompt-caching/
- Amazon Bedrock, Prompt caching: https://docs.aws.eu/bedrock/latest/userguide/prompt-caching.html
- Parsec vs routers: https://parseclab.ai/compare/routers/
- Parsec vs your own GPUs: https://parseclab.ai/compare/own-gpus/