Blog
/
Guides

Credit pricing: Models, formula, and infrastructure pitfalls

Credit pricing for AI and software products: how it works, how to price a credit, and the ledger and enforcement it needs to hold up in production.

Sara NelissenSara Nelissen
Written by
Sara Nelissen
Last updated
July 6, 2026
read time
7
minutes
Credit pricing: Models, formula, and infrastructure pitfalls

Table of contents

The credit system works fine in staging. Then a customer runs three agent sessions in parallel, and the balance drains three times faster than it should because concurrent writes aren't handled correctly. The overage posts before anyone notices (on a Friday night, naturally).

Credit pricing is simple to sketch on a whiteboard. Keeping it correct under real workloads takes a ledger, a burn order, and a balance check that runs before every request.

What is credit pricing?

Credit pricing is a model where customers purchase a balance of credits upfront and consume that balance as they use the product. It is also called credit-based pricing, or a credit-based pricing model.

Here, "credit" means a unit of value inside a software or AI product. (Loan pricing and college credits are a different search entirely.) If you're after the purchase flow, the prepaid credits guide covers it, and the full system design for LLM products lives in the AI credits guide.

Credits work like a currency the product understands. Each action, API call, token batch, or agent task reduces the customer's balance based on rules you define.

That's what separates it from pay-as-you-go, where usage is recorded first and billed later. With credit pricing, the purchase happens before usage, so the system has to track and enforce a live balance on every request.

How credit pricing works

Credit pricing runs as a loop: credits go in, actions draw them down, and the balance gets topped up, renewed, or expires.

📍 Stage 🛠️ What happens ⚙️ What the system has to do
Grant Customer buys a pack, renews a plan, or receives promo credits Record the grant with its amount, expiry, and category
Price Each action has a credit cost Map usage (tokens, calls, tasks) to credits
Deduct The action runs and the balance drops Check the balance and debit it at request time
Replenish Balance runs low or the period renews Top up, issue the next grant, or expire old credits

Two systems share this loop. Billing handles the money: charging for credit packs, invoicing renewals, and processing top-ups. The entitlements layer reads the current balance and decides whether the next request can proceed.

Put more plainly, billing tells you what happened and the entitlements layer decides what’s allowed to happen.

They run on different clocks (billing thinks in invoices, entitlements think in milliseconds), but they have to agree. Otherwise usage, limits, and charges drift apart, and finance finds out first.

Benefits of credit pricing

Credit pricing gives both sides something a flat subscription can't. Each benefit comes with a cost you'll pay somewhere else in the system.

  • Predictable spend for customers: Buyers commit to a known amount, which makes budget approval easier. The catch is that they need a visible balance, or they get surprised anyway.
  • Cash up front: Prepaid packs and larger upfront purchases improve cash flow. Unused credits sit on your books as a liability until they're consumed or expire.
  • One price list worldwide: Every action costs the same number of credits in every market, so you only localize the price of the credit pack. Tax and currency still apply to the pack itself.
  • One currency across features and models: A single balance can cover chat, image generation, and agent runs. Each feature needs its own credit weight, and someone has to own those weights.
  • Room to absorb model cost changes: When an upstream model gets cheaper or pricier, you can adjust the credit mapping without republishing the price list. Change it too often and customers stop trusting the unit.
  • Promotions without discounts: Trials, referrals, and campaigns become bonus credit grants. Those grants need their own category so finance can tell them apart from paid revenue.

Challenges of credit pricing

Most of the challenges come down to one fact: a credit is an abstraction, and abstractions leak.

  • Customers can't tell what a credit is worth: "500 credits" means nothing until someone translates it into actions. Without a cost-per-action view in the product, support tickets fill that role.
  • Revenue gets harder to forecast: Top-ups arrive whenever usage spikes, which makes them sporadic. Under IFRS 15, revenue is recognized when the promised service is delivered, so a prepaid pack stays deferred until the credits get used.
  • Pricing shock: An agent that loops through a long task can burn a month of credits in an afternoon. Customers rarely blame the agent.
  • Policy decisions you can't skip: Expiry, rollover, and refunds all need answers before launch. A bulk discount on credits that never expire lets a customer buy once and coast for years.
  • Enforcement has to be real time: A balance that updates in a nightly batch lets customers spend credits they don't have. The deduction has to land before the expensive operation runs.

That last challenge is where credit pricing turns into an infrastructure project.

Credit pricing vs. subscription vs. pay-as-you-go

Credit pricing sits between a flat subscription and pure pay-as-you-go. Payment comes first, like a subscription, and consumption sets the cost, like pay-as-you-go.

