An interactive calculator for the unit economics of AI features.
Most AI products can quote token prices. Fewer can answer the question that matters: how much usage can each customer consume before the business model breaks?
LLM Margin Lab combines pricing, tokens, retries, prompt caching, model routing, infrastructure, support, and target gross margin in one shareable scenario. It runs locally and does not require an API key.
- Revenue and contribution profit per active user
- Input and output token costs
- Retry amplification
- Prompt cache hit rate and cache discounts
- Routing a percentage of work to a cheaper model
- Infrastructure and support costs
- Maximum requests per user at a target margin
- Margin sensitivity as usage grows
The included presets are illustrative. Replace them with current model prices and the operating costs of your own stack.
Requires Node.js 20.9 or newer.
npm install
npm run dev
Open http://localhost:3000.
Use Copy scenario to put every assumption in the URL. The recipient can edit the scenario without an account or backend. No prompt text, customer data, or proprietary model configuration is included unless you type it into a numeric field, which the app does not provide.
The calculator works without analytics. If you set TELEMETRY_API_KEY
, copied scenario links emit one aggregate event through the server route using Telemetry. The event contains only the selected preset plus broad margin and spend bands; it does not contain prices, token counts, URLs, IP addresses, or scenario values.
cp .env.example .env.local
npm run typecheck
npm test
npm run build
MIT