Guides / ai cogs calculator
AI COGS, and what actually belongs in it
AI cost of goods sold is the model spend required to serve a paying customer, including retries and discarded output, excluding research and evaluation runs. Most teams under-count it by leaving waste out. Culpa, a local-first LLM cost, margin, and forecast ledger, meters every call including failures, so your COGS reflects spend rather than intent.
Computed in your browser, in exact decimal
Gross margin only. It excludes fixed hosting, salaries and support, so the real figure sits below this one.
Rates come from Culpa's price book, effective 2026-07-02. Every figure is computed in exact decimal rather than floating point, which is why totals here match an invoice to the cent. Cost is calculated, not provider-reported: it prices the tokens you enter at a published rate.
Why this happens
COGS goes wrong in two directions at once. Teams exclude retries and discarded responses, which understates the real cost of serving, and they include evaluation and development traffic, which overstates it by charging research to the customer line. The result is a number that's wrong in both directions and reconciles with nothing. Getting it right needs per-call attribution that separates customer-serving traffic from everything else.
What this usually looks like
- Your COGS figure doesn't reconcile with your provider invoice in either direction.
- Evaluation runs and background jobs are folded into the same bucket as customer traffic.
- Retries are excluded because they felt like errors rather than costs.
- Nobody can state COGS for a single named customer without a manual exercise.
Free, no card, no account
Run the free Cost Leak Scan
It shows your most expensive conversation before you install anything.
Mistakes that cost the most
| Mistake | Why it hurts | Do instead |
|---|---|---|
| Excluding retries and discarded responses from COGS. | Both bill in full, so COGS reads low by exactly your waste ratio and worst during incidents. | Count every billed token, then track separately how many you actually used. The ratio is the metric. |
| Including evaluation and development traffic in COGS. | That's research spend, not cost of serving, and it makes your unit economics look worse than reality. | Tag eval and background runs as their own features so they sit outside the customer-serving line. |
| Computing COGS once and reusing the figure. | Model mix, prompt length and provider rates all drift, so a stale COGS misprices every decision built on it. | Recompute monthly from the ledger at the rates in effect for that month. |
Run this check tonight
- Sum every billed token attributable to customer-serving traffic last month, retries included.
- Subtract anything tagged as evaluation, development or background work.
- Divide by paying customers. That's your COGS per customer, and it will exceed your estimate.
- Express COGS as a percentage of revenue. That single number is your gross margin.
- Check what share of spend has no attribution at all. That gap is the honesty of the whole figure.
The same month, COGS counted two ways
Illustrative example
A month with $1,000 of total provider spend on GPT-5.4 at $2.50 and $15.00 per million. The split below is modelled but the rates are real.
The headline margin barely moved while $320 was misattributed in both directions. The number looked stable precisely because two errors offset, which is the worst way to be right.
Every number, with its confidence and source
| Figure | What it means | Confidence | Source |
|---|---|---|---|
| $700 to $880 | modelled customer COGS range, naive count versus corrected, against a $1,000 month | estimated | Modelled split of a $1,000 month priced at real GPT-5.4 rates from the price book, effective 2026-07-02. Published as a scenario because no customer data backs it. |
| $140 to $320 | modelled misattribution range hidden by two offsetting errors, one leg alone versus both | estimated | The $180 excluded retries plus the $140 wrongly included eval spend, from the teardown arithmetic. |
What a generic answer can’t know
A provider invoice is one total. Splitting it into customer-serving spend, waste and research needs a tag attached when each call is made, and those tags only exist inside your application. Culpa captures them on your infrastructure, keeps your prompts and responses there, and counts the calls to run your plan.
Questions founders ask next
Do retries belong in AI COGS?
Yes. A retried call bills in full and it happened in the course of serving a customer. Excluding it makes COGS read low by exactly your waste ratio, and the understatement is worst during the incidents you most want to understand.
Should evaluation runs count as COGS?
No. Eval and development traffic is research spend, not cost of serving. It belongs in its own line, tagged at capture, or it inflates your unit economics and hides how much you spend on testing.
How do I get COGS for one named customer?
Attach a customer identifier to every outbound call at request time. Without it the calls are anonymous afterwards and no analysis recovers the mapping, so per-customer COGS becomes impossible rather than merely difficult.
On your infrastructure
Culpa runs on your infrastructure. Your prompts and responses never leave it. Culpa counts calls to run your plan, and it fails open, so if it ever breaks your app keeps running.
How Culpa works
Find the culprit. Not just the total.
Your dashboard shows what you spent. It stops short of who spent it. Culpa shows the conversation, the user and the feature behind it.
Your prompts stay local.
Culpa runs on your own infrastructure. What you send to a model reaches us at no point.
Every dollar has a name.
Follow any charge to the conversation, the user, the feature and the customer behind it.
See the bill before it lands.
Cost your next feature before you ship it. You get the likely bill and the worst case, at best, median, p90 and p99.
Three steps to your first answer.
Change one base URL.
Or drop in the Python or TypeScript library.
Find your most expensive conversation.
In the first session, not the first week.
Cost your next feature before you ship it.
Why the bill went up
Example dashboardCalls traced
418,209
across 3 projects
Spend this week
$378.41
+ $182 vs last week
Failed calls
312
74% retried, and you paid for all of them
+ $182 this week traced to one culprit
Spend over 14 days
Most expensive users
Next week forecast
Graded against reality. Accuracy shown as results land.
Keep reading
Sources: OpenAI API pricing. Last reviewed 2026-08-01. Plain text version.