Model When the customer pays Customer's spend Your revenue What enforcement needs
Credit pricing Before usage Capped by the balance Prepaid, recognized on use Live balance check per request
Subscription Each billing period Fixed Steady and recurring Feature and seat access checks
Pay-as-you-go After usage Open-ended Tracks usage, arrives late Accurate metering and invoicing

Credit pricing and pay-as-you-go both fall under the usage-based pricing umbrella, because consumption drives the bill. Pay-as-you-go pricing bills that consumption after the fact. Credit pricing collects payment first and enforces the balance as usage happens.

In practice, many AI products blend them: a subscription that includes a monthly credit grant, plus top-ups for heavy months.

The main credit pricing models

Credit pricing models define how credits are issued, consumed, and replenished, and each model needs different enforcement behavior in the system.

Model How it works Enforcement requirement
Prepaid block Customer buys a fixed credit block upfront Track block balance and deduct usage at request time
Auto-recharge New block purchased when balance drops below a threshold Detect threshold and trigger billing and new credit grant
Subscription with credit grant Credits issued on a recurring cycle Grant credits on renewal and apply expiry rules
Hybrid (subscription + top-up) Base credits with additional purchasable blocks Manage multiple blocks with burn order and priority
Promotional grant Credits issued for trials or campaigns Track category and prioritize depletion rules

As usage gets less predictable, hybrid models tend to become the default. A base credit grant covers expected usage, while additional blocks absorb the spikes.

That flexibility costs you in enforcement. The system has to manage several credit sources at once and apply the right depletion rules without mixing balances or losing track of usage.

Credits vs. tokens vs. wallets

Credits, tokens, and wallets sit at different layers of the pricing model, from raw consumption up to how that consumption is packaged and controlled.

Term What it represents Role in the system
Tokens Atomic unit of AI consumption Measured directly by the model during each request
Credits Abstract pricing unit Maps usage into a stable, customer-facing pricing model
Wallets Container for balances Holds and allocates credits across users or teams

Tokens are the lowest level. They reflect what the model processes and work well for precise metering, but they expose internal details and make an awkward pricing unit. (Try explaining a context window on a pricing page.)

Credits sit above tokens as an abstraction layer. A credit can represent a fixed number of tokens or a higher-level action, so pricing stays stable even when the underlying model or cost structure changes.

Wallets group and manage balances. A wallet can hold one or more credit balances and be assigned at the organization, department, team, user, or individual-agent level.

In a hierarchy, every check evaluates the full chain from the caller up to the root, and only grants when every budget above allows. That's what makes allocation and governance possible, with a total budget split and tracked across many entities.

The abstraction you expose shapes the system design. Token-based pricing needs fine-grained metering at the model level. Credit-based models need a mapping layer between usage and price. Wallet-based systems need hierarchical balance tracking with allocation rules at every level.

How to price a credit

To price a credit, work out what one action costs you, add your margin, and divide by what a single credit sells for. The formula:

Credits per action = cost per action ÷ (1 − target margin) ÷ price of one credit

Cost per action is everything the action consumes, so model tokens, GPU time, third-party API calls, and storage. Target margin and credit price are your packaging decisions. The formula just keeps the arithmetic honest once you've made them.

A worked example

These numbers are illustrative. Plug in your own.

  • The action: summarizing a document uses about 6,000 input tokens and 1,000 output tokens.
  • The model cost: at a hypothetical $2 per million input tokens and $8 per million output tokens, one summary costs $0.012 + $0.008 = $0.02.
  • The margin: at a 75% target margin, the summary needs to sell for $0.02 ÷ 0.25 = $0.08.
  • The credit: if one credit sells for $0.01, a summary costs 8 credits.

Now add a premium model that costs five times as much per token. It’s the same math, and that summary costs 40 credits. Your customers see two prices in one currency, and your margin holds on both.

Weighting features and models

Real products rarely have a single cost profile. One request might call two models, process a batch of files, and trigger an agent step, each with a different cost.

That's why credit costs usually end up as weighted formulas per feature, something like credits = (1.1 × model_a_tokens) + (5 × model_b_tokens), which Stigg supports through custom credit consumption formulas.

A fixed, round credit price is easier for customers to reason about, and the per-feature weights are where model cost changes get absorbed.

What data model does credit pricing require?

Credit pricing requires a data model that tracks more than a single balance, because enforcement, billing, and audit all depend on how credits are issued and consumed over time.

Each credit block issued to a customer carries its own attributes:

  • Amount: Number of credits in the block
  • Expiry date: Determines when the block becomes invalid and affects burn order
  • Cost basis: What the customer paid, used for revenue recognition
  • Category: Paid or promotional, which affects accounting treatment
  • Depletion behavior: Whether usage stops at zero or continues with overage

