Blog
/
Guides

Billing and Invoicing for AI Products: A Technical Guide

A technical breakdown of billing and invoicing for AI products, covering pay-as-you-go, credits, and where real-time entitlement checks fit in.

Sara NelissenSara Nelissen
Written by
Sara Nelissen
Last updated
August 4, 2026
Billing and Invoicing for AI Products: A Technical Guide

Table of contents

Your AI agent has already blown through its monthly allotment by the time invoicing notices. It keeps calling the model, keeps drawing down tokens, and the overage lands weeks later, once the invoice closes. Margin's already gone.

Billing and invoicing were built for a world where usage and payment run on separate timelines, but AI products don't get that luxury.

The gap between the cost happening and the invoice catching up is where margin leaks, and closing it means moving the check into the request path, before the call goes through. By the end, you'll know where real-time entitlement checks fit alongside the billing stack you already run.

What is billing?

Billing is the ongoing process of tracking what a customer owes and managing that balance over time. It covers usage tracking, charge calculation, payment collection, and the recurring cadence of monthly or usage-based cycles.

For an AI product, billing typically means metering API calls, tokens, or agent actions, then converting that consumption into a dollar amount at the end of a cycle.

What is invoicing?

An invoice is a formal, itemized request for payment. It tells you what was consumed, the amount owed, and the terms for paying it. Invoicing is the act of generating that document, a snapshot produced after usage has already happened.

For a token-based AI product, an invoice lists total tokens consumed, price per thousand tokens, and any overage charges for the period. It's accurate, and it's historical. It shows what a customer already spent. Their next spending limit lives somewhere else.

How billing and invoicing differ

Both processes track money owed. Where they diverge is scope and timing.

Billing Invoicing
Scope The full cycle: tracking, calculating, collecting One output of that cycle: the itemized request
Timing Continuous, ongoing Point-in-time, issued after a period closes
What it answers "What does this customer owe overall?" "Here's exactly what you owe and why"
Who owns it Finance, RevOps, billing engineering Finance, accounting
Relationship to usage Aggregates usage into charges Documents charges after aggregation

Both processes answer a financial question. Neither one answers an access question: should this request be allowed to happen right now, given what this customer, team, or agent has already consumed?

The billing and invoicing process for AI products

By the time you see a number on an invoice, five separate things have already happened, and every one of them ran after the actual cost hit your infrastructure.

Stage 1: The request fires

Someone calls your model. Maybe it's a real user, maybe it's an agent doing its thing in the background. Either way, this is the moment the meter starts tracking inference cost, compute time, and whatever third-party API you're passing through.

Nothing downstream has happened yet, and the bill for this exact request is already being written.

Stage 2: Usage gets metered

Somewhere, hopefully close to real time, a metering system writes down what just happened. 

Usually a small JSON event: Which customer, what time, how much, tokens, calls, agent actions, whatever your product counts. This is the part most teams get right early on. Recording a number is the easy half of the problem.

Stage 3: Usage aggregates and gets rated

All month long, these little events pile up. At some point, a rating engine walks through the pile and applies your pricing, per-token rate, tiered pricing, volume discount, whatever you've built, and turns raw usage into an actual dollar figure. This is where "1.2 million tokens" becomes "$4.80."

Stage 4: The invoice generates

Once the billing period wraps, all that math gets packaged into an invoice. Line items, totals, the whole thing. It's clean, it's accurate, and it's also the first time anyone outside engineering is looking at a number for usage that happened weeks ago.

Stage 5: Payment gets collected

Finally, someone pays. They might use a card, ACH, or whatever's on file, usually through a processor like Stripe, with retries if the first charge bounces.

Metering can happen in milliseconds. Everything after it, like rating, invoicing, and collection, runs on a cycle measured in days or weeks.

If your product is firing off thousands of billable events an hour, that gap between "the cost happened" and "someone noticed" is exactly where things get expensive.

Common billing models for AI products

Most AI products land on one of four billing models, and plenty run two or three at once depending on the plan tier.

Pay-as-you-go

You get charged for exactly what you use, per token, per API call, per agent action, with nothing committed upfront. Anthropic and OpenAI both run their direct API access this way.

It's the simplest model to reason about and also the easiest to get burned by if there's nothing checking usage before the charge racks up.

Technically, this model tolerates a bit of metering lag since there's no ceiling being enforced, just a running total.

Prepaid credits

A customer buys a balance upfront, then draws it down as they go. Cursor moved to exactly this model in 2025, with each plan including a credit pool you draw down. ElevenLabs and Replicate run similar prepaid-credit systems for their consumption-based features.

Under the hood, this needs a real ledger. A proper prepaid system tracks deposits, deductions, expirations, and occasionally multiple credit currencies running in parallel, all of which a simple counter can't handle.

