Skip to content

Unit economics

LLM API cost per task

This template applies a dated provider price book to input, cached and output tokens to calculate cost per task, feature and customer.

The Dashboard and Scenarios sheets compare cost and margin across seat, hybrid, credit, usage and outcome pricing.

Reads from

  • PostHog
  • Stripe
  • OpenAI usage CSV
  • Anthropic usage CSV

Sheets

Dashboard
Summarizes token cost, customer cost and gross margin across pricing scenarios.
Price Book
Stores the dated per-million-token rates used by the formulas.
LLM Usage
Keeps usage by customer and feature with calculated token cost.
Features
Calculates task cost from model calls, tokens, retries and fixed costs.
Customers
Calculates each customer's revenue, COGS and margin under the workbook's pricing models.
Plans
Lists seat prices and summarizes actual revenue, COGS and gross margin by plan.
Scenarios
Compares revenue, COGS, gross margin and underwater-customer share across five pricing models.
Break-even
Calculates task volume at the target margin for each feature.
Forecast
Projects task cost and gross margin by month from price-decline and token-growth assumptions.
Assumptions
Stores pricing, margin, token, forecast and reconciliation drivers with their units and sources.
Checks
Tests usage-cost reconciliation, scenario COGS, uncached inputs, credits and fraction assumptions.
Sources
Records price-book sources and the fictional recipe data used for customer and usage estimates.

Formulas

Features!R2

=Q2*C2*(1+J2)+K2*L2+M2

Combines model calls, retries and other costs into task cost.

Customers!F2

=SUMIFS('LLM Usage'!$N$2:$N$49,'LLM Usage'!$A$2:$A$49,"="&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"~","~~"),"*","~*"),"?","~?"))+C2*E2

Adds usage cost and fixed per-seat cost for a customer.

Dashboard!B4

=IF(B2=0,"",(B2-B3)/B2)

Calculates gross margin from revenue and cost of goods sold.

Questions

What usage data can this template read?

It can use PostHog events or usage exports from OpenAI, Anthropic, OpenRouter, Helicone or LiteLLM, plus Stripe invoice lines for revenue.

How are token costs priced?

The LLM Usage formulas match each model to the dated rates in the Price Book and apply separate input, cached and output-token prices.

Which pricing models can I compare?

The workbook compares seat, hybrid, credit, usage and outcome pricing and shows the resulting gross margin.