SSD Nodes Learn Hosting plans →
How to do am Matt ConnorBy Matt Connor

Claude Memory Dey Cost Extra? See How Billing Work

Claude no get separate memory token price. Remembered text dey count as input tokens, so cost depend on replay size and whether prompt caching fit reduce am.

Claude memory features cost extra?

Claude memory features no get separate price. Anthropic published rates dey charge per million input tokens and per million output tokens, with 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 enter your bill, because remembered fact only changes answer when e dey inside the request wey Claude reads. To remember something means say you send the text again. That text enters as input tokens, and dem charge am with the model ordinary input rate unless e dey cached. Two things 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, Max or Ultra subscription, usage wey dey inside your plan included limits no dey billed per token. So memory dey use your usage allowance instead of your money. This changes if you turn on usage credits and pass the limit. Your requests then switch to pay-as-you-go. Dem go bill am with standard API rates, separately from the subscription. From that point, oversized memory block go cost money again. The mechanism below no change. Na only the unit change. That 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. Usage-based Claude Enterprise different again, because e measure every token with API rates on top of the seat price, so oversized memory block go turn back to money instead of allowance. Seat-based Enterprise plans include usage allowance, and usage credits dey available after members reach their included limits. If pruning memory bring your usage comfortably below a smaller plan ceiling, moving from Max or Ultra down to Pro na the next step worth taking. If the comparison wey you dey make actually cover different providers instead of Anthropic own tiers, Claude plans compared with ChatGPT at current prices na where you suppose start.

Wetin “memory” mean for each Claude surface

Three different products dey use this 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 October 2026, this tool no need beta header for Messages API again, and e dey work for all Claude 4 and later models. Na client-side e be: 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 hold the file, so no storage charge dey to pass on. You dey pay for the round trip instead. The tool definition dey sent for every request, and the file content wey come back remain inside the conversation from that point.

Anthropic publish the fixed part of this overhead. For Claude Opus 5 with tool choice of auto, the tool-use system prompt na 286 tokens, as dem document for October 2026. You pay this once for every request whenever any tool dey present, 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/. Na 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 startup. Everything wey load for startup become part of the prefix wey every later request for that session carry. Memory dey use the included usage allowance when you use subscription, or usage credits after limit when you switch dem on. Through Console or cloud providers, Claude Code billing dey per token to your organization, and memory context follow that billing method. 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 one memory space for each project. By default, project memory dey work together with your account memory; turn off Use account memory for the project page if you want make dem fully separate. Settings > Your Claude > Manage beside Your memory show wetin dey stored, or Settings > Memory for the older layout, and the memory toggle get Pause memory or Reset memory. Memory dey also available for Free plan. For paid plans wey get included usage, memory dey use usage limits, or usage credits after you pass limit when you switch dem on; usage-based Enterprise dey bill am with API rates.

Why text wey system remember dey count as input tokens

Messages API no dey keep state. E no dey keep anything between calls, so your client dey send the complete conversation for every turn and the 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 cache no read and wey no use create the cache. For practical purpose, na the 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, under cache_creation_input_tokens when the prefix write again, and under input_tokens when e no dey cached. Na the same text, but different prices. Input and output tokens get different prices, and replayed memory dey enter the input side.

Wia you fit see these numbers for your own usage

No take any figure from blog post, including this one. Measure your own memory block. Token counting dey free and e get its 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, and once without am. The difference na wetin that memory dey cost you for every turn. Two cautions dey apply. The count na estimate, and extra tokens wey Anthropic add for its own system optimizations no dey billed to you. Also count against the model wey you go actually run, because Claude 4.7 and later dey use newer tokenizer wey dey produce roughly 30 percent more tokens for the same text.

Inside Claude Code, you fit answer the same question 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 growth as e dey happen.

The /usage session block dey 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 conversation, including memory and everything else, wey dey send again for every turn at the cache rate. The 1.2k input figure na only the uncached input wey no dey used to create cache entry. Claude Code dey calculate that dollar amount locally from list prices, unless administrator set contracted rates through the modelPricing managed setting. So na estimate, and e fit different 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 session and one with auto memory switched off.

CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 claude

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

How much replaying memory cost per million tokens?

Prompt caching na why the same memory block fit cost ten times more for one turn pass another. Anthropic publishes 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
Di data wey dey behind dis 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
  }
]

Cache read cost 0.1 times the base input price for most models. The newest models read cheaper: 0.05 times base for Claude Opus 5.5 and Claude Sonnet 5.5, and 0.025 times base for Claude Fable 5.1 and Claude Mythos 5.1. Writing entry with the 5 minute lifetime cost 1.25 times base, while the 1 hour lifetime cost 2 times base. Anthropic pricing page state the break-even clearly: caching don pay after one cache read with the 5 minute duration, or after two cache reads with the 1 hour duration. That statement use the standard 0.1x read, and the prompt caching guide itself no give break-even figure, but the cheaper read rates no change either count, because na the write premium wey the reads need recover. The break-even point for prompt caching na the calculation to 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, no be measurement of any live workload. E price one memory block in three ways over a 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
Di data wey dey behind dis 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. If you reduce am to one quarter of the size and keep the caching, e go bill like 11,150. The feature no change across those 3 rows. Na only the replay behaviour change. The rows use the standard 0.1x read. For Claude Opus 5.5 or Claude Sonnet 5.5, where one read cost 0.05x, the cached 4,000 token block go reduce to 24,800, and for Claude Fable 5.1 e go reduce to 14,900. Those ones still be token counts, no be money, and turning token count into figure for your monthly bill na one multiplication with 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 wey e fit handle. If the agent run on smaller model to save money, check how Claude Haiku 5.5 prices prompts wey pass 100K tokens before you allow its memory grow, because na replayed memory dey push request pass that line. If provider still be open question, rather than only the model, the same jobs priced on Claude's API and on ChatGPT's show where that multiplication land differently, and agent wey use plenty memory depend heavily on the input side.

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

Why the same question dey cost more after 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 show above. For Claude Code, the one-hour subscription default apply to the main conversation and selected helper requests inside included usage; subagents get five minutes unless you choose longer lifetime. The main conversation drop to five minutes once you dey use usage credits; for API key or cloud provider, na five minutes by default. Setting ENABLE_PROMPT_CACHING_1H=1 keep the one hour lifetime while you dey use usage credits, and from Claude Code v2.1.242, setting promptCacheTtl to 1h do the same for the main conversation. From the same version, setting subagentPromptCacheTtl to 1h select the longer lifetime for requests wey no dey inside the main conversation.

So, one-line question wey you type inside session wey you leave open over lunch dey expensive because cache entry expire while you dey away. The whole prefix, including memory, dey process and write to cache again at cache-write rate. Na the pause length set that price.

You fit confirm am instead of just believing am. For Pro, Max, Ultra, Team or Enterprise plan, /usage breakdown flags any behaviour wey cause 10 percent or more of recent usage, and e show both long context and cache misses by name. From Claude Code v2.1.251, the session block for /usage also add a Prompt cache (main) line wey show the share of input wey cache serve, the number of misses, and whether cache warm right now. 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. If you change one level, e invalidate that level and everything after am. If you edit tool definition, e throw away the whole cache. If you edit system prompt, e throw away the system cache and message cache.

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

Another quieter failure dey happen. Every model get minimum cacheable prefix: 512 tokens for Claude Opus 5, 1,024 for Claude Sonnet 5, and 4,096 for Claude Haiku 4.5, as published for October 2026. Anthropic documentation clear about wetin dey happen below that limit: requests below the minimum dey process without caching, and no error dey return. So, small memory file wey you mark with cache_control no dey do anything at all, silently. The symptom wey you fit see na cache_creation_input_tokens staying at 0 even though your prompt clearly contain breakpoint.

Prune memory wey no dey earn e place again

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

Two habits fit help keep am small. Move detail from the index go topic files, wey Claude go read when e need am instead of when e start. 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 one 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

