How an Anthropic Engineer Saved 300 Million Tokens in a Week: A Claude Code Caching Guide

marsbitPubblicato 2026-05-24Pubblicato ultima volta 2026-05-24

Introduzione

Anthropic engineers reveal how prompt caching in Claude Code dramatically reduces token consumption. By reusing already-processed context, cached tokens cost only 10% of regular input tokens. The author saved over 300 million tokens in a week, with 91 million cached tokens in a single day counted as roughly 9 million for billing. Caching works via prefix matching across three layers: system (instructions, tools), project (CLAUDE.md, rules), and conversation (chat history). As long as the beginning of a request matches cached content, Claude reuses it instead of reprocessing. Key points for users: - Claude Code's cache TTL is 1 hour (vs. 5 minutes for API/Sub-agents). Avoid pausing a session beyond this. - Switching models (including enabling "Opus plan" mode) breaks cache, forcing a full reprocess. - For task switching, use a clear session handoff instead of letting an old session expire. - Place large documents in Projects, not directly in chat, for better caching. High cache reuse benefits both users (longer sessions) and Anthropic (lower costs). Monitoring cache hit rates is crucial internally. By managing context as an asset and avoiding cache-breaking habits, users can make their Claude Code sessions more efficient and cost-effective.

Editor's Note: When many people use Claude Code, the most intuitive feeling is that Token consumption is too fast, and long sessions can easily eat up the quota. But from the perspective of an Anthropic engineer, what truly affects cost is often not how much code you write, but whether the system consistently reuses context that has already been processed.

The core of this article is how to save Tokens through caching mechanisms. The author reused over 300 million Tokens through caching in one week, with a single-day cache hit reaching 91 million. Since the cost of a cached Token is only 10% of a regular input Token, this means 91 million cached Tokens are billed roughly equivalent to 9 million regular Tokens. The reason Claude Code long sessions seem more "durable" isn't because the model works for free, but because a large amount of repeated context is successfully reused.

The key to prompt caching is "don't break the cache." Claude Code caches system prompts, tool definitions, CLAUDE.md, project rules, and conversation history in layers; as long as the prefix of subsequent requests remains consistent, Claude can directly read from the cache instead of reprocessing the entire context. Anthropic internally also monitors prompt cache hit rates because it affects not only user quotas but also directly impacts model service costs and operational efficiency.

For ordinary users, you don't need to understand all the underlying details, just master a few key habits: don't let a session sit idle for more than 1 hour; perform a clean session handoff when switching tasks; avoid frequently switching models; put large documents into Projects instead of repeatedly pasting them into the conversation.

This article is less about a Token-saving trick and more about providing a Claude Code usage approach closer to an engineer's mindset: treat context as an asset to manage, let the cache be continuously reused, and make long sessions do less repetitive computation.

The following is the original text:

I saved 300 million Tokens this week, 91 million in a single day, over 300 million in a week.

I didn't change any settings. This is just prompt caching working normally in the background.

But after I truly understood what caching is and how to avoid "breaking" it, with the same usage quota, my sessions could last longer. So, here is a compiled 80/20 introductory guide to Claude Code prompt caching, without delving into deep API-level details.

TL;DR

Cached Tokens cost only 10% of regular input Tokens. 91 million cached Tokens are billed approximately equivalent to 9 million Tokens.

Claude Code subscription cache TTL is 1 hour; API default is 5 minutes; Sub-agent is always 5 minutes.

Caching is divided into three layers: system, project, and conversation.

Switching models mid-conversation breaks the cache, including enabling "opus plan" mode.

How is caching actually billed?

Every cached Token costs 10% of a regular input Token.

So, when my dashboard shows 91 million Tokens hitting cache on a particular day, the actual billing is roughly equivalent to processing only 9 million Tokens. This is also why, compared to having no cache, using Claude Code for long periods makes the session feel almost "free" to extend.

Two numbers on the dashboard are worth focusing on:

Cache create: The one-time cost incurred when writing content to the cache. It starts to take effect in the next round of conversation.
Cache read: Tokens Claude reuses from the cache, such as your CLAUDE.md, tool definitions, previous messages, etc. Cost is 10 times cheaper compared to reprocessing them as input.

If your Cache read number is high, it means you are effectively utilizing the cache; if this number is low, it means you are repeatedly paying for the same context.

