HomeBlog › Memorizzazione rapida nella cache

In che modo la memorizzazione nella cache tempestiva riduce la bolletta LLM fino al 90%

Published 2026-06-21 · reference numbers, verify before budgeting

If your app sends the same long system prompt, the same retrieved documents, or the same growing chat history on every call, you're paying full price to re-read text the model has already seen seconds ago. Memorizzazione nella cache immediata is the fix, and it's the single biggest line-item discount most teams never turn on. Done right it cuts input cost by 50% to 90%. Here's how it works, the 2026 numbers, and where it quietly doesn't help.

Cosa fa effettivamente la memorizzazione nella cache

Una fattura LLM è per lo più input tokens × price + output tokens × price. Caching attacks the input half. When you mark a chunk of the prompt as cacheable, the provider stores its processed form for a short window; on the next call that reuses the exact same prefix, you're billed a fraction of the normal input rate for those tokens instead of the full amount. The output price is untouched — caching only discounts the part you keep resending.

The 2026 discounts (reference)

FornitoreCached input priceNote
OpenAI~50% dell'inputAutomatic on long prompts, no code change
Anthropic (Claude)~10% of input on readsUp to 90% off — but ~25% write premium first time
Google Gemelli~25% of inputContext caching; may add a small storage fee
⚠️ Reference figures, June 2026 — exact discounts, cache lifetimes and any storage fees change. Confirm on each provider's pricing page. Anthropic and Gemini use explicit cache markers; OpenAI applies it automatically to qualifying prefixes. · Segnala prezzo obsoleto →

A worked example

Say a support assistant sends a 2,000-token system prompt + knowledge base on every message, plus ~200 tokens of the user's actual question, and returns ~300 output tokens. At 10,000 conversations a month, the fixed 2,000-token block is re-sent 10,000 times. Using a model at $2.50 / 1M input:

Scalalo a 100.000 o 1 milione di conversazioni e il prefisso statico fa la differenza tra una fattura comoda e una allarmante. Più grande e ripetuto è il contesto fisso, maggiore è il valore della memorizzazione nella cache: le app RAG e gli agenti con prompt di sistema lunghi ne traggono i maggiori vantaggi.

Quando la memorizzazione nella cache NON aiuta (i trucchi)

La regola pratica

Memorizza nella cache quando invii di nuovo un blocco di contesto ampio e identico frequentemente e rapidamente: prompt di sistema, definizioni di strumenti, documenti RAG, esempi di poche riprese, lunga cronologia di chat. Non preoccuparti di chiamate una tantum, richieste altamente variabili o carichi di lavoro pesanti. Strutturare il prompt static-first, variable-last, and the discount is close to free money. Put a number on your own case with the calcolatore rapido del risparmio di memorizzazione nella cache, and compare models on the Calcolatore dei costi dell'API AI.

Domande frequenti

How much can prompt caching save?

Typically 50–90% off the input price for the cached portion, depending on provider. It only discounts repeated input tokens, not output.

Does prompt caching change the model's answers?

No. It's a billing/latency optimization — the model sees the same tokens, you just pay less to re-send the cached prefix. Responses are unchanged.

Perché la memorizzazione nella cache ha fatto aumentare la mia fattura?

Quasi sempre il premio di scrittura (ad esempio il supplemento di circa il 25% di Anthropic per creare la cache) sui prefissi che non vengono riutilizzati abbastanza prima della scadenza, o un prefisso che cambia ogni chiamata in modo che non venga mai raggiunto. La memorizzazione nella cache ripaga con un riutilizzo frequente e identico.

Stime di riferimento: verifica sempre sconti e commissioni sulla pagina dei prezzi ufficiali del fornitore.