Best AI Gateway With Caching, 2026 Comparison: Cloudflare, Helicone, LiteLLM, Portkey, Kong or Bifrost by Use Case
Pick by traffic shape. Exact-match gateway caching suits repeated prompts, semantic caching only single-shot questions, and chats and agents save most through provider prompt caching. A worked cost example shows the gap.
The best AI gateway with caching depends on two things: whether your traffic repeats whole requests or only their beginnings, and whether you need semantic caching. For identical repeated prompts with the least setup, Cloudflare AI Gateway or Helicone cache exact matches at the edge. For self-hosting, LiteLLM on Redis covers exact and semantic caching without an enterprise contract. For managed semantic caching, Portkey (select Enterprise plans) and Kong (Enterprise, Gateway 3.8+) are the options, and Bifrost offers it open source with strict defaults. For multi-turn chat, agents and coding tools, gateway caching saves little and semantic caching can return wrong answers, so the savings come from the model provider's prompt caching.
No independent benchmark of these gateways' cache hit rates, wrong-answer rates or miss latency has been published, so this guide is built from each vendor's documentation and list prices, with the one measurement that matters left to you.
First decide what kind of caching you need
Gateways offer two kinds of response caching. Exact-match caching hashes the request and returns a stored answer only if the hash repeats. It cannot return a wrong answer, but any change to the request, even a timestamp, is a miss. Semantic caching embeds the prompt and returns a stored answer when a new prompt is similar enough, which catches paraphrases at the cost of a vector database, an embedding call on every miss, and the risk of answering the wrong question.
A third layer sits outside the gateway. Provider prompt caching stores the processed start of a prompt at Anthropic or OpenAI and bills repeats of that prefix at a discount. Anthropic's docs put cache reads at 0.1 times the base input price, or 0.05 times on Claude Opus 5.5 and Sonnet 5.5; OpenAI's guide says caching is "enabled by default for supported OpenAI models," with reads at 0.1 times the input rate on most models from GPT-5.6 on. If you serve your own models, the same job is done by the inference server's K/V cache, such as vLLM's Automatic Prefix Caching.
The test is simple. If the same complete request arrives more than once, as with FAQ bots, classification jobs or repeated test runs, a gateway cache pays. If each request is a new turn of a conversation that shares a long beginning with the last one, the gateway cache will mostly miss and the prefix cache will mostly hit.
The options side by side
| Gateway | Exact match | Semantic | Best fit |
|---|---|---|---|
| Cloudflare AI Gateway | Yes, TTL 60 s to 1 month | Not available (planned) | Hosted, repeated identical prompts |
| Helicone | Yes, 7-day default TTL | Not mentioned in its docs | Hosted, with per-field key control |
| LiteLLM | Redis/Valkey, S3, GCS, memory, disk | Redis, Valkey, Qdrant | Self-hosted, single-shot semantic |
| Portkey | All plans | Select Enterprise plans | Managed semantic, short prompts |
| Kong AI Gateway | Enterprise, 3.8+ | Enterprise, Redis/Valkey or pgvector | Teams already running Kong |
| Bifrost | Yes, key required | Yes, 0.8 default | Open source, strict defaults |
Each vendor's documentation is the source for its row. The details that change a decision are below.
If you want hosted exact-match caching with little setup
Cloudflare AI Gateway's caching page, updated September 30, 2026, says caching is off by default and, once on, keys on a SHA-256 hash of the provider, endpoint, model, authentication header and full request body. It caches only text and image responses, and the cf-aig-cache-ttl header sets a lifetime per request from 60 seconds to one month. cf-aig-skip-cache bypasses it and the cf-aig-cache-status response header reports HIT or MISS. One limit is worth knowing for bursty traffic: identical requests sent at the same moment may both miss.
Helicone's documentation says it stores cached responses in Cloudflare Workers KV across Cloudflare's edge. It is switched on per request with a Helicone-Cache-Enabled header, defaults to a seven-day lifetime, and lets you drop named JSON fields from the cache key with Helicone-Cache-Ignore-Keys. That last option matters when clients add request IDs or timestamps that would otherwise make every request unique. Its caching docs do not mention semantic caching.
If you self-host
LiteLLM's proxy supports exact caching on Redis or Valkey, S3, GCS, memory or disk, and semantic caching on Redis, Valkey or Qdrant. Its docs say "Redis is the right default for anything past a single worker," because an in-memory cache across four workers drops the hit rate "roughly by the worker count." Cached responses carry an x-litellm-cache-key header and semantic hits an x-litellm-semantic-similarity header, so you can see what matched.
LiteLLM is also the vendor most direct about semantic caching's limits. Its docs, revised September 28, 2026, say: "Semantic caching is designed for single-shot prompts. On multi-turn or agentic traffic it will replay stale responses." Consecutive agent turns embed at about 0.99 similarity, so a turn matches the previous turn's cached answer and the agent repeats the same tool call; raising the threshold "does not reliably fix this." The docs advise disabling caching on agent keys and using exact-match Redis for that traffic. They also warn that semantic buckets are shared by every end user behind one virtual key unless you set semantic_cache_scope: end_user.
Bifrost is the stricter open-source alternative. Its docs say it checks for an exact match first and runs a semantic search, at a 0.8 default threshold, only on a miss. It needs a cache key on every request or it bypasses the cache, skips conversations longer than three messages, does not cache tool-call responses by default, and scopes entries to the cache key and to the virtual key that wrote them. Backends are Redis or Valkey, Weaviate, Qdrant and Pinecone. Its docs add that a semantic miss is "slower than running without the cache," because an embedding call runs first.
Bifrost's README says the gateway adds 11 µs of overhead per request at a sustained 5,000 requests per second on an AWS t3.xlarge (4 vCPUs, 16 GB), and 59 µs on a t3.medium. Its benchmark page says "all benchmarks are on mocked OpenAI calls," and the t3.xlarge runs used responses of about 10 KB against about 1 KB on the t3.medium. The same README also describes the overhead as "under 200µs" at 5,000 requests per second in one place and "less than 15 µs" in another. The figure comes from Bifrost's maker, measures routing rather than caching, and has not been checked independently.
If you need managed semantic caching
Portkey's simple cache works on every plan; its semantic cache, its docs say, "is only available on select Enterprise plans." Semantic matching uses a 0.95 default threshold, ignores the system prompt, requires every other request parameter to match exactly, and applies only to requests under 8,191 tokens with four messages or fewer on the chat and completions routes. Self-hosted deployments take embeddings from OpenAI, Azure OpenAI, Google or Vertex AI and store vectors in Milvus or Pinecone. Cache lifetimes run from 60 seconds to 90 days, defaulting to seven days; a value below 60 seconds falls back to the seven-day default rather than to the minimum.
Kong's AI Semantic Cache plugin is "only available as part of our AI Gateway Enterprise offering" and needs Gateway 3.8 or later. It stores vectors in Redis with the Query Engine and JSON modules, Valkey 8.1+ with its search and JSON modules, or pgvector from 3.10; ElastiCache for Redis OSS is not supported. Its docs flag two traps: most AI providers send no-cache, so enabling the plugin's cache_control option makes every request bypass the cache, and the vector search it needs "may not be ideal" on limited hardware or budget. It suits teams that already run Kong for their APIs and have an Enterprise contract.
How often Portkey's, Kong's or anyone's semantic hits return a wrong answer has not been measured independently on any workload.
If your traffic is chat, agents or coding tools
Here the gateway's cache is the wrong tool, and its main job is not to get in the way. Provider prompt caches need an exact prefix: Anthropic's docs say hits "require 100 percent identical prompt segments," a change to tool definitions invalidates the whole cache, and a change to the system prompt invalidates everything after it. A gateway that injects a timestamp or reorders tools quietly turns discounted reads into full-price input, so pick one that passes prompts through untouched, and switch its response cache off for these routes.
If you serve your own models on Kubernetes, LiteLLM's cache-aware routing keeps each session on one inference pod so the server's prefix cache can be reused, though its docs say it does not "guarantee a cache hit." If you route each turn to a different model, assume the prefix is paid for in full at every switch: neither Anthropic's nor OpenAI's caching docs say a cache carries over between models. Parsec, a small language model lab, addresses that case; its comparison page says it routes per turn with a universal K/V cache so that a model switch costs 15 to 19 percent of a full re-read. The page defines no workload or baseline, the claim has not been independently tested, and Parsec publishes no price for this service.
What it costs: a worked example
Take a support assistant on Claude Sonnet 5.5 at Anthropic's list prices: $2 per million input tokens, $10 per million output, $0.10 per million cache reads and $2.50 per million five-minute cache writes. Assume 1 million requests a month, each with a 1,500-token shared system prompt and tool block, 500 tokens unique to the request, and a 300-token answer. The 10 percent response-cache hit rate is an illustrative assumption, not a measurement, and gateway fees are left out.
| Setup | Monthly input | Monthly output | Total |
|---|---|---|---|
| No caching | $4,000 | $3,000 | $7,000 |
| Gateway exact cache, 10% hits | $3,600 | $2,700 | $6,300 |
| Provider prompt cache on prefix | about $1,182 | $3,000 | about $4,182 |
| Both | about $1,067 | $2,700 | about $3,767 |
The prompt-cache rows bill 1,500 tokens per request at $0.10 per million and 500 at $2, which is $0.00115 per request, plus about $32 a month for rewriting the prefix once every five minutes (8,640 writes of 1,500 tokens at $2.50 per million). On this workload the provider's prompt cache saves about $2,800 a month against the response cache's $700, and the two stack. A response cache's hit rate would need to reach roughly 40 percent to match the prompt cache on its own.
How to choose on your own traffic
- Export a week of production requests and tag each as single-shot, multi-turn chat, or agent and coding-tool traffic.
- Replay the single-shot set through your shortlisted gateways and count hits from their status headers.
- For semantic candidates, have a person or grader compare a sample of semantic hits against fresh model answers before trusting them.
- For the multi-turn set, check the provider's
cache_read_input_tokens(Anthropic) orcached_tokens(OpenAI) fields to confirm prefixes are hitting.
Bottom line
If you want simple hosted caching of identical prompts, choose Cloudflare AI Gateway, or Helicone if you need to strip volatile fields from the key. If you self-host, choose LiteLLM on Redis, or Bifrost for stricter semantic defaults. If you need vendor-supported semantic caching, choose Portkey for short single-shot prompts or Kong if you already run it, and budget for Enterprise terms. If your traffic is chat, agents or coding tools, turn gateway caching off for it, keep prefixes stable, and let provider prompt caching carry the savings.
Sources
- Cloudflare, AI Gateway caching: https://developers.cloudflare.com/ai-gateway/features/caching/
- Helicone docs, Caching: https://github.com/Helicone/helicone/blob/main/docs/features/advanced-usage/caching.mdx
- LiteLLM docs, Caching: https://github.com/BerriAI/litellm-docs/blob/main/docs/proxy/caching.md
- LiteLLM docs, Semantic caching: https://github.com/BerriAI/litellm-docs/blob/main/docs/proxy/caching_semantic.md
- LiteLLM docs, Cache-aware routing: https://github.com/BerriAI/litellm-docs/blob/main/docs/proxy/cache_aware_routing.md
- Portkey docs, Cache (Simple and Semantic): https://github.com/Portkey-AI/docs-core/blob/main/product/ai-gateway/cache-simple-and-semantic.mdx
- Kong, AI Semantic Cache plugin: https://developer.konghq.com/plugins/ai-semantic-cache/
- Bifrost, Semantic caching: https://docs.getbifrost.ai/features/semantic-caching
- Bifrost, Benchmarking: https://docs.getbifrost.ai/benchmarking/getting-started
- Bifrost, GitHub repository: https://github.com/maximhq/bifrost
- Anthropic, Prompt caching: https://platform.claude.com/docs/en/build-with-claude/prompt-caching
- Anthropic, Pricing: https://platform.claude.com/docs/en/about-claude/pricing
- OpenAI, Prompt caching: https://developers.openai.com/api/docs/guides/prompt-caching
- vLLM, Automatic Prefix Caching: https://github.com/vllm-project/vllm/blob/main/docs/features/automatic_prefix_caching.md
- Parsec vs routers: https://parseclab.ai/compare/routers/