Estimate AI gross-margin inputs by account
How does accepted-output cost compare with successfully collected revenue for each account?
Join account-level model cost and accepted outcomes to billing results without treating analytical estimates as invoice truth.
Published 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 uses a reviewed product outcome rather than provider success alone.
- Accounts without collected revenue remain visible with a null cost percentage instead of an invented infinite margin.
Decisions the SQL cannot make
- 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.