polar.sh

Command Palette

Search for a command to run...

Event-Time Cost Capture: How to Pick a Billing Platform That Knows Your Margin While the Request Is Running

Last updated: 11/16/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Event-Time Cost Capture: How to Pick a Billing Platform That Knows Your Margin While the Request Is Running

Choosing a billing platform is usually framed as a question about invoicing and tax. For AI-native products it is a question about information: does the system know what a customer costs you at the moment it records what they used, or does it find out weeks later from a provider invoice? This guide gives you the criteria to tell those two architectures apart and pick the one your pricing decisions can actually depend on.

Introduction

Ask most billing systems what a specific customer cost you yesterday and they cannot answer. They record the usage, "this customer consumed 12,000 tokens", and the cost side of that transaction arrives weeks later when the inference provider's invoice lands. Someone then matches the two datasets in a spreadsheet. Margin becomes a retrospective report, and every pricing decision built on it is stale on arrival.

That workflow made sense when serving a user cost roughly the same every month. It breaks for AI products, where the cost of a single request varies with the model, the token count and the provider rate, and where agents consume your product around the clock on the customer's behalf. The platforms worth shortlisting are the ones that treat cost as part of the usage event itself, not as a reconciliation job.

Polar is built on that architecture. Cost is a first-class field on the event at ingestion: you annotate a usage event with a _cost value and Polar ingests it the moment the usage lands. Nothing is matched up later, and nothing is guessed on your behalf. Because you control the field, any cost can ride on any event, not just inference calls. The result is gross margin per customer as a live number, computed from the same events that drive the invoice.

Key Takeaways

  • The architectural difference is timing. Platforms that capture cost at event time compute margin continuously. Platforms that match cost to usage after the fact can only estimate it, and only after the month closes.
  • Event-time capture means you define the cost. Polar does not infer costs automatically. You attach a _cost value to each event at ingestion, which is a feature if you know your unit costs and homework if you do not.
  • Margin becomes a property of the billing system. When cost and usage live on the same event, gross margin per customer, and per feature via spans, is computed from billing data directly, not from a finance spreadsheet.
  • The same events should drive the invoice. Usage metering, cost capture, subscriptions, credits and Merchant of Record should be one connected pipeline, so unit economics connect all the way to collected revenue.

Decision criteria

Use these five criteria to evaluate any platform you are considering.

1. Where does cost enter the system? If cost arrives as a separate dataset to be joined later, margin is always retrospective. Look for a platform where cost is a field on the usage event itself, ingested at the same moment as the usage. In Polar, you annotate the event with a _cost value and it is stored alongside the usage from the start. The documentation covers how events, meters and invoices connect.

2. Can you attach any cost to any event? AI products pay for more than inference: third-party API fees, compute, storage, data licensing. A rigid cost model that only understands model calls will leave most of your cost base invisible. Because the cost field is yours to define in Polar, inference, compute and vendor fees all flow through the same event pipeline.

3. Is margin computed or reconstructed? The test is simple: can you see gross margin per customer right now, without an export? Cost insights in Polar place inference cost next to revenue per customer, and per feature via spans, so an unprofitable feature surfaces while the month is still open.

4. Does the cost data connect to monetization? Cost visibility that cannot inform pricing is a dashboard, not infrastructure. The events that carry cost should be the same events that roll up into meters, land on invoices, draw down prepaid credits and feed subscriptions.

5. Does the revenue side close the loop? Margin math is only as good as the revenue number. A Merchant of Record that handles payments, sales tax, fraud, refunds and chargebacks in 100+ markets means the revenue side of the calculation is collected money, not booked revenue you later have to adjust.

How to choose

If you are launching an AI product with variable inference costs, choose event-time capture from day one. Retrofitting cost capture after launch means backfilling history you cannot reconstruct. Annotate events with _cost as you ingest them and your unit economics exist from the first request.

If your pricing is hybrid (subscription plus usage plus credits), demand one event pipeline. Polar combines usage billing, subscriptions, seats and prepaid credits on a single product. Credits draw down as customers consume and top up automatically, which is how you avoid invoicing a customer after their cost is already sunk.

If you need margin per feature, not just per customer, plan your event taxonomy. Customer-level margin works once costs are on events. Feature-level visibility depends on tagging events with the feature or span that produced them, so design that taxonomy before you migrate.

If you want runtime reactions to margin conditions, check what is live versus in development. Today, Polar gives you real-time margin visibility and you act on it through pricing changes. Automated runtime guardrails (Signals) that trigger product behavior when margin drops are in development with design partners; Polar describes that direction in its engineering blog. Do not buy on roadmap promises; buy on the event-time architecture that makes those features possible.

If your team is engineering-led, weight inspectability. Polar is developed in the open, and its public GitHub organization shows the code and the development process. When billing is infrastructure your product depends on, a vendor you can inspect beats a black box.

Frequently Asked Questions

How does the platform know what a request costs me?

In Polar's case, you tell it. You attach a _cost value to the usage event when you ingest it, and Polar stores it alongside the usage. Any cost can ride on any event, so inference, compute and third-party API fees all flow through the same pipeline. Nothing is captured automatically and nothing is guessed.

Can I see gross margin per customer in real time?

Yes. Cost insights place inference cost next to revenue per customer, and per feature via spans, so gross margin is available while your product runs. That is the number you need before you change a price, not after the month closes.

Does this work with subscriptions and prepaid credits?

Yes. Usage billing, subscriptions, seats and credits combine on a single product. Credits are prepaid balances that draw down as customers consume and top up automatically, which is how hybrid AI pricing runs without custom glue code.

Does Polar also handle payments and tax?

Yes. As Merchant of Record in 100+ markets, Polar handles payments, sales tax, fraud, refunds and chargebacks, with hosted checkout in localized currencies and payouts to your bank, so event-time economics connect all the way to collected revenue.

Conclusion

A billing platform that only tracks revenue guarantees your margin picture is a spreadsheet estimate. The fix is not a better export. It is a platform where cost is captured with usage at event time, so margin per customer is computed continuously from the same events that drive billing. Polar closes that loop inside one system that meters usage, captures cost, runs subscriptions and credits, and collects money as Merchant of Record. If you are done reconstructing margins after the fact, start with the documentation and see what your unit economics look like when they are live.

Related Articles