Skip to main content
aibizhub
Structured methodology As of 2026-04-24

How AI Product Margin Calculator works

What the tool assumes, what data it pulls from, and what it cannot tell you.

Education · General business information, not legal, tax, or financial advice. Editorial standards Sponsor disclosure Corrections

1. Scope

Calculates per-user contribution margin for an AI-powered product by netting subscription revenue against token costs, hosting, and other per-user expenses. It does not model enterprise negotiated rates or prompt-caching discounts.

2. Inputs and outputs

Inputs

  • subscriptionPrice number (currency/mo)
  • avgInputTokensPerUser number (tokens/mo)
  • avgOutputTokensPerUser number (tokens/mo)
  • modelInputCostPerMillion number (currency)

    List price per 1M input tokens.

  • modelOutputCostPerMillion number (currency)

    List price per 1M output tokens.

  • hostingPerUser number (currency/mo) default: 0
  • otherPerUser number (currency/mo) default: 0

Outputs

  • aiCostPerUser

    Blended input/output token cost at the user's usage profile.

  • totalCostPerUser

    aiCostPerUser + hostingPerUser + otherPerUser.

  • grossMargin

    (subscriptionPrice − totalCostPerUser) / subscriptionPrice.

Engine source: src/lib/ai-product-margin-calculator/engine.ts

3. Formula / scoring logic

ai_cost_per_user = (input_tokens * input_cost_per_m + output_tokens * output_cost_per_m) / 1_000_000
total_cost       = ai_cost_per_user + hosting_per_user + other_per_user
gross_margin     = (subscription_price - total_cost) / subscription_price

4. Assumptions

  • Users are priced uniformly. Tiered or usage-metered pricing requires running the tool once per tier.
  • Token costs are list prices; negotiated commitments or prompt-caching discounts are applied manually on top.
  • Hosting-per-user is amortised from a fixed plan (e.g. a $20 Vercel Pro plan at 1,000 users = $0.02/user).

5. Data sources

6. Known limitations

  • Prompt caching and context-window reuse can cut effective cost by 30–80%. The tool does not infer this — users must reduce the avgInputTokens figure to reflect it.
  • Does not model failure-mode costs: retries, long-running tool calls, or regenerations inflate token counts in production.
  • Pricing is a snapshot; if the as-of date is stale, consult the live vendor page before making a pricing decision.

7. Reproducibility

Input
price = $29/mo, input = 400K tokens, output = 100K tokens, Claude Sonnet list, hosting = $0.02, other = $0.

Expected output
ai_cost ≈ $2.70, total_cost ≈ $2.72, gross_margin ≈ 90.6% (as of 2026-04-24 list pricing).

8. Change log

  • 2026-04-24 methodology page first published. Pricing snapshot 2026-04-24.

Worked example

Run live against the same engine this site ships (/engines/ai-product-margin-calculator.js). The inputs and outputs below are recomputed on every build and independently re-verified in CI — they are never hand-authored.

Input

tool
ai_product_margin_calculator
subscription_price
29
avg_api_calls_per_day
20
avg_input_tokens
500
avg_output_tokens
1000
input_cost_per_million
2.5
output_cost_per_million
10
hosting_cost_per_user
0.5
other_per_user_costs
0.25

Output

apiCostPerUser
6.75
totalCostPerUser
7.5
grossMarginPerUser
21.5
grossMarginPercent
74.1
apiSharePercent
90
dominantCostDriver
AI API
scaleTiers[0].users
100
scaleTiers[0].totalRevenue
2900
scaleTiers[0].totalCost
750
scaleTiers[0].totalProfit
2150
scaleTiers[0].marginPercent
74.1
scaleTiers[1].users
1000
scaleTiers[1].totalRevenue
29000
scaleTiers[1].totalCost
7500
scaleTiers[1].totalProfit
21500
scaleTiers[1].marginPercent
74.1
scaleTiers[2].users
10000
scaleTiers[2].totalRevenue
290000
scaleTiers[2].totalCost
75000
scaleTiers[2].totalProfit
215000
scaleTiers[2].marginPercent
74.1
insight
AI API is 90% of your per-user cost ($6.75/mo). At 10K users, that is $67500/month on API alone. Caching responses or using a tiered model approach could significantly improve margins.

Frequently asked questions

What does the AI Product Margin Calculator calculate?
Calculates per-user contribution margin for an AI-powered product by netting subscription revenue against token costs, hosting, and other per-user expenses. It does not model enterprise negotiated rates or prompt-caching discounts.
What inputs does the AI Product Margin Calculator need?
It takes 7 inputs: subscriptionPrice, avgInputTokensPerUser, avgOutputTokensPerUser, modelInputCostPerMillion, modelOutputCostPerMillion, hostingPerUser (default 0), otherPerUser (default 0). Outputs returned: aiCostPerUser, totalCostPerUser, grossMargin.
What formula does the AI Product Margin Calculator use?
The exact computation is: ai_cost_per_user = (input_tokens * input_cost_per_m + output_tokens * output_cost_per_m) / 1_000_000; total_cost = ai_cost_per_user + hosting_per_user + other_per_user; gross_margin = (subscription_price - total_cost) / subscription_price
Can I verify the AI Product Margin Calculator with a worked example?
Yes. With price = $29/mo, input = 400K tokens, output = 100K tokens, Claude Sonnet list, hosting = $0.02, other = $0. the tool returns ai_cost ≈ $2.70, total_cost ≈ $2.72, gross_margin ≈ 90.6% (as of 2026-04-24 list pricing).
Where does the AI Product Margin Calculator get its benchmark data?
Reference data is sourced from: Anthropic pricing (as of 2026-04-24); OpenAI pricing (as of 2026-04-24); Google Gemini pricing (as of 2026-04-24).
What can the AI Product Margin Calculator not tell me?
Known limitations: Prompt caching and context-window reuse can cut effective cost by 30–80%. The tool does not infer this — users must reduce the avgInputTokens figure to reflect it. Does not model failure-mode costs: retries, long-running tool calls, or regenerations inflate token counts in production. Pricing is a snapshot; if the as-of date is stale, consult the live vendor page before making a pricing decision.
Business planning estimates — not legal, tax, or accounting advice.