Claude's 5-minute timer is 23% of your coding bill

70 points by danvdb 2 hours ago on hackernews | 25 comments

bensyverson | 35 minutes ago

Isn't Claude Code on a 1hr cache?
It's not Claude Code so much as provider. If you're on a subscription plan this article doesn't apply to you. If you're using Vertex API or similar it defaults to 5m.

shahbaby | 20 minutes ago

It applies on a subscription too. Not using the cache burns your usage faster.
Yes but the cache on subscription plans is 1hr

FiReaNG3L | 6 minutes ago

Not for subagents it isnt, 5 minutes for them

julianlam | 35 minutes ago

Requisite smarmy comment about how this is not an issue with local models.

There's even the ability to persist your kv cache to disk, so future session resumptions load back into context instantly without needing to do a full prefill ingestion by the LLM. (CachyLLaMA, iirc, not sure where the project is now)

Up until a few weeks ago, I wouldn't say it (at least for my use case).

But now, with Bonsai 2.5 27B, this is the first time that I don't need Haiku (or a similar cheap model) for tasks in their scope. I think local models are close to an inflection point in usefulness.

Note: I don't have anything local remotely close to reasoning capabilities of SOTA models such as Opus/Neon/Astra.

Forgeties79 | 19 minutes ago

What do you use bonsai for? I haven’t really played with it yet

refulgentis | 33 minutes ago

These AI written articles are exhaustingly long, and the #s included make it feel very scientific but are one offs for one person.

It's self-labelled as a 15m read and a human in the loop should recognize it's about 3m, tops. Here:

LLM API context caches, by default, only last for 5 minutes on Anthropic and 30m on OpenAI.

If you use Claude, there's an hour cache for 2x the cost of the 5 minute one.

If you use OpenAI, there's a 12 hour cache for 2.5x the cost of the 30m one.

FWIW, it's very Chicken Little / "the sky is falling!!111!": the idea is if you walked away for > 5m between every Claude request, re-caching would be 23% of your bill.

cespare | 30 minutes ago

Nice summary.

I could tell that this was AI-written just from the turn of phrase in the title before I even clicked :\

vikramkr | 30 minutes ago

Not even 3 min. Took like 3 seconds to skim the title and understand that it's about cache misses (and that Claude is probably presenting it in some inane incomprehensible technobabble so someone who isn't familiar with prompt caching's budget impact already is going to read the whole thing and still have zero idea wtf is going on)
There’s potential for a 12hr cache on OpenAI?? That’s so good! Thank you I didn’t know this, I’ll have to configure that

vikramkr | 33 minutes ago

Neon really cooked with tamping down on the inane incomprehensible Claude slop huh? It's so damn annoying when they spew this poetic babbling gibberish.

TDLR prompts are cached. Prompt cache hit == $. Cache miss == $$$$$$$. Claude ttl is 5 min. Codex ttl is 30 min. If u take longer than 5 min between turns then $$$$

theanonymousone | 32 minutes ago

Where can I find cache "duration" of different providers? I have never seen such information, despite it being a very big deal in cost estimation. Or maybe it's dynamic?

refulgentis | 29 minutes ago

It's not dynamic, in the sense pricing has rules, but, it is dynamic in the sense you won't always hit the cache.

Generally, by Googling "(provider) llm cache cost and duration" - can't recommend any source that collects them all.

Generally OpenAI and Anthropic are very serious about this and document it well.

Google is currently a shit show but getting better if you're on Interactions API.

The not-$1T crowd, i.e. other inference providers, can't and won't really guarantee anything.

OpenRouter shows data on their cache hit rates.

On not-$1T-crowd APIs, they'll want to set an arbitrary hint that they'll use for server affinity. (i.e. Fireworks needs to know this request wants to run on the same server/cluster/whatever as the last request so it can get a cache hit)

daemonologist | 25 minutes ago

Not all providers publish it, and aren't always correct when they do. For some providers (e.g. DeepSeek, Antigravity Gemini) it is indeed dynamic/not guaranteed.

Bet bet is to measure it yourself by observing billing/credit usage or time-to-first-token.

Claude Code is here: https://code.claude.com/docs/en/prompt-caching

If you're using OpenRouter they publish cache hit rates, which can be used as a sort of proxy, e.g.: https://openrouter.ai/deepseek/deepseek-v4.1-flash-1017#pric...

NooneAtAll5 | 30 minutes ago

just use deepseek

10-100x cheaper is not something to sneeze at

ggregoire | 21 minutes ago

shhh don't share our secret

the_real_cher | 8 minutes ago

Via what portal?

superjan | 26 minutes ago

What helps: run agents in a VM so they can have full control and don’t need to wait for your approval. Firewall it from your local network.

And start a new blank session with its own branch (and have the agent update the project readme) so you can restart without context.

Why firewall it from your local network?
This is obvious if you just put cache timeout in your statusline. If the nature of your work is such that every time you return to the window the 5m cache is expired, bump it up.

antiloper | 21 minutes ago

rishabhaiover | 10 minutes ago

This is a big contributor to long-running sessions. I built a small CLI that opens in a tmux popup and shows what my Cursor agents cost: https://github.com/rishabhBudhouliya/tend.

It uses a ridgeline chart to show how big each chat's context has grown and what it's spending.

8cvor6j844qw_d6 | 6 minutes ago

If I'm not mistaken, on subscription plans your main agent defaults to 1 hour cache with subagents spawned by the main session on 5 minute cache timer.

Best ensure your subagents avoid getting blocked if there's any wait or command that takes more than 5 minute.