Anthropic's Thariq once said something that left a deep impression on me: "We actually monitor prompt cache hit rates, and if the hit rate gets too low, it triggers an alert, even declaring a SEV-level incident."

He also wrote a great X article. When cache hit rates are high, four things happen simultaneously: Claude Code feels faster, Anthropic's service costs decrease, your subscription quota seems more durable, and long coding sessions become more realistic.

But if the hit rate is low, everyone loses.

So, the incentives are actually aligned: Anthropic wants your cache hit rate higher, and you yourself want the hit rate higher. What truly holds things back are some seemingly insignificant habits that quietly reset the cache.

How does the cache grow with each conversation turn?

Caching relies on prefix matching.

Without getting too deep into technical details, you just need to understand one thing: as long as the content before a certain position is completely identical to what's already cached, Claude can reuse those cached Tokens.

A brand new session typically unfolds like this:

According to Claude Code documentation, a fresh session usually runs like this:

First conversation turn: No cache exists yet. The system prompt, your project context (like CLAUDE.md, memory, rules), and your first message are all processed from scratch and written to the cache.

Second conversation turn: All content from the first turn is now cached. Claude only needs to process your new reply and the next message. This round is much cheaper.

Third conversation turn: Same logic. Previous conversation remains in the cache, only the latest round of interaction needs reprocessing.

The cache itself can be divided into three layers:

From Thariq's X article:

System layer: Includes base instructions, tool definitions (read, write, bash, grep, glob), and output style. This layer is cached globally.

Project layer: Includes CLAUDE.md, memory, project rules. This layer is cached per project.

Conversation layer: Includes replies and messages, growing with each conversation turn.

If anything in the system or project layer changes mid-session, everything must be recached from scratch. This is the most "expensive" operation. Imagine: you're already on the 16th message, then suddenly change the system prompt, or pause for an hour, all Tokens from message 1 onward need to be reprocessed.

The confusion between 1 hour and 5 minutes

This is the most easily misunderstood point.

Claude Code subscription: Default TTL is 1 hour.

Claude API: Default TTL is 5 minutes. You can pay a higher cost to increase it to 1 hour.
Sub-agent on any plan: Always 5 minutes.

Claude.ai web chat: Not officially documented. Likely same as subscription, but I haven't confirmed.

A few months ago, many people complained that Claude subscription quotas were being consumed too quickly. Some thought Anthropic had quietly reduced TTL from 1 hour to 5 minutes without notifying users. But that wasn't the case; Claude Code's TTL remains 1 hour.

The problem is, Claude Code and API documentation are kept separate, and these are two completely different things, leading to much confusion.

If you're running many Sub-agent workflows, or using the API directly, the 5-minute figure is important. But for 95% of Claude Code users, what really matters is that 1-hour window.

Three habits that cover 95% of users

The following are parts I find truly useful for daily use.

Don't pause too long

If you've been idle for more than an hour, previous content has mostly expired from the cache. Your next message will rebuild the cache. In such cases, instead of resuming an old session that has "gone cold," it's often cheaper to do a clean handoff and start a new session.

When switching tasks, just start fresh

/compact or /clear inherently break the cache, so it's better to use that moment for a true reset.

I made a session handoff skill to replace /compact. It summarizes what we've completed, what pending decisions remain, which files are most important, and where to continue next. Then I run /clear, paste this summary in, and can proceed as if nothing was interrupted.

The compact command sometimes runs slowly too. This handoff skill usually finishes in under a minute.

In Claude chat, put large documents into Projects

The caching mechanism on Claude.ai isn't officially documented in great detail, but Projects clearly use different optimizations compared to regular chat threads. So, if you need to paste large documents, it's better to put them in a Project rather than directly into the chat.

Which operations quietly break the cache?

A few things can completely reset the cache without obvious warning.

Switching models: Because caching relies on prefix matching, and each model has its own cache. Switching models means the next request will read the full history with no cache hits.

"Opus plan" mode: This setting uses Opus for planning and Sonnet for execution. I recommended it in some token optimization videos for a reason. But it's important to understand that each plan switch is essentially a model switch, meaning the cache must be rebuilt. In the long run, it still helps extend session quota, but you need to know what's happening under the hood.

Editing CLAUDE.md mid-session is okay: This change doesn't take effect immediately; it applies on the next restart. Therefore, the currently running cache isn't affected.

