Pidoku

Unit Economics and Cost Strategy

Module 31 Lesson 31.e 55 min Difficulty 3/5

Prerequisites 23.c, 31.c, 31.d


Before you start: words you need#

WordPlain meaning
Unit economicsRevenue and cost for one unit of the business: one request, one task, one user per month.
Gross margin(Revenue − cost to serve) ÷ revenue. 60% means 40 cents of every dollar goes to serving.
Cost to serveWhat it costs to deliver the product to one user: here, mostly inference.
Reasoning tokensHidden tokens a reasoning model generates before its answer. Billed and computed like output tokens (Module 27).
Model routingSending each request to the cheapest model that can handle it (21.k).
Showback / chargebackShowing each team its share of the inference bill (showback), or actually billing their budget for it (chargeback).
Power userThe small share of users who generate a large share of the usage.
Jevons effectWhen something gets cheaper, people use more of it, sometimes so much more that total spend rises.

1. What is it?#

23.c turns a GPU-hour into a cost per million tokens. That number is necessary but not enough: nobody sells tokens to themselves. The business sells requests, tasks, seats or subscriptions. Unit economics carries the cost up the chain to the unit the business is paid for:

$ per GPU-hour (7.l, 31.d)
  → $ per million tokens (23.c)
    → $ per request          tokens per request × price per token
      → $ per task           requests per task, including retries and failed attempts
        → $ per user-month   tasks per user per month
          → gross margin     against what the user pays

Cost strategy is the principal’s plan for moving the numbers at each level, choosing the levers that move margin most per engineer-week (31.a).

Facts checked on 13 November 2026.


2. Why does it matter?#

  • Average users do not exist. Usage is heavily skewed: a few per cent of users often generate a large share of the tokens. A flat subscription that is profitable on average can lose money on every heavy user.
  • Tokens per task grew faster than price per token fell. Reasoning models and agents (Module 27) multiply the tokens behind one user action. A cheaper model per token can still mean a more expensive product.
  • The biggest levers are above the GPU. Which model answers, how long the prompt is, how much the model is allowed to think: these move cost by 5–20x. Kernel work moves it by percentages.
  • Margins decide what the company can build. A feature at a 30% margin cannot be given away to a free tier. Somebody must be able to say what each feature costs before it ships.

3. Simple analogy#

An all-you-can-eat restaurant. The price is set for an average diner. Most eat less than the price covers; a few eat far more. The restaurant stays profitable by choosing the menu (cheap dishes that fill people up), portion sizes, a time limit per table, and a separate price for the lobster. It does not stay profitable by negotiating a slightly cheaper price for flour.


4. Tiny example#

A coding assistant sold at $20 per user per month. Each request: 4,000 input tokens (60% cached), 600 answer tokens and 1,400 hidden reasoning tokens, on a model listed at $2 / $0.10 cached / $10 per million (Claude Sonnet 5.5, 23.c).

cost per request:  4,000 × 40% × $2  +  4,000 × 60% × $0.10  +  2,000 × $10   per million
                 = $0.0032 + $0.00024 + $0.02 = $0.0234

light user, 30 requests/month:      $0.70   → 96% margin
heavy user, 1,500 requests/month:   $35.16  → loses $15 a month

The reasoning tokens are 85% of the request’s cost, and the heavy user is unprofitable. Neither fact is visible in “$ per million tokens”.


5. Technical explanation#

Measure at every level#

LevelMetricWhere it comes from
GPU$ per useful GPU-hour7.l, contracts (31.d)
Tokens$ per M input, cached input, output23.c, per model
Requesttokens per request by type, cache hit rate, reasoning tokensrequest logs (23.h)
Taskrequests per task, retries, success rateproduct telemetry
Usertasks per user per month, by segmentproduct telemetry
Businessgross margin by plan and featurefinance

The principal’s job is to make the bottom of this table computable from the top: every request log carries the model, the token counts by kind, the tenant, the feature and the user’s plan. Without that, cost discussions are guesses.

Cost per successful task is often the most honest metric. An agent that needs three attempts to pass the tests costs three times what one attempt does; a cheaper model that fails twice as often may be more expensive per success.

The levers, roughly in order of size#

