SSD Nodes Learn 🎉 VPS from $5.50/mo
How to do am Matt ConnorBy Matt Connor · Updated 2026-08-14

Claude memory dey cost extra money?

Claude no get separate memory-token price. You pay for remembered text as input tokens when Claude reads am, unless prompt caching reduce the replay cost.

Claude memory features dey cost extra?

Claude memory features no get separate price. Anthropic published rates na per million input tokens and per million output tokens, plus extra rates for prompt caching. None of dem dey call memory token. Storing the memory itself no cost anything for Claude API (application programming interface), because memory tool dey client-side and the file dey for storage wey you own.

Memory still fit show for your bill, because remembered fact only changes answer when e dey inside request wey Claude reads. To remember something means say you send am again. That text enters as input tokens, and dem charge am with the model ordinary input rate. Two numbers decide the cost: how many tokens of remembered text you replay for each turn, and whether prompt cache fit serve that replayed text.

For Pro or Max subscription, dem no bill you per token at all. So memory dey use your usage allowance instead of your money. The mechanism below dey the same. Na only the unit change. The allowance get limit, so e good make you know how much Claude Pro cost and when its limits go stop you before you decide how much memory each turn suppose carry. Claude Enterprise different again, because e meter every token with API rates on top of the seat price, so oversized memory block go turn into money instead of allowance. If pruning memory bring your usage well below a smaller plan ceiling, moving from Max down to Pro na the next step worth taking, and the change go happen at the end of the period wey you don already pay for. If the comparison wey you dey make na between providers, not between Anthropic own tiers, Claude plans compared with ChatGPT at current prices na where you suppose start.

Wetín “memory” mean for each Claude surface

Three different products dey use the same word, and na mixing dem up dey make this question confusing pass.

The memory tool for Claude API. You add one entry to the tools array and implement the file operations for your own code.

{"type": "memory_20250818", "name": "memory"}

As of August 2026, this tool dey generally available for Messages API without beta header, for Claude 4 and later models. E dey run client-side: Claude go request operation like view /memories, your handler go run am against storage wey you control, then you go return the result inside tool_result block. Anthropic no dey keep the file, so no storage charge dey pass to you. Na the round trip you dey pay for. The tool definition dey go with every request, and the file content wey come back remain inside the conversation from that point onward.

Anthropic publish the fixed part of that overhead. For Claude Opus 5 with tool choice of auto, the tool-use system prompt na 286 tokens, as documented for August 2026. You pay this once for every request wey get any tool, whether na memory or another tool.

Claude Code. Two mechanisms dey load when every session start. CLAUDE.md files hold instructions wey you write. Auto memory hold notes wey Claude write for itself, under ~/.claude/projects/<project>/memory/. Only the first 200 lines or 25KB of MEMORY.md dey load, whichever limit come first, and the topic files beside am dey read on demand instead of during startup. Everything wey load during startup become part of the prefix wey every later request for that session carry. How Claude Code dey remember memory between sessions explain the loading order file by file.

Claude for web. For claude.ai, memory na set of entries wey Claude write and update as una dey chat, with separate memory space for each project. Settings > Memory dey list wetin dem store, and the toggle there get Pause memory or Reset memory. This surface dey billed by subscription, so memory dey use your usage limits.

Why remembered text dey billed as input tokens

Messages API dey stateless. E no keep anything between calls, so your client dey send the complete conversation for every turn, and model dey read everything again. Memory no be exception to this rule. Na one more block of text inside the same request.

You fit see the split for the usage object on any response.

"usage": {
  "input_tokens": 412,
  "cache_creation_input_tokens": 0,
  "cache_read_input_tokens": 18240,
  "output_tokens": 236
}

input_tokens dey count only the tokens wey model no read from cache and no use create cache. For practical purpose, na tokens after the last cache breakpoint. Total input for the request na cache_read_input_tokens plus cache_creation_input_tokens plus input_tokens. Memory file wey Claude open three turns ago dey inside that total for every turn after that. E go enter under cache_read_input_tokens while the cached prefix still dey hold, and under input_tokens when e no hold. Na the same text, but the two prices dey very different. Input and output tokens get different prices, and memory fit only enter the input side.