My free Token dashboard

The screenshot I showed earlier is from a token dashboard.

It's a simple GitHub repo. You give the link to Claude Code, have it deploy locally on localhost, and it will read all your past session records instead of starting statistics from scratch. You immediately see daily input, output, cache create, and cache read data.

One thing to note: this dashboard counts Token data on your local device. If you switch from desktop to laptop, the numbers won't match exactly. Each device has its own statistical view.

Summary

Prompt caching is something you can research deeply. Thariq's article covers it more completely than here; if you want the full picture, it's worth reading.

But you don't need to understand all the details to benefit. You just need to grasp the key 80/20: cached Tokens are 10 times cheaper than regular Tokens; Claude Code TTL is 1 hour; switching models breaks the cache; making a clean handoff between tasks is usually more cost-effective than forcing an old session back to life after it "expires."

Domande pertinenti

QWhat is the core mechanism described in the article for significantly reducing Claude Code costs?

AThe core mechanism is prompt caching, where previously processed context (system prompts, tool definitions, project files, conversation history) is stored and reused. If a new request's prefix matches the cached content, Claude reads from the cache instead of reprocessing, costing only 10% of a standard input token.

QWhat is the key financial benefit of high cache read rates mentioned in the article?

ATokens read from the cache are billed at only 10% of the cost of standard input tokens. This means high cache read rates make a Claude Code subscription last significantly longer, as repeated context is not fully re-processed and paid for.

QWhat are the three main layers of prompt caching in Claude Code, according to the article?

AThe three layers are: 1. System Layer (global cache for base instructions, tool definitions like read/write/bash, and output style). 2. Project Layer (cached per project, includes CLAUDE.md, memory, project rules). 3. Conversation Layer (cached per session, includes the growing history of messages and replies).

QWhat is the single most common user action that will completely reset the prompt cache in an active Claude Code session?

ASwitching the model mid-conversation. Because cache relies on prefix matching and each model has its own cache, switching models forces Claude to reprocess the entire context from scratch with no cache hits.

QWhat practical habit does the author recommend for switching tasks to better preserve caching benefits?

APerform a clear session handoff instead of letting a session idle past the TTL. The author uses a custom 'session handoff skill' to summarize progress, pending decisions, and key files before using /clear. This summary is pasted into the new session, providing continuity while allowing a fresh, efficiently cached session to begin.

Letture associate

Are Rising U.S. Stocks Getting More Dangerous? Goldman Sachs: Downside Protection Mechanisms Have Almost Failed

The US stock market rally is showing signs of becoming increasingly precarious as key downside protection mechanisms fail, according to Goldman Sachs. Derivatives strategist Brian Garrett notes that the S&P 500 options volatility skew has plunged to an 18-month low, indicating the market now prices an 8% probability for both a 10% drop and a 10% rise—a sign of "skew failure." Concurrently, Goldman's Panic Index hit a two-year low, reflecting minimal demand for tail-risk hedging. This complacency emerges amid a relentless market surge, with the S&P 500 setting new records frequently in 2024. Garrett highlights three major concerns: extreme concentration in the top ten stocks (40% of index weight), heavy reliance on AI-themed performance, and a price pattern eerily similar to the 1998-1999 period. Despite pervasive media pessimism, this fear is absent in options pricing. Downside hedge costs are historically low. Goldman suggests tactical trades: buying RSP outperformance options versus the SPX for a broadening rally, purchasing VIX calls for protection, and going long on Bitcoin ETF volatility. Hedge funds have been net buyers for two weeks, with sector rotation into financials and out of industrials. Notably, the global single-stock leveraged/ inverse ETF AUM has doubled to over $60 billion in two months, underscoring growing speculative activity.

marsbit13 min fa

Are Rising U.S. Stocks Getting More Dangerous? Goldman Sachs: Downside Protection Mechanisms Have Almost Failed

marsbit13 min fa

DAT Failure? Listed Companies Betting on HYPE Floating Profit of $12.5 Billion

