
Multi-Tenant Architecture: 3 Models & 8 Best Practices
Learn how multi-tenant architecture works, compare database isolation models, and explore six components & eight best practices for shared infrastructure.
API monetization explained: 8 pricing models, benefits, setup steps, prepaid vs. postpaid billing, KPIs, and the enforcement layer AI APIs need.
A customer's integration enters a retry loop on a Friday night. By Monday, it has made millions of calls, your metering recorded every one, and the invoice is accurate to the cent.
The customer disputes it anyway, and nothing in your stack was in a position to stop the loop while it ran.
That's a common way API pricing breaks in production. Metering and invoicing get built first because finance needs them, while the layer that decides whether the next request is allowed (given the customer's plan, credit balance, and limits) gets pushed to v2.
Stigg runs entitlement and credit checks in the request path for AI products, so this guide comes at API monetization from the enforcement side.
You'll get the eight pricing models, their benefits, a five-step setup, prepaid vs. postpaid billing, the KPIs worth tracking, and what enforcement needs once every request costs something different.
API monetization is the practice of earning revenue from an API, either by charging for access, usage, or outcomes (direct monetization) or by using the API to grow a product that makes money some other way (indirect monetization).
Usage-priced APIs are everywhere: Stripe's API charges per transaction, Twilio bills per message and per minute, and AI model providers price per token.
It's also a big business, since Postman's 2025 State of the API report found that 65% of organizations now generate revenue from their APIs.
The thing that separates API monetization from SaaS seat pricing is marginal cost. A seat costs roughly the same to serve whether the user logs in once a week or all day, while an API call that runs a model carries a real compute cost that moves with volume and model choice.
That makes API monetization a systems design problem as much as a pricing decision, because the price only holds if the system can measure, attribute, and limit what each customer consumes.
The eight common API monetization models are pay-per-use, tiered, subscription with overage, freemium, credit-based, outcome-based, revenue share, and indirect monetization.
Most production APIs combine two or three of them, and each one asks something different of your infrastructure.
| Model | How the customer pays | What the system has to do |
|---|---|---|
| Pay-per-use | A price per API call | Meter every request per customer and endpoint |
| Tiered | Lower rates at higher volume thresholds | Apply the right tier, including custom contracts |
| Subscription with overage | Flat fee plus charges past an allowance | Track plan state and usage on every call |
| Freemium | Free tier, paid plans for more | Enforce the free cap and show an upgrade path |
| Credit-based | Prepaid credits drawn down per request | Run a credit ledger that's safe under concurrency |
| Outcome-based | A price per completed result | Attribute a result across multi-step workflows |
| Revenue share | A split of revenue the API drives | Attribute referrals and transactions to partners |
| Indirect | Nothing; the API grows another product | Track usage and cap cost without an invoice |
The trade-offs between API monetization models mostly come down to how predictable your costs are and who carries the risk when usage spikes.
Every call carries a price, such as $0.001 per search query. The hard part is attribution, since each request has to land on the right customer account and endpoint before the response goes out.
At 10 million requests a month across 500 customers, the metering layer also has to absorb that write volume without dropping events or slowing down the request path.
Rates change at volume thresholds, so the first 100,000 calls cost one price and the next 500,000 cost less. The rating engine has to identify which tier applies, which gets messy when enterprise customers negotiate custom tiers or contracts renew on anniversary dates.
A flat fee covers usage up to an allowance, and anything past it is billed per unit. A developer plan at $99 a month might include 500,000 tokens, with usage beyond that charged per token.
On every request, the system needs to know whether the customer is still inside the allowance, which means reading subscription state and the running usage total before the call is authorized.
A free tier gives developers enough access to build and test, and paid plans add higher limits, more endpoints, or richer data. Freemium lives or dies on the limit check: the free tier needs a hard cap enforced on the request itself, plus an upgrade prompt the developer sees when they hit it.
Customers prepay for credits that are deducted as they consume. One request to a large model might cost 10 credits while a multi-call document workflow burns 35, so AI credits track the underlying compute closely.
A decrementing balance field won't hold up here. Two concurrent requests against the same wallet can both read the pre-deduction balance and both commit, which pushes the balance negative without tripping a hard limit, which is why credits need an append-only ledger with real-time deductions.
Customers pay per completed result, such as a reviewed document, while the workflow underneath may run dozens of model calls and tool executions. The system has to track when the workflow started, which steps finished, whether the outcome was met, and which account to charge.
The provider and the developer split the revenue the API helps generate. Affiliate APIs pay developers a commission on referred sales, and ad-supported APIs pass part of their ad revenue to the apps that display it.
The infrastructure job is attribution across transactions you only partly control.
The API is free and earns its keep by making a core product more useful or harder to leave. Integration APIs that connect a SaaS product to the rest of a customer's stack are the classic case.
There's no invoice to compute, but you still need usage data and limits, because a free API with no controls is an open-ended cost.
The main benefits of API monetization are a new revenue line, revenue that grows with usage, room for premium tiers, and clearer data on what customers depend on.
One caveat worth stating plainly is that revenue that scales with use also means cost that scales with use, and for AI APIs the cost side can move faster than the invoice. That's why limits have to be enforced on the request, before the compute runs.
To monetize an API, measure how it's used, work out which endpoints deliver the most value, test what customers will pay, pick a model per use case, and then wire up the gateway, metering, entitlements, and billing that enforce it.
Instrument every endpoint before you set a price. You want calls per customer, per endpoint, and per time window, plus the cost to serve each call (compute, third-party fees, and model tokens).
Without the cost column, a popular endpoint can look like your best product while it loses money on every request.
A lookup that returns a cached record and an endpoint that runs a multi-step agent workflow shouldn't share a price, and customers usually understand why. Group endpoints by the value they deliver and what they cost to serve, which gives you the units you'll eventually meter.
Talk to the developers already using the API, look at what they'd use as a replacement, and run small pricing tests with design partners before you publish a rate card. You can change a pricing page next week, while an annual contract signed at the wrong price sticks around for a year.
Different customers often want different models on the same API. Self-serve developers tend to prefer a free tier and pay-as-you-go, while enterprise buyers want committed spend, prepaid credits, and predictable invoices.
Pick the model per segment and keep the underlying meters shared, so you aren't running two pricing systems that drift apart.
Most of the engineering work lands in this step. A typical stack has four layers:
Teams usually build the first and last layers on day one and discover they need the middle two after the first big customer blows through a limit.
API monetization turns raw usage events into billable amounts in four sequential steps: event emission, metering, rating, and invoicing. Knowing where each one sits tells you which layer to build where.
Each chargeable action produces a record with the customer identifier, the action type, the quantity consumed, and a timestamp. A single model request might emit one event with a token count, while a multi-step agent workflow emits several, each attributed back to the originating session.
Raw events aggregate into billable quantities over defined periods (the core of usage metering), with unit definitions and aggregation rules applied the same way for every customer. Billing-cycle alignment matters here, especially when contracts start mid-month or renew on anniversary dates.
Pricing rules turn metered quantities into dollar amounts. Tier logic, volume discounts, contract rates, and per-model pricing all resolve here, so a customer who negotiated $0.0008 per token above 10 million monthly tokens gets a different calculation than the standard rate card.
Rated amounts become invoice line items, and payment collects through a processor. Stripe and other billing providers handle this layer well.
Invoicing runs on settled data, after usage has already happened. It can't decide whether a request should be allowed before the compute runs, and that decision depends a lot on whether you bill before or after usage.
Prepaid billing collects money before usage happens, usually as credits or a committed balance, while postpaid billing meters usage during the period and invoices it afterward.
| Dimension | Prepaid | Postpaid |
|---|---|---|
| When cash arrives | Before usage | After the billing period |
| Credit risk | Low, the balance is already funded | Higher, usage is billed after the fact |
| Developer friction | Has to buy credits to start | Can start with a card on file |
| What enforcement needs | Real-time balance checks and depletion rules | Spend caps and overage alerts |
| Common in | AI APIs, credit packs, top-ups | Usage-based APIs, enterprise contracts |
Prepaid moves the hard problem from collections to enforcement. Once a balance stands between a request and the model, the system checks it on every call and decides what happens at zero: deny the request (a hard limit) or let the balance dip negative and settle later (a soft limit).
Postpaid has the opposite problem, since nothing stops usage by default and a runaway integration shows up as a disputed bill.
Many AI API teams land on a hybrid of prepaid credits for self-serve and postpaid commitments with overage for enterprise, the setup behind most usage-based API billing architectures.
Packaging decides what's inside each plan: which endpoints, how many calls or credits, which rate limits, and which add-ons. A common shape is a free tier with a hard cap, two or three paid tiers with included allowances and overage, and an enterprise plan with negotiated limits.
Packaging changes and pricing-model changes usually have different owners. Raising a limit from 10,000 to 25,000 calls is a catalog edit a product team can make without a deploy, as long as limits live in configuration.
Switching from subscriptions to credits, or adding a hybrid model, touches metering, enforcement, and billing at once, so engineering tends to keep that one.
Once an API is monetized, a short list of KPIs tells you whether the model is working:
AI APIs break traditional monetization setups because token counts, agent fan-out, and per-model costs make each request a different price, and standard billing infrastructure wasn't built for that.
The same prompt can produce 50 tokens or 3,000, depending on the task, the model, and generation behavior. Cost per request only becomes known after the response is generated, so the billing layer can't pre-authorize a fixed amount. The infrastructure has to:
One user action can trigger dozens or hundreds of downstream model calls, tool invocations, and retrieval steps. A research agent that queries three tools, runs two summarization passes, and writes a response might produce 15 billable events from one click. The infrastructure has to:
A simple lookup and a deep research workflow can differ in cost by two orders of magnitude. Average cost per request tells you very little about cost per session, which makes fixed-rate pricing unreliable for protecting margin.
The requirement is per-model pricing with real-time cost tracking, so the system knows at any point in a session how much has been consumed and whether the next request should run.
Enterprise customers buying AI APIs also need budget controls that mirror their internal structure, and these requests tend to show up in sales cycles before the product supports them:
Traditional API billing systems were built around predictable request economics. AI APIs generate highly variable costs, so they need a control layer that can enforce budgets, credits, and entitlements while requests are running.
Above billing sits an enforcement layer that decides whether the next request should proceed, in the request path, before the model is called and before compute is spent.
Metering tells you what happened. Enforcement decides what's allowed to happen next.
| Enforcement requirement | What breaks without it |
|---|---|
| Low-latency balance checks | Enforcement gets disabled under load |
| Ledger reservation and settlement | Concurrent sessions overdraw the same balance |
| Multi-type credit precedence | Promotional credits deplete in the wrong order |
| Org-level tenancy | Budgets can't be enforced per team or agent |
| Self-serve governance | Admins file support tickets to change limits |
Enforcement that adds noticeable latency to every API call tends to get switched off under production load, which removes the protection entirely. In practice, most checks need to resolve from a local cache in sub-millisecond time.
Stigg’s entitlement checks run at a p99 under 10 ms with cache misses still fast and a predictable fallback when the upstream is slow.
Stigg's Sidecar runs as a container next to your application and serves entitlement checks from an in-memory cache by default, or from a Redis-backed persistent cache when cached data needs to survive restarts.
On a cache miss, the Sidecar fetches from Stigg’s Edge API, where typical cache-miss latency is in the low hundreds of milliseconds.
If that call does not return within the configurable timeout (10 seconds by default), the Sidecar fails closed to the static defaults you set, so a slow upstream never leaves a request undecided.
Concurrent sessions deducting from the same balance need reservation and settlement patterns. Without them, two sessions can drain the same balance at once because both read the pre-deduction state before either commits, and a single balance column can't handle that at any meaningful request volume.
Retries cause the mirror-image problem. A request retried after a timeout shouldn't be charged twice, which is why usage reports need idempotency guarantees so a duplicate event is only counted once.
AI API products regularly carry more than one credit type at the same time:
Each grant needs its own expiry, cost basis, category (paid or promotional), and burn priority, and the ledger has to treat precedence, expiry ordering, and immutable audit records as first-class operations from the start.
A per-customer credit balance stops being enough once one organization needs separate budgets across teams. Enterprise allocation needs limits at every level (organization, department, team, user, and individual agent).
Each check should evaluate the whole chain, so a request passes only when every budget above it allows it.
This is the failure mode from the top of this article. With a per-agent cap in place, the looping integration hits its own ceiling long before it can drain the organization's budget. Per-agent caps are one part of managing AI usage with limits, allocations, and budgets.
Enterprise customers expect to configure their own limits without filing a support ticket, and that expectation affects whether deals close. Hard caps, team budgets, and real-time usage visibility live in the enforcement layer, and customer admins want to manage them directly.
| Dimension | Rate limiting | Entitlements |
|---|---|---|
| What it controls | Request velocity | Commercial access |
| Data dependency | Request counters per time window | Credit balances, plan state, org hierarchy |
| Update frequency | Per request | Per billing event, plan change, or admin action |
| Failure mode | Blocks all requests above the threshold | Allows or denies based on commercial state |
| Where it lives | API gateway or middleware | Enforcement layer above billing |
| Example | Max 100 requests per minute | Free plan capped at 10,000 requests per month |
Rate limiting and entitlements solve different problems, so they belong in separate components. Rate limiting controls request velocity, which means it caps how many requests a customer sends per second or minute and protects your infrastructure from overload.
A rate limiter has no idea whether the customer has credit left or whether the request falls inside their contract.
Entitlements are commercial allowances that define what a customer can access and how much they can use. A customer's effective entitlements combine their active plan, any base plan it inherits from, add-ons, trials, and promotional grants, and the most generous value wins on conflict.
Combining and evaluating those sources at runtime is the job of an entitlement management system.
You need both. Conflating them produces systems where a rate-limit change accidentally affects commercial access, or where an entitlement check gets skipped because it was wired into the wrong layer.
Building this infrastructure in-house is the right call under the right conditions. One pricing model, predictable usage, modest volume, and no enterprise governance requirements can all run on a metering table, a rating function, and a Stripe integration, and plenty of teams ship exactly that.
The conditions that outgrow it are specific:
These conditions don't always arrive together, but when they do, the work changes from building the system to keeping it running. A team of three to five engineers on pricing and usage infrastructure is a permanent, seven-figure line item that produces no differentiated product value.
Miro's experience shows what the buy side can look like: the team launched AI pricing in under six weeks, made pricing and packaging changes 6× faster, saved 5,000 engineering hours, and migrated tens of millions of existing subscriptions with no custom scripts and no customer-facing disruption.
Every API monetization model eventually meets production traffic. Whether it holds up against a looping integration, a burst of agent calls, or an enterprise buyer asking for per-team budgets depends on the layer that runs in the request path.
Most teams already have the billing half covered with Stripe or Zuora. The missing piece is usually a runtime that checks plan, balance, and budget before the call goes through.
Stigg is that runtime. It sits between your product and your billing stack, works alongside Stripe or Zuora, and makes the allow-or-deny decision while the request is in flight.
You adopt it through the surface that fits, whether that’s an SDK, the Sidecar container, the CLI, or the MCP server for agent-driven workflows.
With Stigg, engineering teams can:
With that layer in place, the Friday-night retry loop ends as a denied request and an alert, and Monday starts with a normal invoice.
If you're mapping out how this fits your stack, talk to a human, or start with the AI quickstart in the docs.
API monetization is the process of generating revenue from an API by charging for access, usage, or outcomes, or by using the API to grow another product. Common models include pay-per-use, subscription with overage, freemium, and credit-based pricing.
You monetize an API by measuring usage, pricing endpoints by the value they deliver, and enforcing the model you choose. That means instrumenting endpoints, testing willingness to pay, matching a model to each segment, and setting up a gateway, metering, entitlements, and billing.
The most common API monetization models are pay-per-use, tiered, subscription with overage, freemium, credit-based, outcome-based, revenue share, and indirect monetization. AI API products often use credits because token and compute costs vary by request.
The difference between API rate limiting and API entitlements is that rate limiting controls request velocity, while entitlements control commercial access. Rate limiting protects infrastructure, and entitlements enforce what a customer can use based on plan, credits, or budgets.
AI APIs change API monetization requirements because request costs vary widely by model, token count, and agent workflow. That makes real-time usage controls, credit enforcement, and event-level attribution more important than post-usage invoicing alone.
Credit-based API monetization requires a credit ledger, real-time balance checks, immutable transaction records, and support for multiple credit types. A simple balance field can break under concurrent usage or when credits have different scopes, priorities, or expiration dates.