cd /news/developer-tools/llm-margin-lab · home topics developer-tools article
[ARTICLE · art-67092] src=github.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

LLM Margin Lab

LLM Margin Lab, an open-source interactive calculator for the unit economics of AI features, lets developers model token costs, retries, prompt caching, model routing, infrastructure, support, and target gross margin in a shareable scenario that runs locally without an API key. The tool, requiring Node.js 20.9 or newer, calculates revenue and contribution profit per active user, maximum requests per user at a target margin, and margin sensitivity as usage grows, with all assumptions encoded in a URL for sharing.

read1 min views1 publishedJul 21, 2026
LLM Margin Lab
Image: source

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

── more in #developer-tools 4 stories · sorted by recency
── more on @llm margin lab 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/llm-margin-lab] indexed:0 read:1min 2026-07-21 ·