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

Model spend$800.00
Serving customers (80%)$640.00
Scaling infrastructure$60.00
Cost of goods sold$700.00

Revenue$1,000.00
Gross profit$300.00
Gross margin30.00%

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.

Run the free Cost Leak ScanStart 14-day trial

Mistakes that cost the most

MistakeWhy it hurtsDo 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

  1. Sum every billed token attributable to customer-serving traffic last month, retries included.
  2. Subtract anything tagged as evaluation, development or background work.
  3. Divide by paying customers. That's your COGS per customer, and it will exceed your estimate.
  4. Express COGS as a percentage of revenue. That single number is your gross margin.
  5. 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.

Naive COGS, successful customer calls only = $700
Add retries and discarded responses on customer traffic, +$180 = $880
Subtract eval and background runs wrongly included, -$140 = $740 of true customer COGS
The two errors partly cancelled, hiding a $320 gross misattribution
At $4,000 revenue: naive margin 82.5%, true margin 81.5%, but the composition is completely different

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

FigureWhat it meansConfidenceSource
$700 to $880modelled customer COGS range, naive count versus corrected, against a $1,000 monthestimatedModelled 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 $320modelled misattribution range hidden by two offsetting errors, one leg alone versus bothestimatedThe $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.

1

Change one base URL.

Or drop in the Python or TypeScript library.

2

Find your most expensive conversation.

In the first session, not the first week.

3

Cost your next feature before you ship it.

Base URLhttp://localhost:4545/v1Your traffic keeps flowing if Culpa ever stops.

Why the bill went up

Example dashboard

Calls 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

$0$20$40$60$8024262830020406
user_384report_generatorconv_91fprompt_v1894,220 tokens3 retries$6.81

Most expensive users

user_384$38.42
user_119$21.07
user_562$14.90
user_204$8.30
user_871$5.10

Next week forecast

Best$180
Median$240
p90$310
p99$395

Graded against reality. Accuracy shown as results land.

Keep reading


Sources: OpenAI API pricing. Last reviewed 2026-08-01. Plain text version.