Usage Billing Review

Real-Time vs. Batch Aggregation for Usage Metering

Choose aggregation timing now, or lose critical capabilities later.

· 10 min read · Updated
Cover illustration for “Real-Time vs. Batch Aggregation for Usage Metering”
Usage Event Metering and Aggregation · August 16, 2026 · 10 min read · 2,297 words

Whether a metering system aggregates usage in real time or in scheduled batches is a structural decision baked into the data pipeline itself, and it cannot be changed later the way a billing cycle or a currency setting can. Metering is the stage where most usage-based billing actually breaks, not at invoice generation and not at payment collection, but at the point where the system has to accurately capture what a customer did inside the product. That distinction matters because every usage-based pricing model, from API calls to token consumption, depends on a pipeline with four stages that never change regardless of which architecture a company picks: event capture, aggregation, rating, and delivery. Event capture logs a billable action with a customer ID, a timestamp, and whatever metadata the product needs to price it later. Aggregation groups those events by customer, by metric, and by billing period; rating applies the pricing rules, tiers, discounts, credit deductions, against the aggregated totals; and delivery passes the metered data to the billing system for invoicing while also surfacing it to the customer.

What changes between a real-time and a batch system is not whether these four stages happen, but when the aggregation stage runs and what that timing permits or rules out further down the pipeline. A batch job that aggregates events once an hour has already decided, by that choice alone, that no decision inside that hour can be made on current information. That is an infrastructure fact, not a configuration preference, and it is the argument the rest of this piece works through in detail.

What each architecture enables and forecloses

Diagram: The Four Stages of a Usage-Based Billing Pipeline. Visualizes: Visualize the four universal stages of a usage-based billing pipeline as a linear flow: Event Capture → Aggregation → Rating → Delivery.

The aggregation stage is where the real consequences live, because the timing decision made there determines three downstream capabilities: whether usage limits can be enforced while consumption is happening, whether customers can see their own consumption as it accrues, and whether the number on an invoice actually matches what happened by the time the books close. A company cannot bolt mid-cycle enforcement onto a batch pipeline after the fact; the pipeline either produces a current balance figure or it doesn't.

Real-time architectures make a specific set of things possible. That last point matters especially for AI products, where millisecond-speed consumption against a hard credit limit is now standard practice. Infrastructure built to handle this, Flexprice among it, ingests usage events at that speed and enforces limits synchronously, while a batch system by construction defers enforcement to whatever cycle comes next.

Batch architectures trade those capabilities for lower cost and simpler operations. The tradeoff is that limits get enforced retroactively, at the next scheduled run, rather than in the moment consumption happens. Charges at invoice time can lag actual consumption, sometimes by the length of a full billing cycle.

A detail that gets missed in most comparisons: metering, rating, and invoicing don't share a single latency requirement. The case for real-time infrastructure is strongest specifically at the metering stage. Demanding real-time invoicing is over-engineering a problem that doesn't need millisecond precision, and batching the metering stage is under-building a problem that does. Fully synchronous, request-path real-time processing earns its cost only when a real-time decision, a credit check or a throttle, has to be made before the request can complete. Batch is not a lesser architecture. Batch is the correct architecture for a specific and common set of conditions. Those conditions, and when they stop holding, deserve close attention.

Why AI workloads break batch metering first

For a large share of SaaS products, batch metering is entirely adequate. Three specific conditions push batch metering past its limits, distinct from treating "batch is outdated" as a blanket claim.

The first condition is that customers need to see a balance that is actively drawing down rather than a balance as of the last scheduled run. The second is that limits must be enforced mid-cycle, before over-consumption turns into a direct financial loss for the vendor rather than a billing adjustment. The third is that credit wallets must debit as events occur rather than at the end of a period; a credit-based pricing model has no meaning if the balance check happens after the credit is already spent. AI products hit all three simultaneously. That is why they expose the limits of batch metering faster and more completely than almost any other workload.

