All posts

AI usage limits per customer: how to meter and cap LLM spend in an AI SaaS product

One heavy tenant can erase the margin on a flat-priced AI feature. How to meter LLM usage per customer, set limits at the right layer, and choose a pricing shape that survives power users.

CodeKrypt 5 min read

You launch an AI feature on a flat plan, and most customers use it modestly. Then one account automates it, sends it long documents all day, and your model bill for that single customer is larger than their subscription. AI usage limits per customer are how you prevent that, and they have to exist in your own code, because your provider does not enforce them per tenant. This post covers what to meter, where to put limits, and which pricing shape survives power users.

Why don't provider limits protect you from one heavy customer?

Because they are set for you, not for your customers. Anthropic's rate limits documentation says limits are enforced at the organization level, with optional workspace-level limits you can configure. Spend limits work the same way: there is a monthly cap for the whole organization, and the docs say that on reaching it, usage pauses until the first of the next month.

The failure modes are worth knowing exactly:

LimitWhat your product sees (per Anthropic's docs)What it means for you
Rate limit (requests or tokens per minute)HTTP 429, usually with a retry-after headerBack off and retry; every tenant shares the same budget
Monthly spend cap reachedHTTP 429 with error code enforced_spend_limit_reached, no retry-afterRetries fail until the next month; all tenants are affected
A spend limit you set yourselfHTTP 400 invalid_request_errorLooks like a bad request, not a capacity problem

So a single tenant can exhaust a shared limit and take every other customer's AI feature down with it. Treating the second row differently from the first matters: retrying a spend-cap 429 is wasted effort. If you also want a second provider as a safety net, see LLM API fallback for outages and rate limits.

What should you meter?

Meter cost, not requests. The same feature call can differ widely in token use depending on the document or conversation behind it, so a request count tells you little about margin.

For every model call, record at minimum:

Store the usage events in your own database, not only in the provider console. The console tells you what you spent; only your own events tell you which customer spent it. Compute cost from token counts and a versioned price table, so a price change does not rewrite history. Our posts on prompt caching and observability cost cover why cached tokens and trace storage deserve their own line items.

Where should limits live?

In layers, from least to most severe:

  1. Per-request guards. A maximum input size and a max_tokens ceiling per feature. This bounds the worst single call.
  2. Per-tenant rate limits. A token bucket or sliding window per tenant, enforced before you call the provider. This stops one tenant from consuming the shared per-minute budget.
  3. Per-tenant period quotas. A monthly allowance in cost or credits, checked against your usage events.
  4. A global circuit breaker. An alert and a hard stop for the whole product, set below your provider spend cap, so you decide what degrades rather than the provider.
  5. Provider-side workspaces. Anthropic lets you set spend and rate limits per workspace. That is a coarse tool (for example one workspace per environment or per large account), not a substitute for per-tenant accounting inside your app.

Decide in advance what hitting a limit does. Options are blocking with a clear message, downgrading to a cheaper model, queueing for batch processing, or allowing overage at a price. A silent failure is the worst choice, because customers read it as a bug.

Which pricing shape survives power users?

Limits control cost; pricing decides whether the cost is acceptable. A payments vendor's worked example shows the shape of the problem. These are the article's illustrative assumptions (about $0.03 per request plus $0.05 per active user per month), not benchmarks:

PlanAverage user (50 requests/month)Power user (500 requests/month)
$5 flat, unlimited$1.55 cost, 69% margin$15.05 cost, roughly -200% margin
$5 plus $0.10 per request over 30$7 revenue, 78% margin$52 revenue, 71% margin

Your numbers will differ with your model mix, but the pattern holds: an average hides the tail, and unlimited flat pricing makes you pay for your most engaged customers. The usual shapes are:

ModelGood whenWatch out for
Flat, with a hard capUsage is predictable and you want simple billingCustomers hit the cap and feel punished
CreditsOperations vary a lot in costCustomers must track a balance; unused credits cause disputes
Base plus overageYou want predictable revenue and protection from the tailBill shock if overage is not visible in the product
Outcome-basedA result is easy to define and verifyMeasuring the outcome; disagreements about what counts

Whichever you pick, show usage inside the product. Customers who can see a meter fill up accept limits far more readily than customers who hit a wall. For deciding which AI features deserve a price at all, see build vs buy for AI features and what an AI MVP actually costs.

How do you roll this out without breaking existing customers?

  1. Instrument first. Ship metering with no limits and watch real per-tenant cost for a few weeks. You need the distribution before you can set a quota.
  2. Look at the tail. Find the top few tenants by cost and compare with what they pay. That tells you whether you have a pricing problem or a few outliers.
  3. Add soft limits. Warnings and in-product meters before any blocking.
  4. Enforce, with an escape hatch. Let support raise a tenant's limit quickly, and log every override.
  5. Alert on trends. A tenant whose daily cost doubles is worth a look before the invoice.

Pair this with cost levers on your side: our guide to reducing LLM API costs covers caching, batching and routing, which lower the cost per unit you are metering.

What to do next

Start with the usage event table: tenant, feature, model, token counts, cost. A few weeks of real traffic will show whether you have a limits problem, a pricing problem, or neither. Then add per-tenant rate limits and a circuit breaker below your provider spend cap, and choose a pricing shape that charges for the tail instead of absorbing it.

If you are building or reworking an AI product and want per-tenant metering and limits designed in from the start, our AI SaaS work covers it. To talk it through, send us a brief.

CodeKrypt avatar

CodeKrypt

Drafted by CodeKrypt's AI writing pipeline, built and maintained by our engineers, under fixed rules on sources and claims. How we write

Frequently asked questions

Why can't I just rely on my LLM provider's rate limits?
Provider limits apply to your whole organisation, not to each of your customers. Anthropic's rate limit docs state that limits are enforced at the organization level, with optional workspace limits you configure. One heavy customer can use up the shared limit or the shared spend cap, and every other customer feels it.
What happens when I hit my provider's monthly spend cap?
According to Anthropic's docs, once an organization reaches its tier's spend cap, API usage pauses until 00:00 UTC on the first day of the next month and requests return HTTP 429 with no retry-after header, so automatic retries keep failing. A spend limit you set yourself returns HTTP 400 instead. Your product needs to handle both.
Is flat pricing for AI features a bad idea?
Not always, but it is risky when usage per customer varies widely. In one illustrative worked example from a payments vendor, a $5 flat plan earned a 69% margin on an average user and lost roughly 200% on a power user. Flat pricing works best when you cap usage, or when variation between customers is small.
What should I meter?
Meter what you pay for: input tokens, output tokens and cached tokens per request, tagged with tenant, feature and model. Request counts alone hide the fact that two structurally identical calls can cost very different amounts.

Related reading

Chat on WhatsApp