How much does AI coding cost, and how do you control it?
How AI coding is priced per token, why agent sessions cost more than chat, how to estimate spend per developer, and the caps that stop a runaway bill.
AI coding is billed by the token: every model call charges for the text sent in (input tokens) and the text generated (output tokens), at per-million-token rates that differ by model and are usually higher for output. What a team actually spends depends less on the price list than on how it works: agent sessions resend a growing context on every turn, so one long session can cost more than hundreds of quick completions. You control it by seeing cost per session, matching the model to the task, keeping context small and cached, and setting hard caps that stop work instead of only warning.
How token pricing works
A token is a piece of text, roughly a short word or part of a longer one. Each model family has its own tokeniser, so the same text can count as a different number of tokens on different models. Every request to a model is measured in tokens and billed in three main parts:
- Input tokens: everything sent to the model, including the system prompt, instructions, files, tool results and the conversation so far.
- Output tokens: everything the model generates. For models that reason before answering, the reasoning tokens are usually billed as output too.
- Cached input: providers that support prompt caching bill repeated input that is read from cache at a lower rate. Writing to the cache may cost more than ordinary input.
Prices are quoted per million tokens and vary widely between models. Larger, more capable models cost more per token than smaller ones. Prices also change, often downwards, as new models appear. A call that fails part-way has usually already used tokens, and providers bill those.
Why agent sessions cost more than chat
A chat question is one request: a prompt in, an answer out. An agent session is a loop. The agent reads the task, calls the model, runs a tool, adds the result to the conversation and calls the model again. Each call sends the whole conversation so far.
That has a compounding effect. If the context grows by a similar amount every turn, the total input across the session grows roughly with the square of the number of turns. Doubling the length of a session more than doubles its cost. Input tokens, not output, usually dominate the bill of an agent session.
Multi-agent workflows multiply this: each agent step has its own prompt and context, and later steps often read what the earlier ones wrote.
A worked example
The rates here are illustrative round numbers, not any provider's prices: $2 per million input tokens and $10 per million output tokens.
An agent session makes 20 model calls. The first call sends 20,000 tokens of context, and each call adds 4,000 tokens of file contents, tool results and model output. Each call generates 1,000 output tokens.
- Input: 20 calls that start at 20,000 tokens and grow by 4,000 each time add up to 1,160,000 tokens, or $2.32.
- Output: 20 × 1,000 = 20,000 tokens, or $0.20.
- Total: about $2.52, of which more than 90% is input.
If the same session runs for 40 calls instead of 20, input rises to 3,920,000 tokens and the total to about $8.24: twice the turns, more than three times the cost.
Caching changes the picture. If the earlier conversation is read from cache at a tenth of the input rate on every call after the first, and only the new 4,000 tokens per call are billed at the full rate, the input for the 20-call session falls from $2.32 to about $0.40, before any charge for writing to the cache.
Spend per developer
There is no single number for what AI coding costs per developer, because it depends on habits more than headcount. A useful estimate is:
monthly cost ≈ developers × sessions per developer per working day × working days × average cost per session
With the example above, 10 developers each running 5 sessions a day for 21 working days, at $2.52 a session, comes to about $1,320 a month. Change any factor and the result moves in proportion; change session length and it moves faster than that.
The factors that move spend most:
- Model choice. The same task on a top model can cost many times more than on a smaller one.
- Session length. Long, open-ended tasks loop more. Smaller, well-defined tasks finish sooner.
- Context size. Sending whole repositories when a few files would do.
- Retries and re-runs. Failed runs still cost money.
- Scheduled and automated work. A schedule that runs every hour on every repository spends without anyone watching.
The figure worth tracking is cost per merged change, not cost per token. A cheap model that needs three attempts can cost more than an expensive one that gets it right first time.
Per-seat vs usage-based pricing
AI coding tools are sold in two broad ways, and many combine them.
| Aspect | Per-seat subscription | Usage-based (per token) |
|---|---|---|
| What you pay for | Each user, per month | The tokens actually used |
| Predictability | High, until usage limits or overage charges apply | Low without caps; tracks actual work |
| Heavy users | Subsidised by light users, or rate-limited | Pay for what they use |
| Agent workloads | Often limited by fair-use or request quotas | Scales with session length and model choice |
| Control mechanism | Seat count and plan tier | Budgets, caps, model choice and allowances |
| Visibility needed | Who has a seat | Cost per session, per step and per model |
Usage-based pricing is closer to the real cost of agent work, but it needs the controls in the next section.
How to control AI coding spend
- Measure per session and per step. You cannot manage what you only see as a monthly invoice. Record tokens and cost for every model call, attributed to a session, a person and a workflow.
- Set a hard cap per period. Daily, weekly or monthly. It should stop new work and stop running work before its next model call, not only send an email.
- Add a soft limit below it as an early warning, so people can react before the hard stop.
- Cap expensive workflows separately, so one long-running kind of task cannot use the whole budget.
- Match models to tasks. Use the strongest models where judgement matters, such as planning and review, and cheaper ones for drafting and routine edits.
- Keep context lean and cached. Send the files the task needs, and use prompt caching where the provider supports it.
- Bound every run. Time limits and turn limits stop loops that are not converging.
- Fail closed. If the budget check itself errors, block the run rather than let it proceed unmetered.
- Review the expensive outliers each week, and fix the task definitions or schedules behind them.
OWASP lists unbounded consumption among the top risks for LLM applications. For coding agents, a hard cap is the control that addresses it.
How AI CodeOps does it
AI CodeOps meters every model call a session makes as it happens, including calls that fail part-way, and shows the cost of each session and agent step on the session page, of each change under Changes, and per day on the Usage page. It is free during the open beta; see pricing.
Owners, admins and billing admins set a workspace cost budget: a period (daily, weekly, monthly or rolling 30 days, in UTC), a soft limit, a hard limit and optional per-workflow caps. There are no per-agent caps. Amounts are stored in millionths of a US dollar. A $500 monthly cap with a warning at $400 and a $50 cap on one workflow:
{
"enabled": true,
"period": "monthly",
"softLimitMicros": 400000000,
"hardLimitMicros": 500000000,
"perWorkflowLimits": { "feature-sdlc": 50000000 },
"expectedVersion": 3
}
Once spend is over the hard limit, a new session is refused:
{
"allowed": false,
"state": "denied",
"summary": "Dispatch denied: budget exceeded",
"reasons": ["over_workspace_cap"],
"currentSpendMicros": 501830000,
"softLimitMicros": 400000000,
"hardLimitMicros": 500000000,
"perWorkflowLimitMicros": null,
"estimatedCostUsdMicros": 0,
"periodStartedAt": "2026-10-01T00:00:00.000Z",
"period": "monthly"
}
The budget is also checked before every model call, so a running session that crosses the hard limit stops before its next call; one call already in flight can take spend slightly past the cap. If the check itself fails when a session starts, the session is blocked rather than run unmetered; if it fails during a session, the session keeps running.
Sessions on the platform's models run on Economy, Standard or Premium tiers, each with a monthly token allowance, or on Auto, which sends steering steps such as planning and review to the best tier you have allowance for and drafting steps to Economy first. A session never switches tier on its own when an allowance runs out. A workspace can also bring its own provider key; the provider bills it directly, and the workspace budget still applies. Claude sessions use prompt caching, and usage counts cache reads at their own rate.
See AI coding cost controls, the Cost controls, Models and tiers and Usage and spend guides, and estimate your own numbers with the free AI coding cost calculator.
Go deeper
- Prompt caching explained: how caching works, why it suits agents that resend their context, what breaks a cache and how to check it is working.
- How to set an AI coding budget: choosing a period, soft limits and hard caps, where enforcement must happen, and per-workflow caps.
Frequently asked questions
Why do output tokens cost more than input tokens?
Generating each output token takes a full pass through the model, while input tokens are processed together. Providers price that difference, so output is usually several times more expensive per token.
Why are AI agent sessions so much more expensive than chat?
An agent works in a loop, and each turn sends the conversation so far back to the model. The context grows every turn, so total input tokens grow much faster than the number of turns.
How much does AI coding cost per developer?
It depends on how often each developer runs sessions, how long they are and which models they use. Multiply developers by sessions per day, working days and the average cost per session, and measure the last figure on your own work.
What is the difference between a soft limit and a hard cap?
A soft limit warns when spend passes it and lets work continue. A hard cap stops new work, and ideally running work, once it is reached. You need a hard cap to bound the bill.
Does prompt caching reduce cost?
Yes, for repeated context. Providers that support it bill cached input reads at a lower rate than fresh input, which helps agent loops that resend the same history every turn. Cache writes may cost extra.