Your Input Bill: 90,000 Tokens From One File
01 / Am I paying for the same file every turn?
Possibly. A coding agent may send instructions, conversation history, source files and tool results with each request. A file already discussed can remain in later inputs even when your latest message is just “try again.”
Here is illustrative arithmetic, not a benchmark: a 3,000-token file included in 30 requests contributes 90,000 input-token appearances. That excludes everything else in those requests. Caching can change the price of those appearances; it does not mean the file disappeared from context.
Start with the receipt: inspect per-request input usage, available cache counters and actual charges. A short message is not proof of a cheap turn.
02 / Which numbers reveal context bloat fastest?
For one representative task, record input tokens, output tokens, cache usage if reported, request count and total cost. Note what happened before each large input increase: repository exploration, a test run, a browser fetch or a long debugging exchange.
If your provider exposes separate rates, estimate cost as uncached input tokens times their rate, plus cache reads and writes times their respective rates, plus output tokens times their rate. Divide by the rate’s published token unit. Check how the provider defines each counter before combining them; some totals already include cached tokens.
03 / Can I stop the agent reading the whole repository?
Give it a narrow entry point before it explores. “Fix the date parser in src/date.ts; inspect its tests first” is a better starting instruction than “investigate date bugs.” It is a scope hint, not a ban on necessary dependencies.
- ■ Search filenames and symbols before opening complete files.
- ■ Request the relevant function plus surrounding types and callers.
- ■ Exclude generated bundles, dependency directories and build artifacts from routine exploration.
- ■ Keep secrets out of agent inputs regardless of token cost.
Check your client’s actual controls. Search exclusions, indexing exclusions and tool-access restrictions are different mechanisms; one setting may not cover all three.
04 / Why did one test failure flood the next request?
Tool output often becomes model input. A full test suite can produce pages of repeated stack traces, snapshots and progress messages. If the client retains that output, later requests may carry it again.
Run the smallest relevant test target first. Capture verbose output locally, then return the failing command, exit code, first meaningful error and a bounded excerpt. Keep the full log available for follow-up. Trimming blindly to the last few lines can hide the original failure.
05 / Should I delete my agent instruction file?
No. Trim repetition rather than removing useful constraints. Keep build commands, test commands, architectural boundaries and non-obvious safety rules. Move lengthy background documentation out of always-loaded instructions and let the agent retrieve it when needed.
Read the combined instructions your client loads. Repository, directory and user-level guidance can overlap. Three copies of the same policy consume context without adding three times the clarity.
06 / When is a fresh session cheaper than another retry?
Consider restarting when history contains abandoned approaches, obsolete file contents or repeated failed tool calls. Prepare a compact handoff: objective, current changes, exact failing command, observed error and next hypothesis. Verify those facts against the working tree.
A fresh session still needs enough context to avoid repeating the investigation. Compare total task cost, not just the first request after restarting. Automatic compaction can help, but inspect its handoff for missing constraints.
07 / Does prompt caching make trimming pointless?
No. Cached input may be cheaper, but cache behavior and pricing vary. Stable instructions can benefit from reuse; unnecessary logs still consume context space and can distract the agent. Do not shuffle stable prefixes merely to make a request look smaller, and do not assume every repeated token receives a cache discount.
08 / Where does a cheaper API fit after trimming?
Optimize the payload first, then compare billed task cost. CheapRelay offers pay-as-you-go access through one key and works with Claude Code, Codex, Gemini CLI and OpenAI SDK clients. Billing is per real token, including cache reads and writes, with no monthly fee or subscription.
Sign up for CheapRelay when you are ready to test a bounded task. Hold the task and success criteria steady, inspect the usage receipt, and keep changes that reduce total cost without increasing failed attempts.
Sign up Try the prices yourself, sign-up credit included.
More reading
| Date | Aisle | Written in | Title |
|---|---|---|---|
| 2026-10-27 | Coding agents, cheaply | EN | The $5 Claude Code Setup Uses Two Environment Variables Point Claude Code at CheapRelay with two variables, cap a tiny pay-as-you-go budget, and verify the first request without a subscription. |
| 2026-10-27 | Coding agents, cheaply | EN | $2 a Day for Claude Code: A Budget, Not a Promise A beginner’s walkthrough for keeping Claude Code spending predictable with small tasks, token checks and a $2 daily planning limit. |
| 2026-10-27 | Coding agents, cheaply | EN | $1.00 for a $0.50 Coding Job An illustrative coding-assistant receipt shows how repeated context, noisy logs, long answers and blind retries turn a $0.50 task into $1.00. |
| 2026-10-27 | Coding agents, cheaply | EN | $0.18 for a CI Agent Run, With a $0.50 Ceiling A receipt-style CI agent budget: token costs, retry limits, request reservations, and a practical way to enforce a $0.50 run ceiling. |
| 2026-10-27 | Coding agents, cheaply | EN | $0.192 for a coding session, not $0.480 A worked API receipt for cheap-first pair programming, with explicit assumptions, escalation limits, and a fair cost comparison. |
| 2026-10-27 | Coding agents, cheaply | EN | $0.18 for a Codex Task, $0.62 for a Wandering Session An illustrative Codex receipt shows how narrow tasks, smaller context and fewer retries can cut token costs without hiding cache charges. |