1. Home
  2. Free course
  3. Module 8

Spend where it pays.
Stop where it doesn't.

Every run costs money, time and your attention, and the three trade against each other. This module teaches you to choose the model and effort for the job, see where tokens go, pick a billing model that fits how you work, and set limits so that no run costs more than it is worth.

Module 8 of 8About 40 minMastery

What you will be able to do

  • Pick a model and an effort level for a task, and change them mid-session when the work changes.
  • Explain why a long session costs more per message than a short one, and keep context lean.
  • Choose between a subscription and pay-per-token billing based on how you actually work.
  • Decide when running agents in parallel saves time and when it only multiplies cost.
  • Set a budget and a stopping rule before a run, and read your usage afterwards.

The other modules made runs better. This one makes them worth it. An operator is trusted with a budget the way any professional is: the question is not "can the agent do this?" but "is this the cheapest reliable way to get it done?". Cheapest here means total cost, including the hour you spend fixing a result that a stronger model would have got right the first time.

About the figures on this page

Harness features, models and prices change often. Every figure here comes from the official page it links to, as that page read on 28 November 2026. Check the source before you rely on a number.

8.1 Model and effort

Two settings decide most of a run's cost and quality: which model, and how hard it thinks.

Which model

Model families differ in capability, speed and price. Claude Code offers aliases that point to the current recommended version: sonnet for daily coding tasks, opus for complex reasoning, haiku for simple tasks, and fable for the hardest and longest-running tasks. There is also opusplan, which uses Opus during plan mode and then switches to Sonnet for execution (model configuration). /model switches mid-session.

Anthropic's own cost guidance is a good default: Sonnet handles most coding tasks well and costs less than Opus; reserve Opus for complex architectural decisions or multi-step reasoning; give simple subagent tasks a smaller model such as Haiku (manage costs). For scale, here are the list API prices for the current models of each family:

ModelInput, per million tokensOutput, per million tokens
Claude Opus 5.5$4$20
Claude Sonnet 5.5$2$10
Claude Haiku 5.5 (prompts up to 100,000 tokens)$0.10$0.50

USD list prices from Anthropic's pricing page, as shown on 28 November 2026. The same page lists cache, batch and long-context rates; subscription plans are priced separately at claude.com/pricing.

Two things in that table matter more than the exact figures. Output costs five times input on each of these models, so a model that writes long explanations nobody reads is spending on the expensive side. And the gap between families is large, so sending a mechanical sweep to the top model is a real waste, while sending a hard design problem to the cheapest is a false saving.

How hard it thinks

Effort controls how much the model reasons before acting. In Claude Code the levels are low, medium, high, xhigh and max on current models, set with /effort, the --effort flag, the CLAUDE_CODE_EFFORT_LEVEL variable or settings. The docs describe them like this:

LevelWhen to use it
lowQuick exchanges where you review each result: brainstorming, a first sketch, a rename
mediumThe default on the current 5.5 models
highWork where verification matters or edge cases are likely, such as fixing a bug in existing code
xhighDeeper reasoning at higher token spend
maxHard problems you want worked through without you; may show diminishing returns and overthink, so test it before using it widely

Thinking tokens are billed as output tokens. That makes effort one of the strongest controls on cost: the same model at a lower level can be much cheaper on a simple task, often with no loss you would notice. Other harnesses name and expose this setting differently, so check their docs; the principle is the same.

A decision rule

  1. What does a wrong answer cost? If you will catch it at a glance (a rename, a draft), go cheap and fast. If it will hide until production (concurrency, security, money), go strong.
  2. How much judgement does it need? Mechanical work with a clear check, such as tests, sweeps or formatting, rarely needs the top model. Design, root-cause analysis and anything with competing constraints often does.
  3. Is it a plan or an execution? Plan with the strong model, execute with the cheaper one, the way opusplan does.

The common mistake: one model, one effort level, for everything. Usually that means paying the top price for routine work, or a cheap model failing at a hard task three times and costing more than one strong run would have.

Same task, two settings

