1 min lesson
Consumption billing at AI-product scale
Rebuild the sequence in "Consumption billing at AI-product scale" from memory, ending with the check that proves the outcome.
Step 1 of 2
Cursor's own pricing is consumption-heavy, which makes usage-based billing the single most relevant domain in this loop. If you can design the path from a raw token event to a correct invoice line - and defend the corrections after a period closes - you are speaking directly to the work.
The metering pipeline is the assembly line. Each step has a failure mode and the interviewer will probe the seams.
- 1Capture. The product emits a usage event per billable action - a request, input/output tokens, a compute-second - tagged with account, meter and a unique id.
- 2Deduplicate. Drop replays on the event id so retries and at-least-once delivery cannot inflate usage.
- 3Aggregate. Roll raw events into period totals per account and meter. High-volume streams get pre-aggregated to keep rating tractable.
- 4Rate. Apply the pricing model to the aggregate: tiers, included credits, overage rates, minimums. This produces the priced charge.
- 5Invoice. Assemble rated charges into invoice lines for the period and post them to billing.