A Per-Feature Gross Margin Tracking System for AI Products
Aggregate gross margin hides which AI features are profitable and which are destroying it. This guide covers how to build a per-feature gross margin tracking system that reveals the cost structure of each AI capability in your product and informs pricing tier design.
Most AI product teams know their aggregate gross margin. Few know the gross margin of each feature within their product. This gap creates pricing decisions made by intuition rather than economics, optimization investments made by engineering preference rather than ROI, and tier structures designed by what feels right rather than what covers costs.
Per-feature gross margin tracking is the diagnostic system that changes this. When every feature's inference cost is measured and compared to its revenue contribution, the economics of individual product capabilities become visible — and so do the decisions that follow from those economics.
The Problem: Why Aggregate Gross Margin Misleads
Consider an AI product with four features used by the same customer base:
| Feature | Monthly Usage per Customer | Cost per Use | Monthly Cost | Revenue Share |
|---|---|---|---|---|
| Document Summary | 50 uses | $0.15 | $7.50 | 40% |
| Q&A on Documents | 200 uses | $0.04 | $8.00 | 30% |
| Keyword Extraction | 500 uses | $0.003 | $1.50 | 15% |
| Smart Formatting | 100 uses | $0.001 | $0.10 | 15% |
With a $100/month price point, revenue allocation by usage share is:
- Document Summary: $40 revenue, $7.50 cost → 81% feature gross margin
- Q&A: $30 revenue, $8.00 cost → 73% feature gross margin
- Keyword Extraction: $15 revenue, $1.50 cost → 90% feature gross margin
- Smart Formatting: $15 revenue, $0.10 cost → 99% feature gross margin
Aggregate gross margin: $100 revenue, $17.10 cost → 83% gross margin. A healthy number that suggests no action is required.
Now add a fifth feature: Advanced AI Analysis that customers use 20 times per month at $0.90 per use ($18 cost) with 15% of perceived value (justifying 15% of revenue or $15 in the flat price).
New aggregate gross margin: $100 revenue, $35.10 cost → 65% gross margin. Still apparently acceptable.
But the Advanced AI Analysis feature is losing $3 per customer per month on its own. As this feature's usage grows — because it is the most powerful feature in the product and customers find more uses for it — the aggregate gross margin continues deteriorating. Customers with higher-than-average Advanced Analysis usage are unprofitable at $100/month, but the aggregate does not reveal this.
Building the Feature Attribution System
Step 1: Feature Taxonomy
Define the feature taxonomy before building attribution. Every distinct AI capability in the product should have a feature ID — a short, stable identifier that can be used as a tag in infrastructure code without changing frequently.
Feature IDs should map to user-facing feature names but may be more granular. A user-facing "Smart Research" feature might internally consist of three sub-features: "web search," "content extraction," and "synthesis" — each with different inference cost profiles. Granular tagging enables more precise attribution than high-level feature names.
Step 2: Instrument the Inference Layer
Add feature ID tags to every inference call at the call site:
def call_model_with_feature_tag(
prompt: str,
customer_id: str,
feature_id: str,
model: str = "default",
) -> ModelResponse:
# Log before the call to ensure attribution even if call fails
call_id = uuid.uuid4()
log_inference_start(call_id, customer_id, feature_id, model, prompt)
response = model_provider.complete(prompt, model=model)
log_inference_complete(
call_id,
input_tokens=response.usage.input_tokens,
output_tokens=response.usage.output_tokens,
cost=calculate_cost(model, response.usage),
)
return responseThe logging layer creates a cost ledger with a row per inference call, each carrying customer ID, feature ID, token counts, and cost.
Step 3: Build the Cost Attribution Table
Join the inference cost ledger to the customer revenue data on a monthly basis:
SELECT
feature_id,
SUM(cost_usd) as total_cost,
COUNT(*) as total_calls,
AVG(cost_usd) as avg_cost_per_call
FROM inference_cost_ledger
WHERE month = '2026-06'
GROUP BY feature_id;Then join to revenue allocation data (calculated from usage weights or pricing research) to compute feature-level gross margin:
Feature Gross Margin = (Feature Revenue Contribution - Feature Direct Cost) / Feature Revenue Contribution
Step 4: Visualize the Margin Stack
Sort features by gross margin contribution (from highest to lowest) and visualize as a stacked bar — positive margins above the axis, negative margins below. The margin stack immediately shows:
- Which features are profitable and by how much
- Which features are unprofitable and by how much
- Whether the total positive margin exceeds the total negative margin
The margin stack is the core deliverable of feature gross margin tracking and should be reviewed monthly.
The Decision Framework: What to Do With Feature Margin Data
Decision 1: Gate Negative-Margin Features at Higher Tiers
The most direct corrective action for a negative-margin feature: move it to a higher pricing tier where the price point can support its cost.
Advanced AI Analysis at $0.90/use with 20 uses/month costs $18/month per customer. A tier at $150/month that includes this feature at its current usage level prices it correctly. An alternative is including a fixed allocation (e.g., 10 uses/month) in the $100 tier with per-use overage charging thereafter.
Decision 2: Optimize High-Cost, High-Value Features
For features that are both high-value (high usage, high revenue attribution) and high-cost, optimization investment has clear ROI. The ROI calculation:
Optimization ROI = (Current Cost - Post-Optimization Cost) × Monthly Calls × 12 months
÷ Engineering Investment in Optimization
A feature with $8/month/customer cost that can be reduced to $5/month/customer through prompt optimization — at 1,000 customers — saves $36,000/year. If the optimization requires two weeks of engineering (approximately $15,000 in loaded cost), the ROI is 2.4× in year one.
Decision 3: Price-Signal Underpriced High-Margin Features
Features with very high gross margins (90%+) may be underpriced relative to their value. If customers use a feature extensively and value it highly, the current pricing may not capture the value being delivered.
High-margin features that are strategically important (driving retention, enabling expansion) are candidates for premium tier inclusion or feature-based upgrade prompts. For example, if Keyword Extraction has 90% feature gross margin and is used heavily by customers who upgrade to higher plans, it is a strong expansion vector — surfacing its value in upgrade conversations has positive margin impact.
Decision 4: Remove Structurally Unprofitable Features from Lower Tiers
If a feature has negative gross margin at a given tier and optimization cannot make it margin-positive, it should be removed from that tier. This is a hard decision that requires customer communication, but it is preferable to a feature that silently erodes margins as usage scales.
The communication framework for removing a feature from a lower tier: announce the change 60–90 days in advance, offer an upgrade path to a tier where the feature is included, and provide a transition incentive (discounted upgrade pricing for the first year).
Benchmark: Feature Gross Margin Targets
Based on unit economics benchmarks from KeyBanc Capital Markets' SaaS survey and SaaS Capital's AI product benchmarks:
| Feature Category | Target Feature Gross Margin | Action Threshold |
|---|---|---|
| Core features (define the product) | 55–75% | <40% → optimize or reprice |
| Value-add features (drive expansion) | 70–85% | <55% → reprice or gate |
| Premium features (high value, high cost) | 45–65% | <35% → reprice |
| Commodity features (table stakes) | 80–95% | <60% → optimize |
No feature category should have a consistent negative gross margin in production. Negative-margin features should be in an active remediation program (optimization, repricing, or tier restructuring) with a timeline to resolution.
For the broader gross margin context, see AI-Native SaaS Gross Margin Decomposition. For how per-customer cost attribution complements per-feature tracking, see AI Inference Cost Allocation by Customer.
Conclusion
Per-feature gross margin tracking transforms the economics of AI product development from intuition to measurement. When every feature's cost is visible against its revenue contribution, pricing decisions are calibrated to economics rather than competitive benchmarking, optimization investments are ranked by ROI rather than engineering preference, and tier structures reflect the actual cost of delivering each capability.
The system requires an engineering investment — instrumenting inference calls with feature tags, building the attribution join, and creating a monthly review process. The return is permanent visibility into which features are building the business and which are eroding it.
See Your Growth Ceiling Now
Calculate when your SaaS growth will plateau — free, no signup required.
Frequently Asked Questions
Why does per-feature gross margin matter in AI products?
How do you technically tag inference calls by feature?
How do you calculate revenue contribution for each feature?
What is the margin stack and why is it important?
What pricing actions does per-feature gross margin enable?
How do you handle features that share inference costs?
What is a reasonable cadence for reviewing per-feature gross margins?
How does per-feature tracking interact with model routing decisions?
Related Posts
Allocating AI Inference Costs Back to Individual Customers
AI inference costs pooled at the company level create invisible margin problems. Here is a complete system for allocating inference costs to individual customers, surfacing unprofitable accounts, and pricing corrective action before margins erode.
9 min readSetting Per-Account Token Budgets Before Margins Erode
Token budgets at the per-account level prevent high-usage customers from consuming margin generated by the rest of the customer base. This guide covers how to design, implement, and communicate per-account token budgets that protect gross margin without creating customer friction.
7 min readThe Breakeven Math on Self-Hosting vs API Inference
Self-hosting AI models promises dramatically lower inference costs but requires significant engineering investment and infrastructure overhead. This guide walks through the complete breakeven calculation — including hidden costs — so you can make the switch at the right time.
7 min read