Pick a small, well-specified task with a test. Run it twice in fresh sessions from the same commit: once at your usual model and effort, once a step down. Compare the result, the time, and the cost or usage shown at the end. Do it for three task types and write down where the cheaper setting was good enough.

8.2 Where the tokens go

The single most useful fact about agent cost: every request sends the whole conversation. Claude Code's docs put it this way: it sends your full conversation with every request, and each time the agent uses tools it sends another request carrying that batch of tool results (why usage climbs in a long session). A one-line question in a session open all day still pays for the whole day.

Caching softens it, with conditions

Prompt caching means repeated content is re-read at a much lower rate than fresh input. On Opus 5.5 and Sonnet 5.5, a cache hit is priced at 0.05 times the base input price (pricing, prompt caching). But the cache has a lifetime. Your first message after a break longer than that lifetime misses the cache and reprocesses the full context at the full rate. Long sessions are cheap while you work steadily and expensive when you come back to them.

Where context comes from

  • What loads before you type: instruction files, memory, skill descriptions, MCP server instructions, hook output. Paid on every request of every session. Module 7 shows how to keep it small. /context shows what is using space.
  • Tool output: a 10,000-line log, a full test run, a large file read in one go. It stays in the conversation and is re-sent with every later request.
  • The conversation itself: failed attempts, long explanations, pasted documents.

Keep it lean

  1. Clear between unrelated tasks. /clear starts fresh and costs nothing. Stale context is paid for on every later message.
  2. Compact with intent. /compact reads the whole conversation it summarises, so it is itself a large request. Use it when you need continuity, and clear when you do not.
  3. Trim output before it arrives. The docs show a PreToolUse hook that rewrites test commands to keep only the last 100 lines of output. Ask for grep over a log, not the log.
  4. Send verbose work to a subagent. Running tests, reading docs or processing logs in a subagent keeps the bulk in its context; only a summary comes back to yours. The subagent's own requests still count, so give it a smaller model when the job is simple.
  5. Prefer a CLI to an MCP server when both exist: tools like gh add no per-tool listing to context.
  6. Be specific. "Improve this codebase" makes the agent scan everything. "Add input validation to the login function in auth.ts" reads a few files.

The common mistake: one session for the whole day. It feels efficient because the agent "remembers everything". It is the most expensive way to work, and the old context makes the agent worse at new tasks, not better.

Measure your floor

