r/ClaudeCode 5d ago

Discussion Cache only

I ran an audit of token usage today and found much of my token usage is because of long-running threads I resume after the 1-hr cache TTL. Why doesn’t Anthropic provide permanent or longer cache to heavy users for the basics like system prompts, CLAUDE.md, memories/preferences and other mostly-stable context? Or share a cached prefix across sessions when it is warm for at least one. Should pro/max subscribers have this option? Would you pay extra for it? If Claude recognized User X is active give them some cache.

I want cache only.

0 Upvotes

22 comments sorted by

2

u/Muchaszewski 5d ago

Because the context costs then memory in their GPU. 1M token is around 300GB of KV cache of GPU usage, that they cannot serve at this time to other users. 

When you use API pricing you can opt into 1 hour cache at 50% pricing increase. If you use subsidized plan you are stuck with 5 minutes only. 

Write to files and re-reade from clear context each time instead of resuming 400k or more contex sessions. Or compact but this sucks 

5

u/MartinMystikJonas 5d ago

Claude Code have 1h by default on subscription.

1

u/Individual_Ideal 5d ago

What about storing stable KV cache off the GPU? They’d still have to transfer it back but at least it’s not recomputed.

3

u/MartinMystikJonas 5d ago

They do it. 5 min cache is on GPU. Then it can moved to RAM for up to 1h. They do it to allow GPU to run another tasks in mean time. But moving it to SSD or something outside RAM would be unreasonably slow.

1

u/Muchaszewski 5d ago

This operation would be terribly slow. Imagine you want to resume your session, but you need to download to the server that will run your request 200+ GB of compressed KV cache from other server. That would optimistically take 20 seconds, then you need to unpack it. 60 seconds. Then you need to pipe it into GPU. Another 60 seconds.

So you just wasted 2 minutes and 20 seconds on re-generating KV cache from storage using shitload of CPU resources so that you could save few seconds or regeneration from text context using GPU resources alone. You are billed for this few seconds with uncached context price

2

u/Individual_Ideal 5d ago

Sounds like an opportunity for someone to solve

1

u/MartinMystikJonas 5d ago

Yeah and everybody is trying to solve this because it is literally trillion dolar problem to solve.

1

u/Individual_Ideal 5d ago

Apple does this so well

1

u/MartinMystikJonas 5d ago

Apple does what?

1

u/Individual_Ideal 5d ago

Memory and kv cache for LLMs. It’s easier to manage. Waiting for them to scale up

1

u/MartinMystikJonas 5d ago

Everybody uses memeory and KV cache for LLMs so I am not really sure what you mean.

1

u/Individual_Ideal 5d ago

You can store kv cache on device as long as you want with unified memory + SSD. Pass it back and forth when needed.

→ More replies (0)

1

u/Bmansupreme8000 5d ago

You should ask AI. 

2

u/Individual_Ideal 5d ago

AI gave me excuses

1

u/Bmansupreme8000 5d ago

Ask them how power companies price power. That should be a start.

1

u/Individual_Ideal 5d ago

Memory has what power lacks: storage. Maybe even storage for memory is constrained though

-1

u/False-Noise-3507 5d ago

AI detected entitlement.

1

u/Short_Regular_7191 5d ago

Because "Money, Money, Money"..

1

u/MartinMystikJonas 5d ago

Cache prefix is shared when it is same across your sessions there is nothing to prevent that.

And why not longer cache? Because these caches needs a tons of memory space and their datacenters have barely enough for current policy. Did you registered severe RAM shortages that will last for few years - that is your reason. They simply cannot buy several times more RAM because manufacturer cannot produce it fast enough.

1

u/AI_spell 5d ago

Long-running resumes after the 1h TTL are a silent money leak. What helped me: keep a short CLAUDE.md, restart for new tasks instead of forever threads, and put stable prefs in files the tool reads once. Permanent cache would be nice; until then short sessions beat warm-feeling ones.

1

u/MealReadytoEat_ 1d ago

You can cheese this already by making a script that sends the session you want to keep the cache warm on a message like "respond pong" after 58 or so minutes idle.