{"slug": "llm-margin-lab", "title": "LLM Margin Lab", "summary": "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.", "body_md": "An interactive calculator for the unit economics of AI features.\n\nMost AI products can quote token prices. Fewer can answer the question that\nmatters: **how much usage can each customer consume before the business model\nbreaks?**\n\nLLM 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.\n\n- Revenue and contribution profit per active user\n- Input and output token costs\n- Retry amplification\n- Prompt cache hit rate and cache discounts\n- Routing a percentage of work to a cheaper model\n- Infrastructure and support costs\n- Maximum requests per user at a target margin\n- Margin sensitivity as usage grows\n\nThe included presets are illustrative. Replace them with current model prices and the operating costs of your own stack.\n\nRequires Node.js 20.9 or newer.\n\n```\nnpm install\nnpm run dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000).\n\nUse **Copy scenario** to put every assumption in the URL. The recipient can\nedit the scenario without an account or backend. No prompt text, customer\ndata, or proprietary model configuration is included unless you type it into\na numeric field, which the app does not provide.\n\nThe calculator works without analytics. If you set `TELEMETRY_API_KEY`\n\n, copied\nscenario links emit one aggregate event through the server route using\n[Telemetry](https://telemetry.sh/?utm_source=github&utm_medium=referral&utm_campaign=llm-margin-lab&utm_content=readme).\nThe event contains only the selected preset plus broad margin and spend bands;\nit does not contain prices, token counts, URLs, IP addresses, or scenario\nvalues.\n\n```\ncp .env.example .env.local\n# Add your Telemetry API key, then restart the dev server.\nnpm run typecheck\nnpm test\nnpm run build\n```\n\nMIT", "url": "https://wpnews.pro/news/llm-margin-lab", "canonical_source": "https://github.com/telemetry-sh/llm-margin-lab", "published_at": "2026-07-21 14:29:22+00:00", "updated_at": "2026-07-21 14:43:03.252321+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "artificial-intelligence"], "entities": ["LLM Margin Lab", "Node.js", "Telemetry"], "alternates": {"html": "https://wpnews.pro/news/llm-margin-lab", "markdown": "https://wpnews.pro/news/llm-margin-lab.md", "text": "https://wpnews.pro/news/llm-margin-lab.txt", "jsonld": "https://wpnews.pro/news/llm-margin-lab.jsonld"}}