Where to see these numbers for your own usage

No use collect figure from blog post, including this one. Measure your own memory block. Token counting free and e get im own rate limit, so the measurement no cost anything.

curl https://api.anthropic.com/v1/messages/count_tokens \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "content-type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-opus-5",
    "system": "You are a scientist",
    "messages": [{"role": "user", "content": "Hello, Claude"}]
  }'

The response na one number, like { "input_tokens": 14 }. Run am once with your memory text pasted inside system field, then run am again without the memory text. The difference na wetin that memory dey cost you for every turn. Two warnings apply. The count na estimate, and extra tokens wey Anthropic add for im own system optimizations no dey billed to you. Also count against the model wey you go actually run, because Claude 4.7 and later use newer tokenizer wey dey produce roughly 30 percent more tokens for the same text.

Inside Claude Code, you fit get the same answer without any curl at all.

  • /context shows wetin load right now, including memory files, so you fit see their share of the window before you type anything.
  • /memory lists your CLAUDE.md files and opens the auto memory folder.
  • /usage prints the session totals, including cache reads and cache writes.
  • The status line fit display context window usage continuously, so you go see am as e dey grow.

The /usage session block look like this:

Total cost:            $0.55
Total duration (API):  6m 20s
Total duration (wall): 6h 33m 10s
Total code changes:    0 lines added, 0 lines removed
Usage by model:
   claude-sonnet-4-6:  1.2k input, 5.3k output, 940.0k cache read, 50.0k cache write ($0.55)

Read the last line carefully. The 940.0k cache read figure na the whole conversation, memory join, wey dey send again on every turn at the cache rate. The 1.2k input figure na only the part wey new. Claude Code dey calculate that dollar amount locally from list prices, so e no include any discount wey you get and e fit differ from your invoice. The Usage page for Claude Console na the authoritative number.

Then run the comparison directly. Ask the same opening question for two fresh sessions, one normal and one with auto memory switched off.

CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 claude

Run /context for each one and compare the memory files entry. The gap na wetin your accumulated memory dey cost for the start of every session, before any work start. Full breakdown of where Claude Code token usage dey go worth reading next to those two numbers.

How much replaying memory dey cost per million tokens?

Prompt caching na the reason the same memory block fit cost ten times more for one turn than another. Anthropic publishes the cache rates as multiples of each model base input price, so the relationship still hold even when dollar prices change.

ChartAnthropic's published prompt caching rates, as a multiple of base input price
The data behind this chart
[
  {
    "label": "Base input",
    "price_multiple": 1
  },
  {
    "label": "5 minute cache write",
    "price_multiple": 1.25
  },
  {
    "label": "1 hour cache write",
    "price_multiple": 2
  },
  {
    "label": "Cache read",
    "price_multiple": 0.1
  }
]

A cache read costs 0.1 times the base input price. Writing an entry with 5 minute lifetime costs 1.25 times base, and 1 hour lifetime costs 2 times base. Anthropic talk the break-even point plainly: caching pays after one cache read with 5 minute duration, or after two cache reads with 1 hour duration. The break-even point for prompt caching na the calculation you need run before you decide where memory go stay.

Those multiples turn replay count into arithmetic. The next block na arithmetic from the published multiples above, not measurement from any live workload. E price one memory block in three ways over 100 turn session, expressed as the equivalent number of tokens charged at the plain base input rate.

ChartA memory block over 100 turns, expressed as base-rate input tokens
The data behind this chart
[
  {
    "label": "4,000 tokens, never cached",
    "base_rate_equivalent_tokens": "400,000"
  },
  {
    "label": "4,000 tokens, 1 write and 99 reads",
    "base_rate_equivalent_tokens": "44,600"
  },
  {
    "label": "1,000 tokens, 1 write and 99 reads",
    "base_rate_equivalent_tokens": "11,150"
  }
]

