Shipping a feature with AI agents typically costs a few dollars in model tokens — but the number that matters is cost per shipped feature, not cost per token. That means counting the retries, the failed runs, and the chunking decisions that never made it into the diff, then dividing total spend by features that actually merged. Anyone quoting you "$0.30 per PR" without that denominator is quoting you a marketing number, not a cost.

Almost nobody publishes real AI development cost economics. Vendors quote token prices because token prices are small and impressive. They don't quote cost per feature because that number includes the runs that failed, the context that had to be rebuilt after a bad edit, and the human review cycles that follow. This article is the honest version, with the arithmetic shown.

Why does the token bill understate the real cost?

Every serious LLM provider — Anthropic, OpenAI — bills across at least four buckets, and most teams only track one or two:

Collapse these four into "tokens used" and you lose the ability to answer a basic engineering question: is a feature expensive because the model is generating a lot of code, or because your agent pipeline keeps re-sending the same 40k-token repo context on every retry? Those are different problems with different fixes. One is a prompting/architecture fix; the other is a model-choice fix.

How do you track AI token spend per project?

You need a usage ledger, and it needs a key granular enough to answer "why did this cost what it cost" six weeks later. The minimum viable key is:

tenant → feature → stage → run

Log the four token buckets per run, plus the model used (pricing varies by model generation, not just provider), plus a status field (succeeded, retried, abandoned). Without the abandoned runs in the ledger, your average cost per feature is quietly wrong — often by 2-4x — because the failures are invisible until you sum everything at the tenant level and wonder why the bill doesn't match the "cost per PR" you were quoted.

The rule of thumb: if your cost tracking can't reconstruct a failed run, it can't tell you your real cost per feature — it can only tell you your cost per success, which is a rosier and less useful number.

Why is per-run pricing hard to compare?

Per-run pricing looks clean in a pricing table — "$2 per agent run" — but it quietly asks the customer to pay for your retries. If a feature needs one clean run, it costs $2. If the same feature needs four attempts because the model misread the schema or the test suite flaked, does it cost $8? Whoever answers "yes" is pricing their reliability problems into the customer's bill, and whoever answers "no" is absorbing the variance with no way to show the customer why.

Per-feature or per-PR pricing is the more honest and more comparable unit, because it forces the vendor to own the retry cost internally and only bill for the outcome — a merged pull request. It also matches how engineering leaders actually think about ROI: nobody budgets in "agent runs," they budget in delivered features, the same unit DORA metrics and DORA research use to measure delivery performance. If you're evaluating vendors, ask directly: is your unit price per run, or per shipped outcome? The answer tells you who's holding the retry risk.

What does a worked example look like?

Take a mid-complexity feature: "add role-based access control to the reporting module." Here's a realistic run breakdown using a mix of large-context and standard model calls:

StageRunsInput tokensOutput tokensCache readCost
PRD generation18,0002,5000$0.11
Planning / architecture2 (1 retry)22,0006,00018,000$0.34
Code generation3 (2 retries)60,00028,00090,000$1.92
Test generation115,0004,50012,000$0.22
Review/fix loop4 (3 retries)48,00016,00060,000$0.95
Total11 runs$3.54

That $3.54 is the honest cost of this feature — not the $0.85 you'd get if you only counted the final successful run at each stage. The 6 retries account for roughly 60% of total spend. That ratio, retry cost as a share of total, is one of the most useful numbers you can track over time: it tells you whether your pipeline is getting more reliable (ratio falling) or your feature complexity is creeping up (ratio rising).

Scale that to 40 features shipped a month and you're at roughly $140/month in model spend — trivial next to one engineer's salary, which is exactly why vendors like to quote the token number alone. The real cost conversation is about engineering time spent reviewing, not model spend. But you can't have that conversation credibly if your cost-per-feature number is already wrong by 4x.

How should you set budget controls without breaking the pipeline?

Two different controls get confused constantly, and they solve different problems:

Conflating the two means either your safety rail is set so loose it never protects anything, or your customer-facing budget cap is set so tight it kills legitimate retries mid-feature. Set them independently, log which one triggered when a run stops, and surface per-period spend to the customer in the same unit they think in — dollars per month, not tokens per run.

Does using your own API key change the cost?

Yes — it changes who sees the bill, not just how it's calculated. With bring-your-own-key (BYO-key), token cost flows directly to the customer's own provider account, at their negotiated rate, visible in their own billing dashboard. Without it, the vendor absorbs and marks up token cost inside a flat or seat-based price, and the customer never sees the four-bucket breakdown at all. If you're running on-prem or self-hosted models, this decision also intersects with data residency and model choice — worth understanding before you commit to either model, since switching later means re-instrumenting your entire ledger.

Where does this fit into an actual delivery pipeline?

Cost tracking is only useful if it's attached to a pipeline that produces shipped features, not just agent output. VocxAI turns customer feedback into shipped code — it ingests signals from your support and feedback tools, prioritises what to build, and runs an AI agent pipeline from PRD to pull request with human approval at every gate. Every stage in that pipeline — PRD, planning, code generation, test generation, review — is a natural place to key your usage ledger, which is exactly the tenant → feature → stage → run structure described above.

If you're deciding whether to automate feature development end-to-end, it's worth reading how the pipeline stages break down before you try to cost them. And if prioritization is still manual, the cost-per-feature number means less until you know which features were worth building in the first place.

FAQ

How much does it cost to generate code with AI?

Raw token cost for a single successful generation is usually cents to a few dollars, depending on model and context size. The honest number — including retries and failed runs — is typically 2-4x higher once you account for the full pipeline needed to reach a mergeable PR.

What is cost per feature in AI development?

Total token spend (input, output, cache creation, cache read) across every run and stage required to ship one feature — including failed attempts — divided by one. It's the only cost unit that maps to business value, since "features shipped" is what engineering leaders and finance actually budget against.

How do you track AI token spend per project?

Build a usage ledger keyed by tenant → feature → stage → run, logging all four token buckets, model used, and run status (succeeded, retried, abandoned) at each row. Without the abandoned runs, your averages will understate true cost.

Why is per-run pricing hard to compare?

Because it bills customers for the vendor's retries. A feature needing one run and a feature needing five runs cost different amounts under per-run pricing, even though the customer receives the same outcome. Per-feature or per-PR pricing forces the vendor to own that variance.

Does bring-your-own-key change the cost?

It changes visibility more than magnitude — with BYO-key, token spend hits the customer's own provider account directly at their rate; without it, the vendor absorbs and marks up the cost inside a flat or seat-based fee, and the breakdown by token bucket disappears from the customer's view.

See how VocxAI builds this for you

VocxAI connects your customer signals to your revenue data and surfaces a ranked, revenue-weighted product backlog - automatically, every week.

Join the private beta