Per-API-key usage budgets and threshold alerts
Every API key’s analytics drawer now carries a “Usage budget” card. Set a monthly request ceiling for that key and Devotel Orbit grades the key’s live 30-day usage against it — a caution badge once consumption crosses 80% of the ceiling, a “budget exceeded” badge once it reaches 100% — with a progress bar and “N of M remaining” headroom text. A runaway integration, or a leaked key, shows as a warning inside the dashboard instead of on the invoice. This works alongside the per-key rate limits and monthly request quotas documented in Per-API-key usage limits and spend alerts: that guide covers the org-wide and per-key hard limits; this one covers the lightweight per-operator dashboard alert you can set on any key without touching the org default.When to use a budget
Use it as an early-warning tripwire inside the dashboard — a budget does not block traffic (the hard quota in the usage-limits guide does that). Set it on keys where you want a badge at a known percentage of expected usage (a staging environment, a partner integration, a single high-volume sender).Set a per-key budget
In the dashboard, open Settings → API keys and expand a key’s row. In the drawer’s “Usage budget” card:- Type a positive whole monthly request count (for example
100000). - Clear the field to remove the budget.
warning once its 30-day usage reaches 80% of the budget, and exceeded once it reaches the budget itself, and renders the remaining headroom as “N of M remaining”. Spend data that is still loading shows an indeterminate progress instead of a fabricated 0%.
Risk: browser-local storage
Because the budget lives in the browser, three failure modes matter for teams:- Threshold drift across the team. Two operators looking at the same key can have — and usually do have — different warning thresholds. Do not assume a colleague sees the same badge you do; they see only the budget set in their own browser.
- The budget does not survive the browser. Switching browser profiles, clearing site storage, or the dashboard being denied local storage (private/incognito window, storage-sandboxed iframe) wipes or disables the budget; the dashboard then treats the key as unbudgeted.
- A badge cannot fire for someone else’s session. When another operator’s browser session drives the traffic, your badge stays silent — the threshold in your browser does not travel.
Headroom maths
The badge tiers are computed from the same 30-day totals the API analytics page shows. Worked example — a key with usage of81234 against a budget of 100000:
- 30-day usage:
81234 usage_percent:81- Badge:
warning(at least 80% consumed) - Headroom text:
18,766 of 100,000 remaining
exceeded; the percentage is floored, so 79.9% still reports 79 and stays below the warning band.
What happens at the ceiling
The badge flips to “Budget exceeded” but traffic is not blocked — clear the budget to silence it, or raise it if the ceiling was genuinely too tight. If you want blocking, set the monthly request quota documented in Per-API-key usage limits and spend alerts.Edge behaviour
- A blank input clears the budget; a non-positive entry (zero, negative, or non-numeric) is rejected at input time.
- Fractional budgets round to whole requests (the 30-day count is a whole number, so a fractional ceiling would never map cleanly to a percentage).
- If browser storage is unavailable (private/incognito mode, a storage-sandboxed iframe), the budget still applies for the page lifetime but will not survive a reload; the dashboard falls back to treating it as unset.
- A key with no configured budget never emits a warning/exceeded badge — budgets are strictly opt-in.