Quotas & tier enforcement
Tier-based token budgets that protect your bottom line.
Give every plan tier a monthly dollar budget, a token rate limit and a clear rule for what happens at the edge: warn at 80%, then downgrade or block at 100%. Enforced in the gateway, so no code path can skip it.
POST https://api.yourapp.com/hooks/palmsouq
X-PalmSouq-Signature: t=1794129262,v1=5b1f...
{
"type": "quota.warning",
"tenant": "northwind-ops",
"tier": "pro",
"period": "2026-11",
"budget_usd": 35.00,
"spent_usd": 28.14,
"used_pct": 80.4,
"next_action_at_100": "downgrade",
"downgrade_to": "claude-haiku-4.5",
"topup_url": "https://app.yourapp.com/billing/topup"
}Quota editor
Configure a tier, then drag usage to see what happens.
Switch tiers, move the sliders, and preview a tenant crossing the soft cap and the hard cap. The policy below the preview is exactly what gets published to the edge.
At 100% of budget
Requests still served. Webhook quota.warning sent once to your app so you can show an upgrade prompt or email the account owner.
quotas:
pro:
monthly_usd_cap: 35
soft_cap_pct: 80
tokens_per_minute: 150000
on_hard_cap: downgrade
downgrade_to: claude-haiku-4.5Soft vs hard caps
Warn first. Then degrade or stop, on your terms.
| Soft cap (default 80%) | Hard cap (100%) | |
|---|---|---|
| Requests | Served normally | Blocked with 429, or rerouted to a fallback model |
| Webhook | quota.warning, sent once per period | quota.exhausted, plus quota.blocked or quota.downgraded |
| User experience | Your app can show an upgrade banner | Fallback keeps the product working; block shows your message |
| Reset | Start of next billing period | Next period, a top-up, or a manual override in the console |
| Typical use | Nudge upgrades, alert account managers | Protect margin on flat-rate plans |
Worked example
A support SaaS has 500 customers at $99/month ($49,500 MRR). 25 power users each consume $400/month of model spend. Capping them at $35 recovers 25 × ($400 - $35) = $9,125 a month, before any of them buy a top-up.
Rolling-window rate limits
One tenant's burst should not be everyone's outage.
Your provider gives your organisation one pool of tokens per minute. PALM SOUQ splits it with sliding-window TPM and RPM limits per tenant, so a single customer's batch job cannot starve the rest.
Limits are sliding windows, not fixed buckets, so a tenant cannot double its rate by straddling a minute boundary. Concurrent-request bounds cap how many streams a tenant holds open at once.
- globex-ai28%
- wayne-finance22%
- acme-legalat limit · 429 rate_limited15%
- stark-sales12%
- 412 other tenants13%
- headroom10%
Self-serve top-ups
Let customers buy more instead of hitting a wall.
- 01
Soft cap
quota.warning arrives with a topup_url for that tenant.
- 02
Prompt
Your app shows a banner or sends an email with the link.
- 03
Purchase
The customer buys a token pack in Stripe, Orb or Lago.
- 04
Applied
Billing sync raises the allowance; the next request uses it.
“Falling back from Sonnet to Haiku at 90% of budget kept the experience intact without blowing our monthly API cap.”
Quota questions
What units can a quota use?
Dollars per month, tokens per day, requests per minute, tokens per minute and concurrent in-flight requests. You can combine them: a Pro tenant might have a $35 monthly budget, 150k TPM and at most 8 concurrent streams.
Where are counters kept, and are they exact?
Counters live in edge memory and are reconciled across PoPs within a few hundred milliseconds. Dollar budgets are exact once each response's usage is priced; for the few in-flight requests at the moment a cap is crossed, PALM SOUQ uses the request's max_tokens to reserve budget so a tenant cannot overshoot by more than one call.
Can a customer raise their own limit?
Yes. Point the topup_url in the webhook at your billing page. When your billing system confirms a purchase, call the PALM SOUQ quota API (or let the Stripe, Orb or Lago sync do it) and the new allowance applies on the next request.
How do per-tenant TPM limits relate to my provider's rate limits?
Your provider limits apply to your whole organisation. PALM SOUQ enforces a share of that pool per tenant, so one tenant's burst cannot exhaust capacity for everyone else. Requests over the tenant limit get a 429 from PALM SOUQ with X-PalmSouq-Reason: rate_limited and a Retry-After header.
Give every tier a budget it cannot exceed.
Route your agent traffic through PALM SOUQ in 2 minutes. Change one base URL, pass a tenant header, and every token is attributed and governed.
14-day free production trial · 100k requests included · no card required