A 4,000 token memory block wey miss cache for all 100 turns go bill like 400,000 base-rate tokens. The same block behind one 5 minute cache write and 99 cache reads go bill like 44,600. Prune am to one quarter of the size and keep the caching, and e go bill like 11,150. The feature no change across those 3 rows. Na only the replay behaviour change. Those figures still be token counts, no be money, and turning a token count into a figure on your monthly bill na one multiplication by your model per-million rate. The model wey you run set that rate, so if the agent go run on Claude Fable 5, start from its published per-million rates and the work it suits.

The second row assume say each of the 99 later requests arrive while cache entry still dey active. Na this assumption dey make most real bills go wrong.

Why the same question dey cost more after you take break?

Cache entry get lifetime, and clock start from the request wey write or read am. Default na 5 minutes. The 1 hour option cost the 2x write wey dem show above. For Claude Code, lifetime na one hour for subscription, but e drop to five minutes once you dey use usage credits; for API key or cloud provider, default na five minutes. Setting ENABLE_PROMPT_CACHING_1H=1 keep the one hour lifetime while you dey use usage credits.

So, one-line question wey you type for session wey you leave open over lunch fit cost plenty because cache entry expire while you dey away. The whole prefix, including memory, go process again at the base input rate and write to cache again. The length of the break na wetin set the price.

You fit confirm this instead of just believing am. For Pro, Max, Team, or Enterprise plan, the /usage breakdown flag any behaviour wey account for 10 percent or more of recent usage, and e show both long context and cache misses by name. For API, monitor cache_creation_input_tokens as e jump back to the full size of your prefix for the first request after quiet period.

Wetin dey quietly invalidate the cache

The cached prefix get order: tools, then system, then messages. Change for one level go invalidate that level and everything after am. If you edit tool definition, the whole cache go comot. If you edit system prompt, system cache and message cache go comot.

Na this be the trap for anybody wey dey keep memory inside system prompt and rewrite am as agent dey learn. Each rewrite dey discard the cached copy of everything behind am, so the next request go pay full write cost again. Keep stable material for front and no dey change am. Put volatile material later for message list, where invalidating am no cost much.

Another quieter failure dey happen. Each model get minimum cacheable prefix: 512 tokens for Claude Opus 5, 1,024 for Claude Sonnet 5, 4,096 for Claude Haiku 4.5, as published for August 2026. Anthropic documentation talk clearly wetin happen below that limit: "Any requests to cache fewer than this number of tokens will be processed without caching, and no error is returned." So, small memory file wey get cache_control fit no do anything at all, and e no go show error. The symptom wey you fit see na cache_creation_input_tokens remain 0 even though your prompt clearly get breakpoint.

Prune memory wey no longer useful

Every memory line dey cost tokens for every turn wey carry am, so question for each line na whether e recently change any answer. Claude Code make the limits clear. Try keep one CLAUDE.md below 200 lines, because longer files dey use more context and reduce how reliably Claude dey follow dem. MEMORY.md get limit of first 200 lines or 25KB when e load, and anything after that limit dey drop when next session start, so oversized index dey spend tokens but e no dey teach anything.

Two habits fit keep am small. Move details from the index go topic files, wey Claude go read when e need dem instead of for startup. Move workflow instructions from CLAUDE.md go skills, wey go load only when person invoke dem. For memory files wey already start with frontmatter, Claude Code dey record the write time for modified field as ISO 8601 timestamp, for version 2.1.214 or later. That timestamp na the fastest way to spot fact wey don become stale. Pruning stale agent memory explain the review process with more detail.

When retrieval better pass loading everything into context

Memory tool dey support just-in-time retrieval. Instead make agent load everything from the beginning, agent dey record wetin e learn and read file again only when task need am. This change the calculation, because file read cost na its tokens one time, then e dey stay inside cached prefix, while block wey dey loaded permanently cost tokens for every turn.

Simple rule dey follow from the two charts above. Text wey almost every turn dey use belong inside stable cached prefix. Text wey one turn for every twenty turns dey use belong behind one view call. Break-even dey change based on how many times you replay, not based on anything Anthropic dey charge.

