Skip to content

Meter and cap monthly token quotas per tenant

Track exact prompt and completion token usage per workspace, warn at 80%, and enforce clean monthly caps without building Stripe metering pipelines.

Copy the prompt and paste it into the AI assistant you already use.

Steps to launch accurate tenant token metering

  1. 01

    Normalize credit weights by model

    Weight expensive frontier model tokens higher than compact model tokens in unified workspace credits.

  2. 02

    Expose current usage headers

    Return monthly remaining credits on responses or query a lightweight usage summary endpoint.

  3. 03

    Trigger proactive warning webhooks

    Notify workspaces at 75% and 90% usage before sudden cutoff breaks automated pipelines.

  4. 04

    Align reset dates to billing

    Configure quota reset cycles on calendar first-of-month or each tenant's anniversary day.

How it works in practice

Workspace Quota State

Workspace: ws_delta (Pro Plan: 500,000 credits/mo) Used prior to call: 499,600 Incoming request cost: 850 credits

Quota Enforcement & Usage Response

Allowed or Blocked per policy: - Strict Cap -> 429 Quota Exceeded {"used":499600,"limit":500000,"reset_at":"2026-12-01T00:00:00Z"} - Usage Webhook Fired -> billing.quota_reached (ws_delta)

SaaS margin protection runs continuously at the API edge without building custom Redis counters or token-aggregation cron jobs.

Common questions

How are different model prices handled inside one token quota?

You can meter raw tokens or define normalized credit multipliers so one frontier token counts fairly relative to compact models.

Can I render a live AI usage bar in our app settings page?

Yes. Query the tenant usage endpoint or read response quota headers to render real-time progress meters.

What happens when a customer buys an extra add-on pack?

Increment that workspace's quota ceiling programmatically via API and blocked calls resume immediately.