LeverTypical effectOwned in
Model choice and routing5–20x between model tiers21.k, 31.c
Tokens per task: prompt length, output length, reasoning effort2–5xModule 27
Prompt caching: stable prefixes firstinput cost down 5–10x on hits12.m, 21.h
Batch and off-peak: run what can wait at a batch discount~2x (batch APIs are commonly 50% off)Module 27
Utilization and placement1.5–2x23.c, 21.e
Hardware generation and precision1.5–3x31.d, 13.g
Procurement terms10–40%31.d
Kernels and engine tuning5–30% on the parts they touch31.f

The order matters. Teams instinctively start at the bottom, because that is where engineers are comfortable. The top rows need product decisions, which is why a principal must be in the room with product managers.

Pricing and limits are part of cost strategy#

  • Usage limits on flat plans (requests per period, fair-use caps) protect margin on power users.
  • Tiers price heavy use separately: a “max” plan, metered overage, or per-token billing for API customers.
  • Charge for what costs: long-context surcharges and KV-occupancy pricing (23.c), separate prices for fast modes (7.k), lower prices for batch.
  • Defaults are policy. A default reasoning effort of “high” for every request is a cost decision, usually made by accident.

Governance#

  • Showback first, chargeback later. Teams that see their bill change their behaviour; teams billed before they can see it fight the numbers.
  • Every feature launch has a cost estimate: tokens per task × tasks per user × users, with a margin target. Review it 30 days after launch.
  • Cost anomaly alerts: a prompt-template change that doubles input tokens should page someone within a day, not show up in next month’s invoice (23.h).
  • Budgets per team and per feature, with the right to trade them: one team’s saving funds another’s launch.

Jevons#

When a feature gets five times cheaper, product teams launch five new uses for it. Total spend can rise while unit cost falls. That is usually good (more value delivered) but must be planned: the efficiency gains belong in the demand forecast (31.d) as more usage, not only as fewer GPUs.


6. Under the hood: margin by segment#

The program carries the cost of one request to the gross margin of four user segments, then applies three levers: routing 60% of requests to a small model, capping reasoning effort on simple requests, and raising the cache hit rate. Prices are list prices from 23.c (checked 12–13 November 2026); the small model’s cached-input price, the usage segments and the request shape are assumptions.

Go
// unitecon.go — from $ per million tokens to gross margin per user segment.
package main

import "fmt"

type price struct{ in, cached, out float64 } // $ per million tokens

type request struct {
	in, out, reasoning float64 // tokens; reasoning tokens are billed as output
	cacheHit           float64 // share of input tokens served from the prefix cache
}

func (r request) cost(p price) float64 {
	return (r.in*(1-r.cacheHit)*p.in + r.in*r.cacheHit*p.cached + (r.out+r.reasoning)*p.out) / 1e6
}

type segment struct {
	name        string
	userShare   float64
	reqPerMonth float64
}

func main() {
	const subscription = 20.0        // $ per user per month
	big := price{2.00, 0.10, 10.00}  // Claude Sonnet 5.5 list (23.c)
	small := price{0.10, 0.01, 0.50} // Claude Haiku 5.5 list (23.c); cached input ASSUMED at 10%
	segs := []segment{{"light", 0.60, 30}, {"medium", 0.30, 300}, {"heavy", 0.09, 1500}, {"power", 0.01, 10000}}

	run := func(title string, r request, smallShare float64) {
		perReq := (1-smallShare)*r.cost(big) + smallShare*r.cost(small)
		fmt.Printf("%s: $%.4f per request\n", title, perReq)
		total := 0.0
		for _, s := range segs {
			c := s.reqPerMonth * perReq
			total += s.userShare * c
			fmt.Printf("  %-7s %5.0f%% of users  cost $%7.2f/user  margin %6.0f%%\n",
				s.name, s.userShare*100, c, (subscription-c)/subscription*100)
		}
		fmt.Printf("  average cost $%.2f/user → gross margin %.0f%%\n\n", total, (subscription-total)/subscription*100)
	}

	base := request{in: 4000, out: 600, reasoning: 1400, cacheHit: 0.60}
	run("today: every request on the big model", base, 0)

	better := base
	better.reasoning = 700 // reasoning-effort cap for simple requests (Module 27)
	better.cacheHit = 0.85 // stable system prompt first, history appended (12.m)
	run("after: 60% routed to the small model, reasoning capped, cache improved", better, 0.60)
}

Output:

today: every request on the big model: $0.0234 per request
  light      60% of users  cost $   0.70/user  margin     96%
  medium     30% of users  cost $   7.03/user  margin     65%
  heavy       9% of users  cost $  35.16/user  margin    -76%
  power       1% of users  cost $ 234.40/user  margin  -1072%
  average cost $8.04/user → gross margin 60%

