Embedded AI Margin
Your AI feature has a cost per customer. Now you can see it.
P402 binds every AI call to the customer who triggered it. Revenue, cost, gross margin, and quality-adjusted unit economics: live, per customer, per feature.
For product and finance leaders at SaaS companies whose product calls AI models on behalf of paying customers.
The problem
Per-seat pricing, per-token cost. The math is hiding.
You charge $99/mo per seat. One customer sends 12x the traffic of the median. Their token bill is eating the contribution margin and you find out at quarter-close, when finance does the math.
Without per-customer attribution, the team flying blind has only two responses: raise prices for everyone or cut model quality for everyone. Both are wrong. The right answer is to find the one customer whose unit economics are upside-down.
What P402 does
One ledger. Owner, budget, policy, outcome, evidence.
customer_id is a first-class field on every event. Filter, group, export by customer across all your AI-backed features.
revenue_usd and gross_margin_pct live next to cost_usd. The finance team sees the margin without joining three systems.
feature_id groups events by the SaaS feature that triggered the call. Compare margins across features to know which ones to invest in.
Outcome status and quality_score bind to each event. Optimize ranks by cost per accepted output, not raw cost.
Proof
Margin tile drills from tenant to customer to feature to workflow.
Smallest cost unit recorded. No truncation, no aggregation loss.
Lag from event to margin tile refresh.
Questions
embedded ai margin: FAQ
How does customer_id get attached to a call?
Pass it as a header (x-p402-customer-id), in the OpenAI-compatible body extension, or in the meter-only POST. It lands on the economic event and propagates through every downstream view.
Can we attribute to a customer who is not on the request?
Yes. Server-side workflows that batch process customer data pass customer_id in the meter-only event.
Does revenue tracking require Stripe integration?
Stripe is one source. The revenue_usd field is independent; you can also push revenue from your own billing system or a CRM webhook.
What about customers we can't name (PII)?
customer_id is opaque. Use a stable hash or a tenant-side surrogate. P402 never resolves it back to a name.
How is this different from a usage-based-pricing tool?
UBP tools price your product. P402 attributes your AI cost. Most teams need both: P402 feeds the cost basis into the UBP tool.