AI agent cost calculator
What an AI agent costs per task and per month. Agents re-read their whole conversation at every step, so input grows with each step. Prompt caching usually cuts the bill by more than half.
Start from a typical agent
Claude Code, Codex or Cursor-style agent. Typical starting values; adjust them to match your agent.
Where the tokens go
- Context at the first and last step19K → 102K tokens
- Input tokens per task served from cache2.11M of 2.42M
- Share of cost from input87% input · 13% output
- Same work done by a person ( min per task at $/hour)$45.00 per task
Same agent on other current models
Monthly cost for the workload above. Models without a cache-read price pay full price for repeated input.
How agent costs add up
An agent calls the model once per step. Each call resends the system prompt, tool definitions, the task and everything that has happened so far. A 40-step coding task with an 18,000-token system prompt reads about 2 million input tokens, even though the model only writes around 15,000.
That is why caching matters more for agents than for chat. When the start of the conversation is unchanged between steps, providers bill the repeated part at the cache-read rate, often a tenth of the input price or less.
The calculator adds each step's context as: system prompt + request + (step − 1) × (tool result + output). Cached tokens are the part of each step's context that was already sent in the previous step.
Cutting the bill
- Keep the prefix stable. A timestamp or random ID near the top of the prompt breaks the cache on every step.
- Trim tool output. Tool results are the fastest-growing part of the context. Return summaries, not whole files.
- Route easy steps to a cheaper model. Planning on a frontier model and routine steps on a small one can cut costs several times over.
- Check subscriptions. For one heavy user, a $100–200 plan that includes an agent can cost less than the API. Compare them.
Related guides: Hermes Agent running costs · OpenClaw setup