GitHub - telemetry-sh/llm-margin-lab: An interactive calculator for AI product unit economics: tokens, caching, routing, retries, and gross margin. · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading. Please reload this page.
telemetry-sh
llm-margin-lab
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>2 Commits<br>2 Commits
.github/workflows
.github/workflows
app
app
components
components
docs
docs
lib
lib
test
test
.env.example
.env.example
.gitignore
.gitignore
LICENSE
LICENSE
README.md
README.md
next-env.d.ts
next-env.d.ts
next.config.ts
next.config.ts
package-lock.json
package-lock.json
package.json
package.json
tsconfig.json
tsconfig.json
View all files
Repository files navigation
LLM Margin Lab
An interactive calculator for the unit economics of AI features.
Most AI products can quote token prices. Fewer can answer the question that<br>matters: how much usage can each customer consume before the business model<br>breaks?
LLM Margin Lab combines pricing, tokens, retries, prompt caching, model<br>routing, infrastructure, support, and target gross margin in one shareable<br>scenario. It runs locally and does not require an API key.
What you can model
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<br>and the operating costs of your own stack.
Run locally
Requires Node.js 20.9 or newer.
npm install<br>npm run dev
Open http://localhost:3000.
Share a scenario
Use Copy scenario to put every assumption in the URL. The recipient can<br>edit the scenario without an account or backend. No prompt text, customer<br>data, or proprietary model configuration is included unless you type it into<br>a numeric field, which the app does not provide.
Optional aggregate telemetry
The calculator works without analytics. If you set TELEMETRY_API_KEY, copied<br>scenario links emit one aggregate event through the server route using<br>Telemetry.<br>The event contains only the selected preset plus broad margin and spend bands;<br>it does not contain prices, token counts, URLs, IP addresses, or scenario<br>values.
cp .env.example .env.local<br># Add your Telemetry API key, then restart the dev server.
Verify
npm run typecheck<br>npm test<br>npm run build
License
MIT
About
An interactive calculator for AI product unit economics: tokens, caching, routing, retries, and gross margin.
Topics
react
calculator
typescript
ai
nextjs
saas
unit-economics
llm
prompt-caching
model-routing
Resources
Readme
License
MIT license
Uh oh!
There was an error while loading. Please reload this page.
Activity
Custom properties
Stars
stars
Watchers
watching
Forks
forks
Report repository
Releases
No releases published
Packages
Uh oh!
There was an error while loading. Please reload this page.
Contributors
Uh oh!
There was an error while loading. Please reload this page.
Languages
TypeScript<br>70.6%
CSS<br>29.4%
You can’t perform that action at this time.