after: 60% routed to the small model, reasoning capped, cache improved: $0.0063 per request
  light      60% of users  cost $   0.19/user  margin     99%
  medium     30% of users  cost $   1.88/user  margin     91%
  heavy       9% of users  cost $   9.39/user  margin     53%
  power       1% of users  cost $  62.62/user  margin   -213%
  average cost $2.15/user → gross margin 89%

How to read it:

  • 10% of users cost about 70% of the bill (heavy plus power: 0.09 × $35 + 0.01 × $234 = $5.50 of $8.04). Any cost plan that ignores them fails.
  • Three product-level levers cut cost per request by 73% with no change to hardware, kernels or contracts. Each still needs a quality gate: routing and reasoning caps must be checked on evals for the requests they touch (Module 28, 31.h).
  • Power users still lose money. No efficiency lever fixes a user who sends 10,000 requests a month on a $20 plan. That is a pricing decision: a higher tier, a usage limit or metered overage. The principal’s job is to show the numbers that make the decision obvious.
  • The same structure works for a self-hosted model: replace the list prices with your own input/cached/output costs from 23.c.

7. Performance implications#

  • Fewer tokens beat faster tokens. Halving reasoning tokens halves output cost and latency; a 20% faster kernel cuts cost by at most 20%. Ask “do we need these tokens?” before “can we make them faster?”.
  • Caching changes the cost structure. With 85% cache hits, input tokens become cheap and output dominates. That shifts optimization effort to decode (speculative decoding 13.n, FP4 13.g).
  • Routing adds latency and complexity. A classifier or cascade (21.k) costs milliseconds and failure modes; it pays only when the price gap between models is large, which in 2026 it usually is.

8. Production implications#

  • Log cost per request with model, token kinds, cache hits, tenant, feature and plan. Compute cost per task and per user daily (22.j, 23.h).
  • Put a cost line in every feature launch review: cost per task, expected tasks, margin target.
  • Alert on cost anomalies: per-feature tokens per request, cache hit rate, reasoning tokens per request. Prompt changes are the most common cause of sudden cost jumps.
  • Review power-user economics monthly with product and finance. Decide limits and tiers with data.
  • Plan for Jevons: put expected usage growth from cheaper features into the capacity forecast (31.d).

9. Common mistakes#

  1. Stopping at $ per million tokens. The business is paid per user, seat or task.
  2. Averaging across users. The tail of heavy users decides the margin.
  3. Ignoring reasoning tokens. They can be most of the cost of a request.
  4. Cost per request instead of cost per successful task. Retries and failures are real costs.
  5. Starting with kernels. The large levers are model choice, tokens per task and caching.
  6. Cutting cost without a quality gate. Routing and caps that hurt quality cost more in churn.
  7. Chargeback before showback. Teams fight numbers they cannot see.
  8. Assuming cheaper means less spend. Usage grows to meet the price.

10. Hands-on exercise#

  1. Run unitecon.go. What subscription price gives a 70% margin with today’s request shape?
  2. Add a usage limit: power users are capped at 3,000 requests a month. What is the margin now, and what share of power users’ requests does the cap block?
  3. Change base.reasoning to 5,000 (a high reasoning effort setting) and rerun. Which segment turns unprofitable first?
  4. Replace the list prices with a self-hosted cost from 23.c’s waterfall (about $1.35 per million output tokens after the fixes). Does self-hosting change the power-user problem?

11. Interview questions#

  1. Walk from the price of a GPU-hour to the gross margin of a $20-a-month plan.
  2. Why can a cheaper model per token make a product more expensive?
  3. 1% of users cost a third of your inference bill. What do you do?
  4. Rank the levers for cutting inference cost by size. Why do engineers often start at the bottom?
  5. How would you detect, within a day, a prompt change that doubled cost?
  6. What is the Jevons effect, and how does it change your capacity plan?

12. Further reading#

Checked on 13 November 2026.

  • FinOps Foundation: FinOps for AI — showback, chargeback and unit-cost practices applied to AI spend.
  • Claude API pricing — note the separate prices for cache writes, cache hits, batch and long prompts; each is a lever in section 5.
  • OpenAI API pricing
  • 23.c (cost per token and attribution), 21.k (cascades and routing), 21.f (quotas), 12.m (prefix caching), 27.a (the economics of reasoning tokens), 27.f (batch and offline inference).

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in