Token consumption is the clearest illustration. It is spiky and unpredictable in a way that seat-based or call-based usage rarely is, and a single AI session can burn through an entire prepaid credit balance before an hourly or daily batch job ever runs again. A batch system can eventually show a customer what they used, but it cannot stop them from blowing past a hard limit while it's happening, because stopping that requires a current balance figure, not a historical one.

Volume compounds the problem. A separate and distinct failure mode sits alongside this one: idempotency. The same event arriving twice because of a retry or a network hiccup causes double-counted usage regardless of whether the underlying system is real-time or batch. Both architectures have to solve for it, but a real-time system encounters the problem at far higher velocity simply because it is processing far more events per second.

This is why real-time visibility into a drawing-down balance, mid-cycle enforcement of limits, and per-event credit debiting rather than debiting at period close have become close to non-negotiable for AI products specifically, which trigger all three failure conditions of batch metering at once. GitHub's move of Copilot to a usage-based structure makes the point concrete. The product replaced its earlier Premium Request Unit system with AI Credits tied directly to token consumption, giving organizations a pool of credits with the option to buy more once that pool runs out, governed by budget policies administrators configure themselves. A model like that only functions if credit debits happen per event as consumption occurs; a batch system checking balances once an hour would leave organizations with no way to know, in the moment, whether they'd already exceeded an admin-configured budget.

AWS Marketplace's Batch Architecture and the Limits of Interval-Based Metering

AWS Marketplace's publicly documented metering system offers a useful real-world case precisely because it is a well-built, carefully engineered batch architecture rather than a poorly designed one, and its own documentation is explicit about what that architecture cannot do, architecturally rather than as a critique of AWS's engineering choices.

The documentation states that AWS can only bill a customer once it has received metering records from the seller, and that the seller carries responsibility for making sure those records actually transmit. If a network outage or an application failure causes records to fall behind, and a subscription expires before the backlog clears, usage can go entirely unreported. That is a direct structural consequence of batch delivery: the billing system's accuracy depends on a transmission step that happens on an interval, and any disruption to that interval has a real chance of permanently losing data rather than merely delaying it.

The unsubscribe window makes the constraint sharper. When a buyer initiates an unsubscribe, the seller has exactly one hour to submit all unreported usage records. The AWS Cost and Usage Report compounds the same limitation on the visibility side: AWS documentation notes explicitly that the report is not updated in real time, so buyers checking usage through the billing console are always looking at data that lags behind actual consumption, with no live balance check built into the system at all.

None of this reflects poorly on AWS Marketplace's design. It is the correct architecture for the kind of end-of-period SaaS subscription billing it was built to serve. What it demonstrates is that even a system built by one of the most resourced infrastructure organizations in the industry cannot offer per-event credit enforcement or sub-minute balance visibility, because batch architecture forecloses those capabilities by construction, not by an engineering oversight that better execution could fix.

Requirements for Real-Time Metering Infrastructure

Closing the gap batch leaves behind requires more than faster ingestion. Real-time metering is a set of requirements that has to hold across the entire pipeline simultaneously, because a system that ingests events instantly but still aggregates them on a schedule, or aggregates continuously but delays the credit debit, reproduces the same failure modes described above under a different name. The requirements break down by pipeline stage.

On ingestion, exactly-once delivery is a hard requirement rather than a nice-to-have, because a system processing at millisecond speed that double-counts on retry inflates usage faster, and erodes customer trust faster, than a batch system ever would. Ingestion also has to cover a genuinely diverse set of sources, APIs, microservices, webhooks, and data warehouses, since a system that only handles one source type pushes the work of building adapters for the rest back onto the vendor's engineering team.

On aggregation, the processing has to run per customer and per meter continuously, even if a scheduled job runs frequently. It also needs to support multiple aggregation functions across different metric types: a weighted sum for token costs, a simple count for API calls, a maximum for peak resource usage. An event debugger, the ability to inspect any individual ingested event, is an operational requirement rather than a convenience, since without it there is no way to investigate a discrepancy between a metered total and what a customer believes they used.