Several public companies that adopted a "HYPE Treasury" strategy—holding significant reserves of the HYPE token from the Hyperliquid ecosystem—have achieved substantial paper gains, collectively exceeding $1.25 billion. This contrasts with the reported struggles of MicroStrategy's flagship BTC treasury strategy. The article profiles three such HYPE-focused treasury companies: 1. **Hyperliquid Strategies Inc. (PURR):** The largest holder, with approximately 22.3 million HYPE tokens valued at ~$1.636 billion, resulting in an unrealized gain of ~$1.22 billion. It has fully transitioned from a biotech firm to a dedicated crypto treasury, adding staking and validator operations to enhance returns. 2. **Hyperion DeFi (HYPD):** Holds around 2 million HYPE tokens (~$147 million value) with a gain of ~$49.4 million. It is deeply integrated into the Hyperliquid ecosystem, running a major validator node and building DeFi products for additional yield. 3. **Lion Group Holding (LGHL):** A smaller holder with ~194,000 HYPE tokens (~$14.14 million value), maintaining a long-term commitment to the token. The success of these HYPE treasuries is attributed not only to the token's significant price appreciation but also to active on-chain participation through staking, validation, and ecosystem integrations, creating a compounding "flywheel" effect. The article posits that while MicroStrategy's BTC strategy faces challenges, HYPE treasuries may offer a more sustainable model through deeper protocol engagement, with potential for further growth if HYPE's price rises as predicted by some analysts.

marsbit33 min fa

DAT Failure? Listed Companies Betting on HYPE Floating Profit of $12.5 Billion

marsbit33 min fa

DAT Failing? Listed Companies Betting on HYPE Have Floating Profits of $12.5 Billion

Facing a potential need to sell Bitcoin to pay dividends amid a $12.5B quarterly net loss, the crypto treasury strategy pioneered by Strategy appears strained. In contrast, public companies that adopted a similar strategy by betting on the HYPE token are seeing massive gains, with collective unrealized profits exceeding $1.25 billion. Three key HYPE treasury companies are highlighted: 1. **Hyperliquid Strategies Inc. (PURR):** The largest holder, with approximately 22.3 million HYPE tokens valued at ~$1.636 billion, resulting in ~$1.22 billion in unrealized gains. It has fully transitioned from a biotech firm to a native crypto treasury, focusing on staking and ecosystem participation via validator operations. 2. **Hyperion DeFi (HYPD):** Holds about 2 million HYPE tokens (~$147M value) with ~$49.4M in gains. It is deeply integrated into the Hyperliquid ecosystem, running a top validator node and building DeFi products to generate additional yield. 3. **Lion Group Holding (LGHL):** A smaller player holding ~193,775 HYPE tokens (~$14.14M value), maintaining a long-term holding strategy alongside other crypto assets. The article argues that HYPE treasuries have an advantage over Bitcoin-based ones like Strategy's. Their success stems not just from price appreciation but from active on-chain participation—staking, earning validator rewards, and engaging with ecosystem protocols—creating a compounding "flywheel" effect. With Hyperliquid dominating the on-chain perpetuals market and HYPE's tokenomics encouraging buys and burns, these treasuries are positioned to benefit further if HYPE's price rises as some predict. While the original Bitcoin treasury strategy isn't declared a failure, the current narrative highlights the outsized success of early movers into the HYPE ecosystem.

Odaily星球日报38 min fa

DAT Failing? Listed Companies Betting on HYPE Have Floating Profits of $12.5 Billion

Odaily星球日报38 min fa

Comics Illustration: Helping You Understand China's New Regulations on Outbound Investment

Summary: Understanding China's New Regulations on Overseas Investment The State Council has announced new regulations on overseas investment, effective July 1, 2026. The core message is not a prohibition on international investment, but a call for both companies and individuals to operate with strong regulatory awareness. Here are the key points: 1. **Scope is Broad:** The rules apply not only to companies but also to other organizations and individual residents. 2. **Definition of Investment is Wide:** It encompasses not just capital transfers but also asset contributions, obtaining equity or rights, financing, providing guarantees, and direct or indirect acquisition of rights related to overseas entities or assets. 3. **Companies Must Plan Comprehensively:** Beyond simple ownership charts, firms need clear plans covering the investing entity, required approvals or filings, fund transfer paths, and compliance with technology, data, and security reviews. 4. **Individuals Should Prioritize Compliance:** Before focusing on returns, individuals must first assess their eligibility, understand legal channels for capital outflow, know what they are acquiring, and identify responsible parties in case of issues. 5. **Penalties are Significant:** Violations can result in fines and potentially restrictions on future overseas investment activities. In essence, overseas investment remains possible, but it must be approached with regulatory compliance as a fundamental priority, not solely based on commercial opportunity. *Note: This is a general informational summary and does not constitute legal advice or investment recommendations.*

