AI Startup Unit Economics: Calculate Margin After Inference Costs

Calculate real per-request model costs, expose hidden margin leaks, and choose pricing or routing changes with confidence.

Calculate margin after inference by subtracting per-request model costs from realized revenue, then dividing the remainder by realized revenue. This percentage shows how much revenue remains after serving the model request, but before payment fees and other operating costs. Use actual token usage and collected revenue, not list prices or visible answer length. For subscriptions, allocate each customer's realized monthly revenue across that customer's requests before calculating the margin.

Table of Contents

Calculate inference cost per request

For an API-based product, calculate inference cost of goods sold, or COGS, with this formula: Inference COGS = (uncached input tokens × input rate) + (cached input tokens × cache rate) + (output tokens × output rate) Convert every published per-million-token rate into a per-token rate before multiplying. OpenAI lists GPT‑5 at $1.25 per million input tokens, $0.125 per million cached-input tokens, and $10 per million output tokens.

That makes each output token eight times as expensive as an uncached input token, according to OpenAI's GPT‑5 model reference. Keep cached and uncached input separate. Treating all input as cached will understate costs, while treating all input as uncached will hide genuine savings.

Turn model cost into margin

The core formula is: Margin after inference = (realized revenue − inference COGS) ÷ realized revenue Suppose one request uses 2,000 uncached GPT‑5 input tokens and 1,000 output tokens. Its inference COGS is: If realized revenue is $0.05 for that request, the margin after inference is 75%: ($0.05 − $0.0125) ÷ $0.05.

For a subscription, do not assume every request earns the same amount unless that simplification suits the decision. First subtract refunds or discounts from collected revenue, then divide by completed requests or another meaningful unit.

  • Input: 2,000 ÷ 1,000,000 × $1.25 = $0.0025
  • Output: 1,000 ÷ 1,000,000 × $10 = $0.0100
  • Total inference COGS: $0.0125

Measure usage rather than visible output

Displayed words do not reliably represent billable usage. OpenAI says hidden reasoning tokens count toward output usage and are billed as output tokens, so reasoning-heavy requests can cost more than the visible response suggests, as explained by the OpenAI Help Center's token-usage guidance.

Record the usage fields returned with each request. At minimum, store: Include successful retries and regenerations in COGS even when the customer pays only once. Otherwise, the calculation describes an ideal request rather than the product's actual economics.

  • Model and request type
  • Cached and uncached input tokens
  • Output usage, including billed reasoning usage
  • Customer, workspace, or pricing tier
  • Realized revenue assigned to the unit

Improve margin with routing and batching

Model routing can materially reduce cost when a smaller model meets the task's quality requirements. OpenAI prices GPT‑5 mini at $0.25 per million input tokens and $2 per million output tokens, while GPT‑5 nano costs $0.05 and $0.40 respectively. Route predictable, lower-complexity work to the least expensive model that passes a defined quality threshold.

Keep escalation paths for requests where errors would erase the savings through refunds, support work, or repeated generations. Batching offers another lever for work that does not need an immediate response. The OpenAI Help Center says its Batch API provides a 50% discount from synchronous prices and processes submitted work within 24 hours. That tradeoff fits offline classification, enrichment, or report preparation better than interactive features.

Add costs that token math misses

Margin after inference is narrower than gross margin. Payment processing, hosting, storage, retrieval, third-party APIs, support, and refunds can all reduce what remains. Payment fees matter especially on low-priced transactions. Stripe's standard U.S.

domestic online-card rate is 2.9% plus $0.30 per successful transaction, so a $20 subscription leaves $19.12 before inference and other costs, according to Stripe's pricing page. Self-hosted or committed capacity also requires a different calculation. Allocate hourly or timed hosting charges across completed requests using actual utilization. AWS notes that Bedrock Provisioned Throughput continues billing until deletion, while custom-model hosting can begin charging after the first successful inference in five-minute windows. At low traffic, divide those incurred capacity charges by the small number of completed requests rather than substituting an estimated token price.


You Might Also Like