Calculating API Cost Per User
Learn how to calculate the per-user API cost for your application. Essential for SaaS pricing, capacity planning, and understanding your unit economics.
Detailed Explanation
Calculating API Cost Per User
Understanding your per-user API cost is crucial for SaaS pricing, capacity planning, and profitability analysis.
Basic Formula
Cost per user = Total API costs / Number of active users
Detailed Breakdown
To get an accurate per-user cost, you need to account for the fact that not all users are equal:
Cost per user = Sum of (API_calls_per_action x cost_per_call x actions_per_user_per_month)
Example: Project Management SaaS
| Action | API Calls | Cost/Call | Frequency/User/Month | Monthly Cost |
|---|---|---|---|---|
| Page view | 2 | $0.000004 | 500 | $0.004 |
| AI summary | 1 | $0.02 | 20 | $0.40 |
| Email notify | 1 | $0.00065 | 100 | $0.065 |
| File upload | 3 | $0.0001 | 30 | $0.009 |
| Search | 1 | $0.001 | 200 | $0.20 |
| Total | $0.678 |
User Segmentation
Different user segments have vastly different API costs:
| Segment | % of Users | Avg API Cost | Weighted Cost |
|---|---|---|---|
| Light (free) | 60% | $0.20 | $0.12 |
| Medium (basic) | 30% | $0.80 | $0.24 |
| Heavy (pro) | 9% | $3.00 | $0.27 |
| Power (enterprise) | 1% | $15.00 | $0.15 |
| Blended average | $0.78 |
Pricing Implications
If your blended per-user API cost is $0.78/month and you want a 70% gross margin:
Minimum price = $0.78 / (1 - 0.70) = $2.60/month
This means your cheapest paid plan should be at least $2.60/month just to cover API costs (before infrastructure, labor, and other expenses).
Use Case
You are pricing a new SaaS product that uses OpenAI for text generation, Twilio for SMS, and AWS for infrastructure. You need to calculate the true per-user cost to ensure your $9.99/month pricing covers all API expenses with a healthy margin.