How many tokens does a small bug fix take with AI?
A small bug fix typically takes about 106,000 tokens to build with an AI coding agent (roughly 42,000–255,000 depending on complexity), about $0.3100 at today's GPT-4o prices ($0.1200–$0.7500). This is the build-time (developer) cost, not the cost of running the finished feature.
A small bug fix is the cheapest thing an AI agent does: the problem is reproducible and localized, so it reads a little context, patches, and verifies. Cost is dominated by the context it has to read, not the tiny diff it writes.
Token & cost ranges
Cost uses GPT-4o at current prices. Verified 29 July 2026.
| Scenario | Input tokens | Output tokens | Total tokens | Est. cost |
|---|---|---|---|---|
| Low (simple) | 40,000 | 2,000 | 42,000 | $0.1200 |
| Typical | 100,000 | 6,000 | 106,000 | $0.3100 |
| High (complex) | 240,000 | 15,000 | 255,000 | $0.7500 |
Typical cost by model
The same typical token estimate priced across a few common coding models.
| Model | Typical cost | Range (low–high) |
|---|---|---|
| GPT-4o | $0.3100 | $0.1200 – $0.7500 |
| GPT-4o mini | $0.0186 | $0.00720 – $0.0450 |
| Claude Sonnet 4.6 | $0.3900 | $0.1500 – $0.9450 |
| Gemini 2.0 Flash | $0.0124 | $0.00480 – $0.0300 |
How we estimate this
A small bug fix is reproducible and localized — the agent reads a little context, proposes a patch, and confirms in one or two turns. Input tokens dominate because an agent re-sends file context on every turn; output is the generated code, diffs and tests. Treat these as planning ranges, not a quote — your real usage depends on codebase size, model, prompt caching and how many iterations it takes.
Examples of this size
- An off-by-one or null-check fix
- A CSS/layout glitch
- A wrong default or config value
Estimate it with your own model
Plug in your model, complexity and prompt-caching to get a tailored range.
Frequently asked questions
How many tokens does a small bug fix take to build with AI?+
A small bug fix typically takes about 106,000 tokens to build with an AI coding agent (roughly 42,000–255,000 depending on complexity), about $0.3100 at today's GPT-4o prices ($0.1200–$0.7500). This is the build-time (developer) cost, not the cost of running the finished feature.
Is this the cost to build it or to run it?+
This is the build-time (developer) cost — the tokens an AI coding agent burns while implementing the work. Running the finished feature is a separate, usually much smaller per-request cost.
Why is the range so wide?+
A small bug fix is reproducible and localized — the agent reads a little context, proposes a patch, and confirms in one or two turns. Input tokens dominate because an agent re-sends file context on every turn; output is the generated code, diffs and tests. Treat these as planning ranges, not a quote — your real usage depends on codebase size, model, prompt caching and how many iterations it takes.
How can I lower the cost?+
Split large work into smaller pieces, enable prompt caching so re-sent context is billed at the cheaper cache-read rate, and use a cheaper model for routine steps. Try your own model in the Cost to build X estimator.