AI agent cost calculator
Enter the tokens added on each turn, reasoning and retry assumptions, and your token prices. See a per-turn ledger and an estimated total across repeated runs.
Results
- Estimated total cost (USD)
- $466.400000
- Cost per run
- $0.466400
- Expected billed input tokens per run
- 150,700
- Expected billed output tokens per run
- 16,500
| Turn | Input / attempt | Output / attempt | Expected attempts | Turn USD | Cumulative USD |
|---|---|---|---|---|---|
| 1 | 2,000 | 1,500 | 1.1 | $0.020900 | $0.020900 |
| 2 | 4,600 | 1,500 | 1.1 | $0.026620 | $0.047520 |
| 3 | 7,200 | 1,500 | 1.1 | $0.032340 | $0.079860 |
| 4 | 9,800 | 1,500 | 1.1 | $0.038060 | $0.117920 |
| 5 | 12,400 | 1,500 | 1.1 | $0.043780 | $0.161700 |
| 6 | 15,000 | 1,500 | 1.1 | $0.049500 | $0.211200 |
| 7 | 17,600 | 1,500 | 1.1 | $0.055220 | $0.266420 |
| 8 | 20,200 | 1,500 | 1.1 | $0.060940 | $0.327360 |
| 9 | 22,800 | 1,500 | 1.1 | $0.066660 | $0.394020 |
| 10 | 25,400 | 1,500 | 1.1 | $0.072380 | $0.466400 |
- Last-turn input: 25,400 tokens. Check context capacity and pricing thresholds before applying flat rates. Example rates checked 2026-11-14; review due 2026-12-14.
- All retained history is resent. No compaction, truncation, caching or automatic long-context surcharge is modeled.
- Retries repeat the same budget and add no history. Reasoning retention and tool fees are explicit assumptions; actual failed requests may use different amounts.
Prices change often. We list the date we last checked each price; confirm on the provider’s official pricing page before you budget.
How it works
This is an explicit workload scenario. It retains all conversation history and tool results. OpenAI’s conversation-state guide says previous input in a response chain is billed again. Its reasoning guide bills reasoning as output and describes configurable retention of earlier reasoning.
growth = new input + non-reasoning billed output + tool results + reasoning × retained fraction
input at turn t = initial input + (t − 1) × growth
output per attempt = non-reasoning billed output + reasoning
expected attempts = 1 + extra-attempt percentage ÷ 100
turn cost = expected attempts × ((input × input price + output × output price) ÷ 1,000,000 + tool fees)
total = sum(turn costs) × runs
Non-reasoning billed output includes formatting and tool-call structure: use output_tokens − reasoning_tokens from usage, not tokenized visible text. For history growth, this scenario assumes that same non-reasoning budget is retained as later input; actual request formatting can differ.
Failed attempts use the same budget as successful ones here, but their outputs are discarded. New control tokens and tool results enter before the next successful turn. A final turn’s results do not create another model request. Retained reasoning may be fractional as an expected value.
Editable example prices are $2 input and $10 output per million tokens, from GPT-6.1 Sol’s standard short-context API pricing checked November 14, 2026. This calculator applies flat prices: it does not automatically apply long-context surcharges or cache discounts. Use the last-turn input to check your pricing tier and capacity. Tool fees are user assumptions. Storage, hosting and taxes are excluded unless you include them in that assumption.
Rounding: no intermediate rounding; costs display six decimals and expected token counts up to three. The ledger is limited to 200 successful turns.
Worked examples
Three turns with growing history
Use one run, initial input 1,000, new input 100, non-reasoning billed output 200, tool results 300, no reasoning, no retries and no tool fees. Input grows by 600: 1,000, 1,600, 2,200. At $2 input and $10 output per million, 4,800 input and 600 output tokens cost $0.015600.
Reasoning and extra attempts
Keep the three-turn scenario, add 400 reasoning tokens per attempt, retain 0% of reasoning, and use 50% extra attempts. Expected billed input is 7,200 and output is 2,700. Cost is $0.041400 per run, or $4.140000 for 100 runs.
Frequently asked questions
Why does history make later turns more expensive?
Does a 10% retry setting mean a 10% failure probability?
Are reasoning tokens included in output?
Should I retain reasoning from previous turns?
Does this predict my exact bill?
Sources
- OpenAI token counting — output includes formatting (checked 2026-11-14)
- OpenAI conversation state — previous input billing (checked 2026-11-14)
- OpenAI reasoning — output billing and reasoning retention (checked 2026-11-14)
- GPT-6.1 Sol — example short-context prices (checked 2026-11-14)
- OpenAI pricing — token and tool charges (checked 2026-11-14)
Last reviewed 2026-11-14; next review due by 2026-12-14. The method is written out above so you can check our math.