Infyrence
ModelsPricingBlogDocs
DashboardSign in
Back to Blog
Engineering

Prompt Caching: Cut Your API Costs by Up to 90%

Prompt caching lets you reuse expensive prefill computation across requests. Here is how it works at the infrastructure level and how to use it through the Infyrence API today.

Sayyed Hojjat Mousavinezhad

Sayyed Hojjat Mousavinezhad

Founder & CEO

June 19, 2025
6 min read
Prompt Caching: Cut Your API Costs by Up to 90%

The Problem

Every time you send a large system prompt - a 50-page document, a long tool definition block, a huge few-shot example set - the model has to process it from scratch. This prefill step is expensive and slow.

How Caching Works

Prompt caching stores the KV cache from the prefill computation. On subsequent requests that share the same prefix, the model skips the prefill for that prefix entirely.

The result: up to 90% cost reduction and 3–5x lower latency on cached prefixes.

Caching Flow Diagram

Using It Through Infyrence

Set cache_control on the messages or system block you want to cache:

{
  "model": "anthropic/claude-3-5-sonnet",
  "system": [
    {
      "type": "text",
      "text": "You are a legal document analyst...",
      "cache_control": { "type": "ephemeral" }
    }
  ],
  "messages": [{ "role": "user", "content": "Summarize section 4." }]
}

Infyrence normalizes cache control across providers - the same syntax works whether the model is Claude, GPT-4o, or Gemini.

Cache Lifetime

Caches are ephemeral (5 minutes) by default. Persistent cache tiers are coming in Q3.

PerformanceCostEngineering

More in Engineering

How Infyrence Routes Your Requests in Real Time

Engineering

How Infyrence Routes Your Requests in Real Time

A technical look at the routing infrastructure behind Infyrence - latency-aware selection, health ch...

7 min read
Infyrence

The unified AI inference platform for developers building at scale.

Stay updated

Product

ModelsChangelog

Developers

DocumentationBlogStatus

Company

AboutCareersContact

Legal

PrivacyTermsRefund PolicySecurityCookies

© 2026 Infyrence. All rights reserved.

All systems operational