Estimate AI gross-margin inputs by account
How does accepted-output cost compare with successfully collected revenue for each account?
Join model costs and accepted outputs to billing results for each account. These costs are estimates. Check them against invoices.
Expected result
Estimated AI cost by account
| account_id | plan | collected_usd | estimated_ai_cost_usd | accepted_outputs | cost_per_accepted_output_usd | ai_cost_pct_of_collected |
|---|---|---|---|---|---|---|
| acct_delta | growth | 1,800 | 0.079 | 3 | 0.0263 | 0.0044 |
| acct_acme | growth | 2,400 | 0.05 | 2 | 0.025 | 0.0021 |
| acct_beacon | business | 1,200 | 0.021 | 1 | 0.021 | 0.0018 |
| acct_ember | starter | 0 | 0.006 | 0 | — | — |
| acct_cinder | starter | 0 | 0.005 | 0 | — | — |
| acct_fjord | free | 0 | 0.004 | 1 | 0.004 | — |
How to read the query
- Model usage is reduced to one account row before the billing join.
- Cost per accepted output counts outputs accepted in your product. A successful provider response does not count on its own.
- Accounts with no collected revenue have a null cost percentage.
How to interpret the results
- 1Use versioned provider prices and reconcile estimates with provider invoices.
- 2Define accepted outcomes per feature and guard against missing feedback.
- 3Include non-model infrastructure and labor costs before claiming gross margin.
Related lessons
Keep the result
Run this query on your own events
Create a free workspace only when you are ready to save the query, connect real events, and monitor the result. No credit card is required.