Start a fresh session in your main project and run /context (or your harness's equivalent) before typing anything. That number is what every request in every session pays before any work. Find the largest item and decide whether it earns its place.

8.3 Subscriptions and API billing

There are two common ways to pay for an agent, and they reward different habits.

SubscriptionPay per token (API)
How you payA fixed plan, with usage included up to limitsEach token at the listed rate, billed for what you use
What runs outUsage within a window; then you wait, or pay for more if the plan allowsNothing, until a spend limit you set
RewardsSteady daily use by one personBursty, automated or shared use, and exact cost tracking per project
RiskHitting a limit in the middle of a deadlineA runaway run costing far more than expected

For Claude Code specifically, as its cost docs describe it today: Pro, Max and Ultra subscribers have usage included in their plan, so the session cost figure in /usage is not what they are billed; subscribers see plan usage bars and a breakdown instead. On Team and Enterprise plans each member's usage draws from a per-seat allowance that resets on a rolling five-hour window and a weekly window. Usage credits let subscribers keep working past a plan limit. On the Claude Console, and on cloud providers, usage is billed per token to the organisation (manage costs). Codex and other harnesses have their own plans; read their pricing pages rather than assuming they work the same way.

For a sense of scale, the same Claude Code page states that across enterprise deployments the average cost is around $13 per developer per active day and $150 to $250 per developer per month, with costs below $30 per active day for 90% of users. That is Anthropic's figure for its enterprise customers, not a prediction of yours; the page itself recommends piloting with a small group to set your own baseline.

How to choose

  1. Track one normal week of usage first. Most harnesses report it: /usage in Claude Code.
  2. If your use is daily, interactive and by one person, a subscription is usually simpler and caps your downside.
  3. If you run agents from scripts or CI, share them across a team, or need cost per client or project, per-token billing with workspace limits gives you control and a record.
  4. Many operators use both: a subscription for interactive work, an API key for automation. Keep them separate so each one's numbers mean something.

The common mistake: treating a subscription as free. Its limits are real, and a heavy session in the morning can leave you waiting in the afternoon. The habits in 8.2 stretch a subscription exactly as they cut an API bill.

Read your own week

Open your usage view (in Claude Code, /usage; press d or w to switch between the last day and the last week on a plan). Write down what share went to subagents, skills or MCP servers, and whether any recommendation applies to at least 10% of your usage. Act on the largest one.

8.4 Parallelism and time to result

Running several agents at once is the operator's biggest lever on time, and the easiest way to multiply cost. Each agent has its own context window. Claude Code's docs are direct about it: token usage for agent teams is roughly proportional to team size, and agent teams use approximately 7 times more tokens than standard sessions when teammates run in plan mode (agent team token costs).

When parallel pays

  • The pieces are truly independent. Different files, different checks, no shared decisions (module 3). If agent B needs agent A's result, running them together just means B guesses.
  • Wall-clock time matters. A fix needed before a release, or a review needed before a meeting. Paying more tokens to finish in an hour instead of four can be the right trade.
  • You can review the output. Six agents produce six results. If you cannot check them, the run is not finished; it has moved the work to you. Budget your own review time as part of the cost.

When it does not

  • The task has fewer real pieces than agents. Extra agents invent work or duplicate it.
  • The pieces touch the same files. Merge conflicts cost more than the time saved.
  • Nobody is waiting for the result. A sequential run overnight costs the same tokens with less coordination.

Mix the models

Not every agent in a team needs the top model. The docs suggest Sonnet for teammates. The /swarm command in the free HOPE skills encodes one such mix: /swarm 10 starts six Sonnet agents for sweeps, mechanical edits, tests and docs, three Opus agents for design, tricky logic, security and root-cause work, and one Fable reviewer that starts only after every worker has reported. If the task has fewer real pieces than N, it uses fewer agents and says why.

/swarm 6 audit billing for rounding errors

  Split: 6 pieces → 4 Sonnet, 2 Opus
  Opus:   invoice totals (src/billing/total.ts), tax rules (src/billing/tax/)
  Sonnet: refunds, credit notes, currency formatting, test coverage report
  Each reports findings with file:line and a failing test where possible.

The common mistake: measuring speed by the first agent to finish. Time to result is when the last result is checked and merged. Five agents that finish in ten minutes and need two hours of untangling were slower than one agent that took an hour.

Price a parallel run

Before your next parallel run, write down three numbers: how many agents, roughly how long each will run, and how long you will need to review all the results. After the run, compare with the actual figures from your usage view and your clock. Adjust your next estimate.

8.5 Budgets, monitoring and stopping

A budget decided before a run is a decision. A budget decided during a run is a negotiation with sunk cost, and sunk cost usually wins.

Set limits in the harness

  • Per run. Claude Code's print mode takes --max-turns to cap agentic turns and --max-budget-usd to stop once estimated spend reaches an amount, with subagent spend counted. The cap is checked against a client-side estimate and spend can pass it, so leave headroom (CLI reference).
  • Per team or project. On the Claude Console, workspace spend limits; on Team and Enterprise plans, spend limits in admin settings; on cloud providers, the cloud's own budget controls.
  • Continuous monitoring. Claude Code can export metrics through OpenTelemetry, which the docs describe as the only option that streams per-user token and cost metrics into your own observability stack in near real time. The status line can show cost and context while you work.
claude -p "$(cat brief.md)" \
  --model sonnet --effort medium \
  --max-turns 40 --max-budget-usd 5 \
  --output-format json > run.json

Watch for silent spend

Some usage happens when you are not typing. The Claude Code docs list scheduled tasks that fire on their interval while a session is idle, messages from other sessions delivered as new turns, background subagents and teammates that keep running until they exit, and compaction of a large context. Before you walk away from a session, stop what you do not need running; /tasks shows running shells and subagents.

When to stop a run

Decide your stopping rules before you start, and write them into the brief for unattended runs.

  1. The cost passes the value. If the fix is worth an hour of your time and the run has spent more than that hour's worth, stop and do it yourself or rethink it.
  2. Three failed attempts at the same thing. The agent is guessing (module 5). More tokens will buy more guesses. Stop, find the missing fact, then restart.
  3. The context is full of failure. If the session is mostly wrong turns, a fresh session with a better brief is cheaper than carrying the dead weight on every request.
  4. The task has changed. What you are doing now is not what you briefed. Stop, re-brief, and price it again.

Stopping is not failure. A run stopped at the right moment is cheaper than one that "finishes" with a result you then have to throw away.

The common mistake: "it's almost there". An agent one fix from done for the last forty minutes is not almost there. Look at the trend in the trace, not at the agent's estimate of how close it is.

Write your stopping rules

Add a short "Stop when" section to your brief template: a turn or money limit, and the number of failed attempts after which the agent must stop and report rather than try again. Use it on your next three tasks and note whether any run hit it.

Practice task

Run a cost review of one week of your real work, then apply what you find to the next week.

  1. Collect one week of usage: tokens or spend by day, and the share for subagents, skills and MCP servers if your harness shows it.
  2. List your ten most expensive sessions. For each, note the task, the model and effort, the session length, and whether the result was used.
  3. Mark each one: right setting, too strong, too weak, or should have been stopped earlier.
  4. Measure your startup context (8.2) and cut its largest unnecessary item.
  5. Write a one-page policy for yourself: which model and effort for which task types, when to clear, when to parallelise, and your stopping rules.
  6. Work the next week by the policy and compare the two weeks.

Success criteria

  • A table of your ten most expensive sessions, each with a verdict and a reason.
  • A written policy with at least three task types, each with a model, an effort level and a stopping rule.
  • Startup context smaller than at the start of the review, with the number before and after.
  • In the second week, the same kinds of work were done for less usage, or the same usage bought more finished tasks, shown with numbers from your usage view.
  • No accepted result in the second week needed rework because the setting was too weak.

Check yourself

Why does a short question cost more late in a long session than at the start of a new one?

Every request sends the whole conversation. Late in a session that is a lot of context, re-read on every request; caching lowers the rate while the cache is warm, but a break longer than its lifetime means a full-price reprocess.

Which setting usually has the most effect on cost for a simple task, and why?

Effort. Thinking tokens are billed as output, the expensive side, so lowering effort on a task that does not need deep reasoning cuts cost with little loss in quality.

When does a subscription fit better than per-token billing?

For steady, interactive daily use by one person: the cost is predictable and the downside is capped. Per-token billing fits automation, shared or bursty use, and cases where you need exact cost per project.

Six agents finished in ten minutes. Was the parallel run fast?

Only if the results were checked and merged quickly too. Time to result ends when the last result is verified and integrated, and the review time is part of the cost.

A run has tried the same fix three times. What does economics say you should do?

Stop. More tokens buy more guesses. Find the missing fact, then restart from a sharper brief, which also drops the failed attempts from the context you would otherwise pay to re-send.

Key takeaways

  • Match model and effort to the cost of a wrong answer. Plan strong, execute cheaper.
  • Every request sends the whole conversation. Clear between tasks, trim output, keep startup context small.
  • Subscriptions reward steady personal use; per-token billing rewards automation and tracking. Measure a week before choosing.
  • Parallel agents cost roughly in proportion to their number. Use them for independent pieces when time matters and you can review the results.
  • Set the budget and the stopping rules before the run. Stopping at the right moment is part of the job.

Go further

  • Module 3, Decomposition: splitting work so parallel agents never collide.
  • Module 5, Steering: reading a run well enough to know when to stop it.
  • Module 7, Compounding: keeping the setup that loads every session small.
  • HOPE console: tokens and cost for every session, across harnesses, in one view.
  • Free skills: /swarm for a fixed model mix, /compact-check for when to compact.
  • Training: the guided version of this module, practised on a live harness with your transcript reviewed against an expert run.
  • Certification: every exam is a live task on a real harness, graded on the transcript, the evidence and the result.