As customers buy credits over time, the system piles up blocks with different properties. Together they form a ledger of credit events, and the balance is something you derive from that ledger.

Each debit references the block it draws from, the order of consumption, and the timestamp of the event. That keeps usage aligned with expiry rules, cost basis, and accounting requirements.

The ledger also has to be append-only. Every credit grant and debit is recorded as an immutable event, and the current balance comes from those records. That structure keeps usage, billing, and finance data consistent and auditable.

How burn order works in credit pricing

Burn order defines which credit block the system debits when a customer has several active balances. It's a configuration decision that affects both user experience and financial outcomes.

When credits come from different sources, the system needs clear rules for how they're consumed:

  • Explicit priority first: A grant you've marked as higher priority (say, a customer-specific commitment) is consumed before anything else
  • Earlier expiry next: Credits that expire sooner are used first, which prevents losses from unused balances
  • Promotional before paid: Promotional credits usually have no cost basis, so burning them first preserves the value of paid credits

Burn order needs to be configurable at the plan and customer level. A single global rule breaks down once promotional grants, trials, and standard purchases live in the same account.

The table below shows how different scenarios affect the ledger:

Scenario Burn order logic Ledger requirement
Multiple paid blocks with different expiry Earlier-expiring block first Track expiry per block
Paid and promotional credits Promotional credits first Category field with priority rules
Soft depletion on empty balance Usage continues and records overage Negative balance or overage entries
Hard depletion on empty balance Usage is blocked Enforcement at request time

Hard vs. soft credit depletion

Hard and soft credit depletion define how the system behaves when a customer's credit balance hits zero.

  • Hard depletion stops usage at the limit. The system blocks the request, and the application can trigger a paywall, upgrade flow, or top-up before any more usage happens.
  • Soft depletion lets usage continue past zero. The system records an overdraft (a negative balance or overage entry), which the next grant settles or billing picks up. Workflows keep running while the account moves into overage handling.

A well-designed check returns access-granted plus a soft-limit flag, so application code can distinguish ‘blocked’ from ‘in overage, allow and track it’ without inferring from the balance itself.

The right choice depends on the plan and the use case. A free tier might enforce strict limits, while an enterprise plan allows continued usage so a long-running job doesn't die halfway through.

Auto-recharge sits between the two. When the balance drops below a threshold, the system tops it back up to a target, under a spend cap that fails closed.

Once the configured monthly cap is reached, recharging stops rather than continuing to bill, so an automated retry loop can’t burn credits all weekend.

Rollover, expiry, and refund policies

Rollover, expiry, and refund policies decide what happens to credits a customer paid for but hasn't used. Each choice shows up twice: once in the customer's trust, and once as an event in your ledger.

Policy What the customer experiences What the ledger records
Expire at end of term Use it or lose it each period Expiry date per grant, expiry events
Roll over unused credits Leftovers carry into the next period A new grant or extended expiry for the remainder
Fixed window per grant Each pack lasts a set time from purchase Expiry stored per block
Forfeit on churn Balance is lost if they cancel Expiry or void events on cancellation
Void or refund a grant Credits are removed after a refund A void event with a reason, plus the refund in billing

Expiry and burn order work as a pair. If credits expire, the soonest-to-expire block should burn first, or customers lose credits they'd have used anyway.

Credits that expire unused are called breakage. Finance recognizes that revenue under its own policy, which only works if every expiry is a recorded event with a cost basis attached.

What are entitlements in credit pricing?

Entitlements define what a customer is allowed to consume based on their plan and current credit state, and they're the enforcement layer that applies those limits during a request.

For credit pricing, an entitlement check runs in the request path and returns the data needed to decide whether the action can proceed:

  • Access status: Whether the request is allowed based on balance and plan
  • Usage limit: The credit cap for the current period, if one applies
  • Current usage: Derived from metered events attributed to the customer
  • Unlimited flag: Marks plans without a defined cap

Entitlements work differently from role-based access control, which answers whether a user has permission to access a feature. Entitlements check whether an AI agent or user has enough balance for the next request, and what should happen when that balance runs out mid-session.

Entitlement state comes from several sources that have to be resolved at runtime, before the request proceeds. The active plan sets the base, and inherited parent plans, add-ons, active trials, and promotional grants adjust it. When those sources conflict, the most generous value wins.

That resolution has to happen fast enough that it adds no perceptible latency to every API call. That's why it belongs in a dedicated entitlements layer that stays consistent across plans, customers, and requests as pricing changes.

