Claude API Usage Quota Per Customer: A Practical Guide
If you're building a product on top of Claude and have multiple customers or tenants, you need a way to cap how much each one can use. Anthropic's API has account-level rate limits (requests per minute, tokens per minute), but it does not have a native concept of "customer A gets 100,000 tokens/month, customer B gets 1,000,000." That logic lives in your application layer, and you have to build it yourself.
This article covers the practical patterns for implementing per-customer usage quotas on top of Claude: how to track consumption, where to enforce limits, how to handle overages, and how a managed layer like SubToAPI removes most of the bookkeeping.
Why Claude Doesn't Do This For You
Anthropic issues API keys per account, not per end-customer. If you're a SaaS reselling AI features, your customers aren't calling Anthropic directly — they're calling your backend, which calls Claude on their behalf. Anthropic has no visibility into "customer A" vs "customer B"; it only sees your single account's traffic.
That means:
- Rate limits (RPM/TPM) apply to your whole account, shared across every customer.
- There's no per-customer token counter in the Anthropic dashboard.
- If one customer sends a flood of requests, it can degrade service for everyone else on your account.
If you want per-customer quotas, metering, and isolation, you build it, or you use a layer that already has it built.
The Core Components of a Quota System
Regardless of how you implement it, a working per-customer quota system needs four pieces:
1. A usage counter per customer. Every Claude request returns usage.input_tokens and usage.output_tokens in the response. Store these against the customer ID that triggered the call.
2. A quota definition per customer or plan tier. This could be a flat token count, a request count, or a dollar budget derived from token pricing.
3. An enforcement check before the call goes out. Look up the customer's current usage, compare against their quota, and reject or throttle the request if they're over.
4. A reset or rollover policy. Monthly reset is the most common pattern, but some products use rolling 30-day windows or non-expiring credit pools.
A Minimal Implementation Pattern
Here's the shape of the logic in a typical backend, independent of any specific provider:
async function callClaudeForCustomer(customerId, messages) {
const usage = await db.getUsage(customerId);
const quota = await db.getQuota(customerId);
if (usage.tokensThisPeriod >= quota.tokenLimit) {
throw new Error("Quota exceeded for this billing period");
}
const response = await claude.messages.create({
model: "claude-sonnet-4-5",
max_tokens: 1024,
messages,
});
const totalTokens =
response.usage.input_tokens + response.usage.output_tokens;
await db.incrementUsage(customerId, totalTokens);
return response;
}
This works, but it has gaps: it's not atomic (two concurrent requests can both pass the check before either increments usage), it doesn't account for streaming responses where token counts arrive at the end, and it gives you no visibility beyond raw numbers in a database table.
Handling Concurrency and Race Conditions
If a customer can fire multiple requests at once, a simple read-then-write usage check will let them exceed quota before the counter catches up. Two common fixes:
- Pre-authorize a token budget per request. Estimate the maximum possible tokens (based on
max_tokens) and reserve that amount before the call, then reconcile with the actual usage after the response comes back. - Use a database transaction or atomic increment (e.g.,
UPDATE usage SET tokens = tokens + $1 WHERE customer_id = $2 AND tokens + $1 <= quotaand check the row count) so the check-and-increment happens in one step.
For streaming responses, you won't know the final token count until the stream closes, so pre-authorization matters more — otherwise a customer could open ten simultaneous long streams before any of them report usage.
Quota Tiers and Overage Policy
Most products map quotas to pricing tiers rather than giving every customer a custom number. A typical structure:
- Free tier: small fixed token allowance, hard cutoff, no overage.
- Paid tier: larger allowance, soft cutoff with either throttling (lower rate limit) or pay-as-you-go overage billed per token.
- Enterprise tier: custom allowance, usually negotiated, often with alerts rather than hard blocks.
Deciding whether to hard-block or soft-throttle at the quota boundary is a product decision, not a technical one. Hard blocks are simpler to implement and reason about; soft throttling (e.g., dropping a customer to 1 request per 10 seconds instead of cutting them off) tends to produce fewer support tickets.
Where SubToAPI Fits
If you don't want to build and maintain this tracking layer yourself, SubToAPI gives you per-key usage metadata on top of Claude access, so you can issue a distinct sub_live_... API key per customer or per project instead of funneling everyone through one shared Anthropic key. That gives you natural isolation: each key's usage is visible independently in your dashboard, which is most of the groundwork for per-customer quota tracking without writing your own metering database.
You still decide the quota logic and enforcement in your application (SubToAPI doesn't impose a quota policy for you), but because usage is already segmented by key, the counting half of the problem is solved. Combined with team seats for Solo (€9), Team (€19/seat), and Scale (€49/seat) plans, this also maps cleanly onto SaaS tiers: issue one key per paying customer, track their usage against your own limits, and upgrade or throttle based on what you see.
See the quickstart for key setup, docs/messages for the request/response shape including usage fields, and docs/streaming if your quota logic needs to handle streamed responses.
Checklist Before You Ship Quotas
- Decide token-based vs. request-based vs. dollar-based limits.
- Pick hard-block vs. soft-throttle behavior at the limit.
- Make usage increments atomic or pre-authorized to avoid race conditions.
- Handle streaming responses separately from single-shot responses.
- Expose current usage to customers (a
/usageendpoint or dashboard widget) so they're not surprised by a block. - Define your reset cadence (monthly, rolling, or credit-based) up front — changing it later is a support headache.
Questions
Does Anthropic offer built-in per-customer quotas? No. Anthropic's rate limits apply at the account level, not per end-customer. If you resell Claude access to multiple customers, you need to build quota tracking and enforcement yourself in your application layer.
What's the best unit to base a quota on — tokens, requests, or dollars? Tokens are the most accurate since Claude pricing is token-based, but dollar-based quotas (converted from token usage) are easier for customers to understand and map directly to your pricing tiers.
Can I avoid building a usage-tracking database from scratch? Yes — using per-customer API keys through a layer like SubToAPI gives you built-in usage metadata per key, so you get usage segmentation without building your own metering pipeline from zero. See /pricing for plan details.