Twilio uses credits. OpenAI uses tokens. AWS, Azure, and GCP all have their own credit systems. Even AI coding assistants have moved toward compute-based pricing models.
Credit-based pricing is taking over the API world. But while the concept seems simple—"assign points to operations, charge for points"—the math behind setting credit values is surprisingly complex.
Get it right, and you have a pricing model that scales elegantly across use cases. Get it wrong, and you create arbitrage opportunities that sophisticated users will exploit mercilessly.
Let's dive into the hidden math.
Why Credits Exist
The fundamental problem with per-request pricing: not all requests are equal.
Charging the same price for these makes no sense. Request C costs you 100,000x more than Request A to serve.
Credits solve this by abstracting away the monetary value and introducing a proxy unit that can be weighted per operation:
Now pricing scales appropriately with actual resource consumption.
The Credit Valuation Framework
Setting credit values requires balancing three factors:
1. Infrastructure Cost
What does each operation actually cost you?
For most APIs, compute dominates. But for data-heavy APIs, bandwidth or storage might be the primary cost driver.
2. Value Delivered
What is the operation worth to the customer?
This is harder to quantify, but consider:
- Does this operation save the customer time?
- Does it enable revenue they couldn't capture otherwise?
- What's the alternative cost (building it themselves)?
A fraud detection API call that prevents a $1,000 chargeback is worth more than a simple data lookup, even if they cost the same to serve.
3. Competitive Positioning
What do alternatives charge for equivalent operations?
If competitors charge 10 credits for a similar operation and you charge 100, you need a very good reason—or you'll lose price-sensitive customers.
The Math: Building a Credit Table
Let's walk through building a credit table for a hypothetical image processing API.
Step 1: Measure Actual Costs
Profile your operations:
| Operation | Avg CPU (ms) | Avg Memory (MB) | Avg Bandwidth (KB) | Total Cost |
|---|---|---|---|---|
| Image upload | 50 | 100 | 500 | $0.0002 |
| Basic resize | 200 | 256 | 200 | $0.0008 |
| AI analysis | 2000 | 1024 | 50 | $0.0150 |
| Background removal | 5000 | 2048 | 300 | $0.0400 |
| Video processing | 60000 | 4096 | 5000 | $0.5000 |
Step 2: Normalize to a Base Unit
Pick your cheapest common operation as the base unit (1 credit):
Now express all operations as multiples:
| Operation | Cost Ratio | Raw Credits |
|---|---|---|
| Image upload | 1x | 1 |
| Basic resize | 4x | 4 |
| AI analysis | 75x | 75 |
| Background removal | 200x | 200 |
| Video processing | 2500x | 2500 |
Step 3: Apply Value Multipliers
Some operations deliver disproportionate value. Adjust accordingly:
Value multipliers come from understanding customer willingness to pay. If customers happily pay premium prices for AI features, your multiplier can be higher.
Step 4: Round to Human-Friendly Numbers
Nobody wants to see "113 credits." Round to memorable numbers:
| Operation | Final Credits |
|---|---|
| Image upload | 1 |
| Basic resize | 5 |
| AI analysis | 100 |
| Background removal | 250 |
| Video processing | 2500 |
Step 5: Set the Credit Price
Work backward from your target margin:
Pro tip:
Round credit prices to easy numbers customers can calculate in their heads. "$1 per 1,000" is better than "$0.87 per 1,000" because customers can instantly estimate costs.
The Arbitrage Problem
Here's where credit systems get tricky: sophisticated users will find the best deals.
If your credit values don't accurately reflect costs, users will cluster on the underpriced operations:
Savvy users will use Operation B heavily, and you'll lose money on every request.
Detection
Monitor credit consumption vs. actual cost:
Correction
When you find underpriced operations:
- Gradual increase: Raise credit costs slowly (10-20% per month)
- Communicate clearly: Tell customers why costs are changing
- Grandfather existing: Consider maintaining old prices for existing heavy users temporarily
Dynamic Credit Pricing
Advanced credit systems adjust pricing based on conditions:
Time-Based Pricing
This smooths demand by incentivizing off-peak usage.
Load-Based Pricing
This protects infrastructure during spikes (but requires clear communication to users).
Commitment Discounts
Credit Bundles and Plans
Most credit systems include bundled credits in subscription plans:
The Bundle Math
How many credits should each tier include?
Method 1: Cost Multiple
Set included credits at a multiple of the plan price:
Method 2: Use Case Anchor
Define typical use cases and set credits to cover them:
Method 3: Competitive Parity
Match competitor offerings:
Common mistake:
The most common mistake: including too few credits in plans, causing customers to hit limits immediately. This creates billing surprise and churn. Better to include generous credits and capture expansion revenue from power users.
Communicating Credits to Users
Credits add cognitive overhead. Clear communication reduces confusion.
In Documentation
In the Dashboard
In API Responses
Advanced: Machine Learning for Credit Optimization
Leading API companies use ML to optimize credit values:
This requires:
- Historical cost data per operation
- Usage patterns by customer segment
- Price elasticity estimates (how volume changes with price)
When Credits Go Wrong
Case Study: The Startup That Lost Money
A startup set credit values based purely on operation type, ignoring actual infrastructure costs. Their "AI enhancement" operation cost them $0.08 to serve but was priced at 10 credits ($0.01).
Power users discovered this and hammered the endpoint. The startup's monthly AWS bill quintupled while revenue stayed flat.
Lesson: Always start with actual cost measurement, not arbitrary assignments.
Case Study: The Complexity Spiral
Another company had 47 different credit tiers for variations of similar operations. Users couldn't understand what anything cost. Support tickets about billing were 40% of their volume.
They simplified to 5 tiers. Support tickets dropped 60%, and conversion improved because users could actually understand pricing.
Lesson: Simplicity has value. Round aggressively and accept some margin variance.
The Simplicity-Accuracy Tradeoff
Here's the fundamental tension in credit design:
The art is finding the middle ground: enough granularity to protect margins, enough simplicity for users to understand.
Most successful credit systems have 5-15 distinct credit levels, with values that are easy multiples of each other (1, 5, 10, 50, 100, 500, 1000).
Conclusion
Credit-based pricing is powerful because it decouples the monetary unit from the consumption unit. This gives you flexibility to:
- Adjust pricing without changing credit values
- Offer bundles and commitments
- Handle wildly different operation costs gracefully
- Communicate consumption in user-friendly terms
But it requires careful math to avoid:
- Arbitrage from underpriced operations
- Confusion from overly complex credit tables
- Margin erosion from inaccurate cost modeling
The companies that win at credit pricing invest in:
- Accurate cost measurement per operation
- Regular review and adjustment of credit values
- Clear communication of what credits mean
- Dashboards that make consumption visible
Do the math. Monitor the margins. Keep it simple enough to explain.
Credits are powerful. Use them wisely.