Jump straight to the numbers

← All articles

$1.50 a Day Just to Repeat Your Agent’s Memory

01 / The $2.25 receipt hiding inside 100 agent requests

A coding agent memory file can preserve useful project knowledge: test commands, architectural boundaries, naming rules, and mistakes worth avoiding. It can also become a document you pay to resend while the agent fixes a three-line bug.

The file itself costs nothing to store. The bill starts when its contents enter a model request. Here is a deliberately simple receipt that makes that distinction visible.

All rates below are hypothetical arithmetic inputs, not CheapRelay prices or quotes for any particular model. Assume $2.50 per million ordinary input tokens and $10 per million output tokens. Count 100 model requests per working day, not 100 human prompts: one agent task can trigger several requests.

  • ■ Other input: 1,000 tokens × 100 requests = 100,000 tokens, costing $0.25.
  • ■ Memory file: 6,000 tokens × 100 requests = 600,000 tokens, costing $1.50.
  • ■ Output: 500 tokens × 100 requests = 50,000 tokens, costing $0.50.
  • ■ Total: $2.25 per day, with memory accounting for about 67%.

Across 20 working days, that memory line alone reaches $30. This is not a measured workload or a prediction. It is what the stated assumptions produce. Real agents may load instructions selectively, use caching, or accumulate much larger conversation histories.

02 / A 1,000-token file cuts this receipt by $1.25

Now shorten the memory file from 6,000 to 1,000 tokens. Keep the request count, other input, and output unchanged. The memory charge falls to $0.25 per day, and the full receipt falls from $2.25 to $1.00. That saves $25 across 20 working days.

The useful edit is not simply deleting five-sixths of the text. Keep facts that change the agent’s behavior across many tasks. Move occasional reference material into separate files that the agent can read when needed.

  • ■ Keep: the exact test command, including required environment setup.
  • ■ Keep: a short warning that generated files must not be edited manually.
  • ■ Move: a long release history or exhaustive directory tour.
  • ■ Remove: stale workarounds, duplicated rules, and generic advice such as “write clean code.”

Selective reading still costs tokens when it happens. The advantage comes from avoiding irrelevant material on requests that do not need it.

03 / A cache can turn $1.50 into roughly $0.17

Caching changes the receipt, but it does not make memory free. For a separate hypothetical calculation, assume cache writes cost $3 per million tokens and cache reads cost $0.25 per million tokens.

If the same 6,000-token memory block receives one cache write followed by 99 cache reads, the write costs $0.018. The reads cover 594,000 tokens and cost $0.1485. Total memory cost: $0.1665, or roughly $0.17.

That assumes the block qualifies for caching, stays valid, and is reused successfully throughout those requests. Actual cache lifetimes, minimum sizes, prefix matching, and pricing depend on the selected service and model. Rewriting memory or changing earlier context can reduce reuse. Check usage records rather than treating every repeated token as a cache hit.

04 / Buy fewer retries, not merely fewer tokens

A shorter file is not automatically cheaper overall. Removing the correct test command might cause extra tool calls, failed runs, or another model request. A useful instruction earns its place when it prevents enough wasted work to cover its recurring input cost.

Compare representative tasks with the long and short versions. Record total input, cache reads, cache writes, output, completed tasks, and human corrections. A small trial is useful operational evidence, not a universal benchmark.

CheapRelay’s pay-as-you-go billing counts real tokens, including cache reads and writes, with no monthly fee or subscription. That makes the complete token receipt more relevant than file size alone. Sign up for CheapRelay to run a small, capped comparison with your own coding workflow.

The practical target is a compact memory file that prevents expensive mistakes. Keep the rules that earn their recurring charge; make everything else available on demand.

Sign up Try the prices yourself, sign-up credit included.

More reading

DateAisleWritten inTitle
2026-10-26Coding agents, cheaplyEN$0.1325 for a focused Codex run: a sample receipt
A worked Codex receipt shows how tighter scope, smaller tool output, and deliberate stopping points can reduce token spending.
2026-10-26Coding agents, cheaplyEN$0.0685 and $0.195: two shell-chore receipts
Two illustrative shell-task receipts show how input, output and cache charges add up in Gemini CLI and Claude Code.
2026-10-26Coding agents, cheaplyEN$2.28 for 100 Code Reviews: An Illustrative Receipt
A transparent token-cost receipt for 100 AI-assisted code reviews, with retry costs, spending limits, and a workflow that keeps context small.
2026-10-26Coding agents, cheaplyEN$0.84 Saved by Clearing Unrelated Claude Code Tasks
A worked Claude Code token receipt: when /clear saves money, what /compact costs, and why cache billing can change the result.
2026-10-26Coding agents, cheaplyEN$13 of Usage, $7 of Headroom: A Tiny-Team AI Receipt
A three-developer coding assistant budget with token math, cache charges, shared configuration, and safeguards against surprise spending.
2026-10-26Coding agents, cheaplyEN$0.37 for an OpenCode Session: An Example Receipt
A worked OpenCode cost receipt: input, output, cache reads and writes, plus practical checks before using a pay-per-token backend.