Get the ledger wrong and you'll either overcharge someone or let them run past a balance that should've been zero.

Hard limits

A customer gets a fixed allotment, usually on a free tier, and once it's gone, the product stops responding. No overage, no grace period.

This is the model where enforcement timing matters most. If the check happens after the request instead of before it, a hard limit becomes a polite suggestion instead of an actual ceiling.

Hybrid models

A flat subscription fee covers a bundled amount of usage, and anything past that bundle gets billed as overage.

This shows up a lot once AI products build out enterprise tiers, where a customer wants predictable pricing most months but the product still needs a way to handle the month someone's usage spikes.

Hybrid models are the trickiest to implement well, since you're running a subscription clock and a usage meter at the same time, and both have to agree on where the line is.

Each of these needs a different enforcement approach, and that's the part that trips people up. 

Pay-as-you-go can survive a little lag, but hard limits need to stop the second usage crosses that ceiling, right there, before a batch job catches up three log lines later.

Why AI products break the classic model

AI products break the classic billing and invoicing model because cost is incurred the instant a request fires. Traditional software has predictable marginal costs, and an extra login doesn't cost you much.

Every AI model call is different, and cost hits the moment the request goes out, well ahead of any invoice.

If your only usage control is to count it and bill for it later, runaway usage can generate real cost before anyone downstream sees a number. Billing will eventually reflect what happened, but it won't stop what's happening.

Billing and invoicing tell you what the cost was, but AI products also need an answer to "is this allowed, right now, before the request completes?"

What happens when billing and invoicing are the only controls

Three scenarios show what that gap costs in practice.

The leaked API key

An image generation product's API key gets embedded in a public demo page by mistake. Requests pour in overnight from anyone who finds the page.

The billing system logs every generation correctly, but nobody sees the spike until the invoice posts three weeks later, well past the point where the key could have been revoked in time to matter.

The redial loop

A voice agent's outbound calling feature routes through a partner integration that misfires, redialing the same number for six hours straight. Usage metering counts every call accurately. 

The customer sees a number for the first time on the next invoice, by which point the compute cost is already spent.

The reprocessing bug

A scheduled data pipeline hits a bug that causes it to reprocess the same dataset every ten minutes instead of once a day. Billing counts every run, but finance only notices when the invoice lands far higher than expected.

In each case, billing and invoicing worked exactly as designed. Usage was counted accurately, and the invoice was correct, but none of that mattered in the moment the cost hit.

Where entitlements fit

Entitlements are the commercial rules that define what a customer, user, or agent can consume based on what they're paying for.

An entitlement carries measurement and consumption limits tied to a specific plan. It caps how many tokens, how many agent actions, and how many compute minutes a customer can draw down.

Entitlements are what billing and invoicing don't cover. Billing tells you what happened after the fact. Entitlements, meanwhile, decide what's allowed to happen, checked against the plan a customer purchased, before the request goes through.

This distinction matters more here than almost anywhere else in the stack. An enterprise team burning through its monthly agent-action budget in the first week needs an entitlement check that stops the next call. Waiting for the end-of-month billing report to discover the damage is too late.

Real-time enforcement vs. post-usage invoicing

Post-usage invoicing checks nothing before the request happens. It records what happened, then bills for it after the fact.

Real-time enforcement checks a customer's balance, quota, or entitlement at the moment of the request

Post-usage invoicing Real-time enforcement
At request time Nothing checked, request proceeds regardless Wallet, quota, or entitlement checked before the call completes
Overage caught At invoice close, days or weeks later Before the call that would have caused it
Latency added to the request None A synchronous check in the request path
Who handles the fix Finance, after the fact, via credit or dispute Handled automatically, no manual intervention
Cost exposure Full usage cost incurred regardless of plan limits Capped at the moment the limit is hit

In practice, a request comes in, and the entitlement layer checks the customer's balance, quota, or plan-based entitlement against cached data, then returns an allow or deny before the model call proceeds, before any cost hits your infrastructure.

On an allow, the balance decrements and the call goes through. On a deny, the call gets blocked or downgraded, depending on how the plan is configured, before any cost hits your infrastructure.

That's the difference between knowing what a customer used and controlling what they're allowed to use next.

How to implement entitlement checks alongside your billing stack

Implementing entitlement checks alongside an existing billing stack comes down to four pieces. 

The check itself needs to sit synchronously in the request path, which means it has to resolve inside whatever latency budget the rest of the call already runs on.

The engineering work here is mostly about making the entitlement logic fast and consistent enough to trust on every single request.