Where in-house credit pricing systems break

In-house credit pricing systems usually break when several parts of the system try to update and enforce the same balance at the same time.

Most teams start in-house for good reasons. The first version is a table, a decrement, and a check, and it works fine at launch. The problems start when usage becomes shared, concurrent, and tied to changing plan state.

As the system scales, the pressure shows up in specific places:

  • Concurrent usage: Several users drawing from a shared wallet at once can create race conditions, which call for atomic debits against a ledger to prevent double-spend. That’s the failure mode from the top of the article, where there are three parallel agent sessions, one balance, and no atomic debit.
  • Retried usage events: A network blip makes a client resend the same event. Without an idempotency key on every usage report, the retry burns credits twice.
  • Long-running AI jobs: An agent task's final cost isn't known when it starts, so the system has to decide whether to check the balance up front, settle at the end, or both.
  • State consistency: Cached entitlement data goes stale when plans change or credits are granted mid-session, so enforcement decisions run on old state.
  • Promotional credit tracking: When paid and promotional credits sit together, the system has to tell them apart for accounting and reporting.
  • Mid-cycle changes: Upgrades bring new credit grants, updated limits, and burn-order changes that need to take effect immediately.
  • Legacy plan support: Customers on older plans still expect their original credit terms, which adds weight as the catalog evolves.
  • Auditability: Finance needs an append-only ledger so every credit grant and debit traces back to a specific event.

By this stage, the system is coordinating state across requests, users, and plans, and the single balance column is the least of it.

At enterprise scale, that coordination has to hold across millions of checks per day without becoming a bottleneck. That's where most in-house implementations hit their limit, and the simple credits table turns into a system someone owns full-time.

Getting credit pricing right under real load

Credit pricing at scale depends on keeping enforcement, the ledger, and billing in separate layers so each one holds up under load.

When those concerns share a layer, concurrent sessions produce race conditions, pricing changes need deploys, and the first enterprise audit request exposes holes in the transaction record.

Stigg is the usage runtime for AI products. Entitlements, credits, usage limits, and spend governance are enforced synchronously in the request path, before compute is consumed, and Stigg works alongside the billing system you already have.

With Stigg, engineering teams can:

  • Check balances in the request path with getCreditEntitlement(), with p99 latency under 10ms through the Sidecar
  • Run the Sidecar next to your application, with an in-memory cache by default (Redis persistence is optional). Cache misses fetch from the Edge API in about 100ms, and a configurable timeout returns your configured defaults so upstream latency doesn't cascade
    • Node.js applications skip the Sidecar, and the Node SDK provides the same low-latency checks and local caching in-process
  • Record every grant and deduction on an append-only, double-entry ledger with expiry, cost basis, category, and priority per grant
  • Configure burn order, hard or soft limits, and auto-recharge per plan without code changes
  • Weight each feature or model with its own credit consumption formula
  • Keep metering inside your own VPC with BYOC deployment at more than 1M events per second
  • Sync credit purchases and top-ups with Stripe or Zuora while enforcement stays independent of the payment layer

Miro's team spent three months with three engineers on an in-house attempt before switching. With Stigg, they shipped AI credits in under six weeks. Miro estimates the switch saved 5,000 engineering hours, and its pricing changes now move six times faster.

If your credits table has started needing its own on-call rotation, the issue is probably architectural. Talk to a human about your stack, or start with the credits docs and see how the pieces fit.

Frequently Asked Questions

1. What is the formula for calculating credit cost?

The formula for calculating credit cost is credits per action = cost per action ÷ (1 − target margin) ÷ price of one credit. Cost per action covers model tokens, compute, and any third-party calls. For example, a $0.02 action at a 75% margin with $0.01 credits costs 8 credits.

2. How is credit pricing different from usage-based pricing?

Credit pricing is a prepaid form of usage-based pricing. Customers buy credits before they use the product, and the system deducts from that balance in real time. Classic usage-based billing records consumption first and invoices it at the end of the period.

3. How do you prevent double-spending in a credit system?

You prevent double-spending with atomic debits on an append-only ledger and an idempotency key on every usage event. Each debit runs as a single transaction, so concurrent requests can't consume the same credits twice, and retried events only count once.

4. Can credit pricing work with subscription billing?

Yes, credit pricing works with subscription billing by issuing credits on a recurring cycle. The subscription defines the grant, and the credit system enforces usage against that balance.

5. How do you audit credit usage for finance?

You audit credit usage through an append-only ledger that records every grant, debit, expiry, and void. The balance is derived from those records, which lets finance reconcile usage, deferred revenue, and breakage against what customers paid.

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.