Calculate LLM cost per accepted output
Which plans consume the most model spend, and how much does each accepted output cost?
Join normalized provider usage to account context, then compare raw request cost with a reviewed product outcome.
Published expected result
Estimated LLM cost by plan
| plan | requests | automatic_retries | estimated_cost_usd | accepted_outputs | cost_per_accepted_output_usd |
|---|---|---|---|---|---|
| growth | 6 | 1 | 0.129 | 5 | 0.0258 |
| business | 2 | 0 | 0.021 | 1 | 0.021 |
| starter | 2 | 0 | 0.011 | 0 | — |
| free | 1 | 0 | 0.004 | 1 | 0.004 |
How to read the query
- Provider-specific usage is normalized before the query, preserving a stable analysis contract.
- Acceptance is a product outcome, not a property of the provider response itself.
- NULLIF leaves cost per accepted output undefined when a segment has no accepted outputs.
Decisions the SQL cannot make
- 1Keep current model pricing in versioned configuration and retain the pricing version on each event.
- 2Separate automatic retries from deliberate user regenerations.
- 3Use invoices as billing truth; the event field is an analytical estimate.