Step What happens Where it runs
1. Define the entitlement Set the metric (tokens, agent actions, compute minutes) and attach a limit per plan Product catalog/plan configuration
2. Place the check Verify balance or quota against request cost before the model call fires Request path, synchronous, cache-backed
3. Handle the deny Block, downgrade, queue, or prompt to upgrade, idempotently Application logic
4. Feed billing Pass usage data to the existing billing system for invoicing Downstream, async

Step 1: Define the entitlement

Decide what's being measured, whether it’s tokens, agent actions, or compute minutes, and attach a numeric limit to each plan.

This needs to live somewhere queryable at request time, typically a product catalog or plan configuration table, so a pricing change is a configuration update instead of a deploy.

Step 2: Place the check in the request path

The check runs before the model call fires, and to return an answer, it needs to know the customer's current balance or quota, and the cost of the request about to happen.

For token-based products, that second number often isn't known until the model call completes, which means some products check against a pre-authorization estimate, then reconcile the actual cost afterward.

The check itself needs to resolve instantly on a cache hit, or it becomes the slowest part of the request.

Step 3: Decide what happens on a deny

Some products block the call outright and return an error to the caller. Others downgrade to a smaller, cheaper model, queue the request for later, or prompt the customer to upgrade their plan.

This needs to be idempotent, since a retried request shouldn't double-decrement a balance that already got charged once.

Step 4: Feed usage data back into billing

The entitlement check's usage data flows into the existing billing system, usually as an async event rather than a synchronous write. This keeps the invoice at the end of the period accurate without adding write latency to the request path.

In a modern entitlement layer, this check runs from a cache local to your own infrastructure, so it keeps working even under heavy request volume or a dropped connection to a remote control plane.

For instance, Stigg's Sidecar deploys inside your cloud and checks entitlements from a local cache before falling back to a remote API only on a cache miss.

How Stigg fits into your billing and invoicing stack

Stigg sits in front of your billing stack, whether that's Stripe, Zuora, or something in-house, and decides whether a call, an agent action, or a token draw is allowed before it happens.

Challenges show up once billing setups get more involved than a single flat number, with multiple teams, multiple products, and enterprise customers who need budget broken out by department, all while the enforcement layer keeps holding up under heavy request volume.

This is where Stigg is built to run. Entitlement checks stay fast and consistent at high throughput, so scale itself stops being the thing that breaks pricing.

  • Entitlement checks in the request path resolve instantly on a cache hit from local Redis, with the Sidecar falling back to Stigg's Edge API at around 100ms on a miss, using a configurable timeout
  • Credit and token management with an auditable, ledger-based balance for every customer
  • Budget allocation and hard limits across users, teams, agents, products, and departments
  • A Sidecar that deploys inside your own cloud (BYOC), with data residency guarantees
  • Works alongside Stripe, Zuora, or custom in-house billing, without requiring a rebuild of your invoicing stack
  • Individually adoptable components, start with just the credits engine or just entitlements, and add the rest as it becomes useful

Billing and invoicing still handle what happens downstream, calculating the charge and generating the document. Stigg's job is confirming what gets billed was allowed to happen in the first place.

See the Stigg docs for SDKs, API references, and a self-service path to get the Sidecar running.

FAQs

1. What causes revenue leakage in billing and invoicing?

Revenue leakage happens when usage or services get rendered but never make it into a bill, often from incorrect item registration or a mismatch between what a contract specifies and what actually gets invoiced. Manual tracking, spreadsheets especially, makes this easy to miss at any real volume.

2. How do you invoice for usage across multiple AI models with different costs?

Usage needs to be metered and rated separately per model, since a call to a smaller model and a call to a frontier model carry very different marginal costs.

The invoice typically breaks this out as separate line items per model rather than one blended usage total, so a customer can see what actually drove the charge.

3. How does revenue recognition work for AI credits under accounting standards like ASC 606?

Prepaid credits are usually recognized as deferred revenue when purchased, then recognized as revenue as they get consumed, not at the point of sale.

This makes an auditable ledger important beyond just customer-facing accuracy, since finance needs to trace exactly when and how much of a prepaid balance was drawn down.

4. Do AI products need to handle multi-currency billing differently than traditional software?

The challenges show up more in usage-based pricing than currency conversion itself.

A per-token or per-call rate set in USD still needs to convert accurately at invoice time, and any credit or wallet balance held in a foreign currency needs consistent exchange-rate handling so a customer's balance doesn't drift in value between top-ups.

5. How do you bill for usage generated by one AI agent calling another agent?

This depends on whether the downstream agent call counts as a single usage event or triggers its own metered cost.

Most products attribute the full cost chain back to the customer or workflow that initiated the first call, but multi-agent workflows can generate usage in ways that are harder to attribute cleanly than a single direct API call.

Latest news.

One email per month.
From engineers, for engineers.

Thank you! Your submission has been received.
Oops! Something went wrong while submitting the form.