The memory tool dey support just-in-time retrieval. Instead make agent load everything from the beginning, agent go record wetin e learn and read file again only when task need am. This one change the calculation, because file read first go add the content when e dey needed, then e go remain for later requests until dem remove am from context. But permanently loaded block go cost for every turn.

Simple rule dey follow from the two charts above. Text wey almost every turn dey use belong for the stable cached prefix. Text wey one turn out of twenty dey use belong behind one view call. The break-even depend on how many times you replay am, no be 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 the conversation pass the threshold wey you set. E still dey beta, so requests wey use am need the context-management-2025-06-27 beta header.

{
  "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 defaults na trigger of 100,000 input tokens and 3 tool uses wey dem keep. Read how interaction dey work with caching before you enable am: clearing content dey invalidate the cached prefix for the point wey clearing happen, so you go pay cache write for the next request. Na wetin clear_at_least dey handle. E dey delay clearing until the saving big enough to justify the write. The response report exactly wetin happen under context_management, with cleared_tool_uses and cleared_input_tokens, so you fit measure the trade instead make e remain theory. Manage the context window for Claude Code dey apply the same idea to coding session.

Wetin get im own line item

Memory no get im own charge, but some features really get charge, and e good make you know which ones. These na the published Claude API rates as of October 2026. Some operations no cost anything at all, and Claude API test credits help new users try am. Anthropic pricing FAQ only talk say new users dey receive small amount of free credits to test the API, and e no publish any amount. Max, Ultra and Team subscribers still get monthly API credits. Anthropic docs list am on October 31, 2026 as $100 for Max and $200 for Ultra. For Team, the credits na $20 per Standard seat and $100 per Premium seat. Dem dey pool am and cap am at $500 every month. Free, Pro and Enterprise plans no qualify. Unused credits no dey carry over, and dem no cover interactive Claude Code or usage credits. Dem cover claude -p and the Claude Agent SDK when you run dem directly with an API key from the linked Console organization. Runs wey Claude Code GitHub Action, an IDE extension, or the desktop app start still no qualify, even with -p. Those credits na benefit of paid plan, and the charges below go first use available credits or your paid balance.

  • Web search: $10 for every 1,000 searches, plus the normal token cost of everything wey the search put inside context.
  • Code execution: 1,550 free hours per organization every month, then $0.05 per hour per container. E free when the same request include web search or web fetch for tool version 20260209 or later.
  • Claude Managed Agents: session runtime na $0.08 per 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 dey for any of those lines. E dey inside your input token count. Na exactly there you fit measure am, and na exactly there pruning and caching fit reduce am. If you dey budget agent wey dey run unattended for virtual private server (VPS), the cost controls for an AI agent on a VPS na the next thing to put in place. This na because agent wey get memory file wey dey grow and no pruning go cost more every week without anything reporting am.

FAQ

Dem dey charge separately for Claude memory features?

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

Turning memory off go make Claude cheaper?

E reduce the token count for each request, so e reduce the cost of each request. Whether e 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 more than the memory. Measure am instead of guessing: run /context for one session with auto memory on and another one started with CLAUDE_CODE_DISABLE_AUTO_MEMORY=1, then compare the total tokens wey dem spend on the same task.

Why my usage go up when I no change anything?

The commonest cause na cache miss after pause. Cache entries dey live for 5 minutes by default, or one hour with extended setting, so the first request after break go process your complete prefix again and write am again with cache-write rate. The second common cause na prefix edit: changing tool definition invalidates the whole cache, while changing system prompt invalidates the system and message cache. For subscription plan, the /usage breakdown names 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 inside cached prefix and cost cache read rate. Put am behind view call when na only some tasks need am, because this one delay adding the file tokens until dem need am; the result still dey replay for later turns until dem remove am from context. The number wey decide this na your replay count, and the usage object shows the input, cache-write, and cache-read tokens for each request.

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 small longer, and long session dey replay that length for every turn. How Claude usage limits really dey work explain wetin reset and when.

Dis article help you?