marsbit52 min fa

Comics Illustration: Helping You Understand China's New Regulations on Outbound Investment

marsbit52 min fa

Nvidia Rack Disassembly Reveals New Growth Opportunity, MLCC Value Surges 182%

Supply bottlenecks in AI infrastructure have expanded to fundamental hardware components like multilayer ceramic capacitors (MLCCs), crucial for stabilizing power and filtering noise in AI servers. Both Goldman Sachs and Morgan Stanley highlight MLCCs as entering a historic "volume-price dual increase" supercycle driven by AI. Goldman forecasts the AI server MLCC market to surge over fourfold from ~$1.4B in FY2025 to ~$5.8B in FY2030, a 34% CAGR. The core driver is a structural supply-demand imbalance. While AI server demand is projected to grow ~4.3x by 2030, industry capacity expands at only ~10% annually, constrained by internal production of equipment and materials. This is compounded by strong demand from electric vehicles. The shortage is evident, with lead times for high-end MLCCs exceeding 20 weeks. The price cycle has officially begun. Japanese leaders Murata and Taiyo Yuden have raised prices by 15-35% for AI server and automotive MLCCs since April, citing material costs. Japan's April export data confirms the trend, with MLCC export value up 28% year-over-year. Profit leverage is significant: Goldman estimates a mere 5% price increase could boost Murata's FY2027 operating profit by ~13% and Taiyo Yuden's by up to 37%. Morgan Stanley's teardown of Nvidia's upcoming Vera Rubin AI rack reveals another catalyst: the MLCC value per rack has skyrocketed 182% from the previous generation to ~$4,320, highlighting the component's growing importance. With demand set to massively outstrip constrained supply, and price increases just starting, analysts position MLCCs at the beginning of a major, prolonged upcycle.

marsbit52 min fa

Nvidia Rack Disassembly Reveals New Growth Opportunity, MLCC Value Surges 182%

marsbit52 min fa

Trading

Spot
Futures

Articoli Popolari

Come comprare PEOPLE

Benvenuto in HTX.com! Abbiamo reso l'acquisto di ConstitutionDAO (PEOPLE) semplice e conveniente. Segui la nostra guida passo passo per intraprendere il tuo viaggio nel mondo delle criptovalute.Step 1: Crea il tuo Account HTXUsa la tua email o numero di telefono per registrarti il tuo account gratuito su HTX. Vivi un'esperienza facile e sblocca tutte le funzionalità,Crea il mio accountStep 2: Vai in Acquista crypto e seleziona il tuo metodo di pagamentoCarta di credito/debito: utilizza la tua Visa o Mastercard per acquistare immediatamente ConstitutionDAOPEOPLE.Bilancio: Usa i fondi dal bilancio del tuo account HTX per fare trading senza problemi.Terze parti: abbiamo aggiunto metodi di pagamento molto utilizzati come Google Pay e Apple Pay per maggiore comodità.P2P: Fai trading direttamente con altri utenti HTX.Over-the-Counter (OTC): Offriamo servizi su misura e tassi di cambio competitivi per i trader.Step 3: Conserva ConstitutionDAO (PEOPLE)Dopo aver acquistato ConstitutionDAO (PEOPLE), conserva nel tuo account HTX. In alternativa, puoi inviare tramite trasferimento blockchain o scambiare per altre criptovalute.Step 4: Scambia ConstitutionDAO (PEOPLE)Scambia facilmente ConstitutionDAO (PEOPLE) nel mercato spot di HTX. Accedi al tuo account, seleziona la tua coppia di trading, esegui le tue operazioni e monitora in tempo reale. Offriamo un'esperienza user-friendly sia per chi ha appena iniziato che per i trader più esperti.

438 Totale visualizzazioniPubblicato il 2024.12.12Aggiornato il 2025.03.21

Come comprare PEOPLE

Discussioni

Benvenuto nella Community HTX. Qui puoi rimanere informato sugli ultimi sviluppi della piattaforma e accedere ad approfondimenti esperti sul mercato. Le opinioni degli utenti sul prezzo di PEOPLE PEOPLE sono presentate come di seguito.

活动图片