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.

Inputs
turns
Whole number from 1 to 200.
runs
Whole number from 1 to 1 billion.
tokens
Instructions, schemas, initial prompt and existing history, including formatting.
tokens
Added before the next successful turn.
tokens
Include output formatting and tool-call structure. Use output_tokens − reasoning_tokens from measured usage, not tokenized visible text.
tokens
Retained and sent on later turns; the last turn’s results are not sent again.
tokens
A scenario assumption, not inferred from an effort setting. Billed as output.
%
Set to 0 if discarded, 100 if all retained, or an estimated fraction.
%
10% means 1.1 attempts per turn, not a recursive failure probability. Extra attempts repeat the same input and output budget.
USD / 1M
USD per million tokens. Example: GPT-6.1 Sol standard short-context rate. Flat rate across all turns; edit for your workload.
USD / 1M
Includes reasoning. No automatic pricing-cliff or caching adjustment.
USD
Your total fee assumption for one attempt. Include any search, execution or other service charges.

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
Per-turn ledger for one run (includes extra attempts)
TurnInput / attemptOutput / attemptExpected attemptsTurn USDCumulative USD
12,0001,5001.1$0.020900$0.020900
24,6001,5001.1$0.026620$0.047520
37,2001,5001.1$0.032340$0.079860
49,8001,5001.1$0.038060$0.117920
512,4001,5001.1$0.043780$0.161700
615,0001,5001.1$0.049500$0.211200
717,6001,5001.1$0.055220$0.266420
820,2001,5001.1$0.060940$0.327360
922,8001,5001.1$0.066660$0.394020
1025,4001,5001.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.

Results update as you type. The share link stores your inputs after the # in the address, which is not sent to our server, but anyone you send it to can read them.

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?
In this scenario, every successful turn adds tokens that are resent on subsequent turns. With constant growth, total input follows an arithmetic series instead of turns multiplied by the first prompt size.
Does a 10% retry setting mean a 10% failure probability?
No. It means 0.1 additional attempts per successful turn, or 1.1 attempts on average. A repeated-until-success failure model would require a different conversion.
Are reasoning tokens included in output?
Yes. Enter non-reasoning billed output and reasoning separately. The measured non-reasoning value is output_tokens − reasoning_tokens, including output formatting and tool-call structure. Do not use tokenized visible text: formatting can be billed even when reasoning_tokens is zero.
Should I retain reasoning from previous turns?
Use your actual model and request configuration. The OpenAI reasoning guide describes retention differences across model generations. This calculator lets you model any retained percentage without assuming one behavior for every API.
Does this predict my exact bill?
No. It assumes constant additions, flat prices and identical attempt budgets. Compare the ledger with actual usage; caching, context compaction, varying tool results and pricing thresholds can change costs.

Sources

Last reviewed 2026-11-14; next review due by 2026-12-14. The method is written out above so you can check our math.