On credit and entitlement enforcement, the balance debit has to happen per event, not per batch, or the credit wallet model simply doesn't function. A debit that waits for the next batch cycle cannot block over-consumption that already happened inside that cycle. Spend visibility has to reach the customer while usage is happening. Proactive threshold alerts and live dashboards aren't optional features but direct consequences of the architecture a vendor chose.

On rating and invoicing, rate cards need to be editable without a code deployment, since teams iterating pricing every quarter can't realistically file an engineering ticket every time a tier shifts. Mid-cycle plan changes require automatic proration of the subscription portion alongside continuous metering against the new rate from the moment the change takes effect; a system that handles proration but not continuous re-rating, or the reverse, produces invoices that need manual correction after the fact.

Platforms that handle real-time metering, rating, and invoicing on one event model

The clearest way to evaluate a metering platform is to count how many of the three pipeline stages, metering, rating, and invoicing, it actually owns on a single event data model, since systems that split those stages across different vendors create a reconciliation gap where the usage number in one system disagrees with the usage number in another.

Flexprice owns all three stages on one raw event data model, so a usage figure is never recalculated by a second system downstream. Its ingestion layer runs on Go and Kafka, handling up to 1 million events per second with exactly-once delivery across billions of events per month, pulling from APIs, microservices, webhooks, or a data warehouse. Aggregation supports eight functions, including weighted-sum, and an event debugger shows every event that was ingested, which matters directly for the kind of discrepancy investigation described above. Its Credits and Wallets system debits per event, with a balance check running under 60ms, fast enough to sit inside the request path rather than alongside it. Rate cards change without requiring a deployment and can be tested in a sandbox before touching a live invoice. The billing and invoicing layer converts metered events directly into invoice lines, applies credits, discounts, and proration, and shows an invoice preview before anything is finalized. The platform also tracks AI cost per customer down to the individual model, and it can deploy inside a company's own VPC, on-premises, or on Flexprice's managed cloud. It offers a free tier for lower event volumes, paid tiers at higher thresholds with flat monthly pricing rather than a percentage of revenue, a yearly-commitment discount, and an enterprise tier at custom pricing; service-level agreements step up from a standard availability tier to a higher-availability tier starting at the Build plan, with faster P0 response times at higher levels. Segwise, an AI ad analytics platform, had spent three weeks building credit infrastructure internally, a setup where every credit decision needed an engineer, with no customer-facing UI and no visibility into burn rate, before shipping working credit infrastructure on Flexprice in three days. Sameer Kumar, founder of CASParser, described the result this way: "It just magically works behind the scenes. There's almost negligible lag around updation of the quotas."

Building the pipeline in-house is a legitimate path for some companies, and it comes with full control over every part of the system and no dependency on an outside vendor, at the cost of owning every upgrade, bug, and operational incident indefinitely. Simplismart spent between one and a half and two months building a billing engine internally, then found it consuming a sustained share of a developer's daily time on maintenance before moving to a third-party platform and getting that time back. Building first becomes the cost-effective choice only above a certain threshold of usage-linked annual recurring revenue, where metering logic is central enough to the business to justify the custom engineering investment; below that threshold, paying a vendor costs less.

A subscription billing tool with a metering layer added on top is a reasonable choice for simple usage cases where end-of-period billing is acceptable and nothing in the pricing model requires mid-cycle credit enforcement. The decision point for any team evaluating these options is the same one this piece opened with: whether the product's usage pattern, and specifically whether it looks anything like the spiky, high-volume, credit-metered consumption typical of AI workloads, requires the capabilities that only an architecture built for real-time aggregation can deliver.

Sources

  1. I Need to Meter AI Usage and Bill Customers Monthly Based on Consumption: What Are My Options?
  2. What's the Best Usage Billing Platform for AI Products That Need Real-Time Metering, Rating, and Invoicing?
  3. Configuring metering for usage with SaaS subscriptions - AWS Marketplace

More in Usage Event Metering and Aggregation