For the API, you fit also allow the platform trim the conversation. Context editing dey clear old tool results once conversation cross the threshold wey you set.

{
  "edits": [
    {
      "type": "clear_tool_uses_20250919",
      "trigger": {"type": "input_tokens", "value": 30000},
      "keep": {"type": "tool_uses", "value": 3},
      "clear_at_least": {"type": "input_tokens", "value": 5000}
    }
  ]
}

The default settings na trigger of 100,000 input tokens and 3 tool uses wey e keep. Read how interaction dey work with caching before you enable am: clearing content dey invalidate cached prefix for the point wey clearing happen, so you go pay cache write for the next request. Na that one clear_at_least dey handle. E dey delay clearing until the saving big enough to justify the write. The response dey report exactly wetin happen under context_management, with cleared_tool_uses and cleared_input_tokens, so you fit measure the trade instead of just theorize about am. Managing the context window for Claude Code dey apply the same idea to coding session.

Wetin get separate charge

Memory no get separate charge, but some features really get charge, and e good make you know which ones. These na the published Claude API rates as of August 2026. Some operations no cost anything, but Claude API no get free tier, only small credit when you sign up, so all the things below na real spending from your first request.

  • Web search: $10 for every 1,000 searches, plus the normal token cost of everything wey the search put for context.
  • Code execution: 1,550 free hours for each organization every month, then $0.05 for every hour per container. E free when you use am together with web search or web fetch.
  • Claude Managed Agents: session runtime na $0.08 for each session-hour, on top of the usual token charges.
  • Web fetch: no extra charge, only the token cost of the content wey e fetch.

Memory no appear for any of those line items. E dey inside your input token count, na exactly there you fit measure am, and na exactly there pruning and caching fit reduce the cost. If you dey budget an agent wey dey run unattended for a virtual private server (VPS), the cost controls for an AI agent on a VPS na the next thing to put in place, because agent wey get memory file wey dey grow and no pruning go cost more every week without anything reporting am.

FAQ

Claude memory features get separate charge?

No. Anthropic price list get rates for each million input tokens, each million output tokens, and prompt caching multiples, but e no get separate memory line. For Claude API, memory tool dey client-side, so files dey for storage wey you already dey pay for. Wetin memory add na input tokens, and dem dey bill am with the model normal input rate for every turn wey carry dem.

If I turn memory off, Claude go cheaper?

E go reduce token count for each request, so cost for each request go reduce. Whether e go save money overall depend on wetin happen next. If Claude need read three files again and ask you two questions to rebuild wetin memory already hold, those tokens fit cost pass the memory. Measure am instead of guessing: run /context for one session wey get auto memory on, and another one wey start with CLAUDE_CODE_DISABLE_AUTO_MEMORY=1, then compare total tokens wey both spend for the same task.

Why my usage increase when I no change anything?

The commonest cause na cache miss after pause. Cache entries dey for 5 minutes by default, or one hour for the extended setting. So, the first request after break go process your whole prefix again at the base input rate and write am again. The second common cause na prefix edit: if you change tool definition, e invalidate the whole cache. If you change system prompt, e invalidate the system and message cache. For subscription plan, the /usage breakdown dey name this behaviour when e account for 10 percent or more of recent usage.

Memory suppose dey inside system prompt or behind tool call?

Put am for system prompt when almost every turn dey use am, because e go sit for cached prefix and cost the cache read rate. Put am behind view call when na only some tasks need am, because file wey you read once go cost its tokens once instead of for every turn. The number wey decide this na your replay count, and usage object go give you that number directly.

Memory features dey count against subscription usage limits?

Yes, indirectly, because subscription limits dey use up based on the tokens wey each request carry. Anthropic help documentation talk say longer conversations wey trigger automatic context management dey consume more of your usage limit. Memory make each request slightly longer, and long session go replay that length for every turn. How Claude usage limits really dey work explain wetin reset and when.