Usage Snapshot
GET /v1/usage returns a real-time snapshot of your API key’s request and token counters for all active quota windows. This call does not consume quota — it is exempt from RPM, RPD, and monthly limits. Use it to implement pre-emptive backoff or display usage dashboards before hitting a limit.
Endpoint
Section titled “Endpoint”GET https://api.bve.me/v1/usageAuthorization: Bearer sk-bve-YOUR_KEYAuthentication
Section titled “Authentication”Standard API key auth. Include your key as a Bearer token in the Authorization header.
Request
Section titled “Request”No request body or query parameters.
Response
Section titled “Response”{ "object": "usage", "key_id": "3f7a2c1b-...", "key_name": "My Production Key", "status": "active", "expires_at": null, "is_expired": false, "last_used_at": "2026-05-27T09:00:00.000Z", "allowed_models": null, "this_minute": { "limit": 60, "used": 12, "remaining": 48, "resets_at": "2026-05-26T10:18:23.000Z" }, "today": { "limit": 10000, "used": 843, "remaining": 9157, "resets_at": "2026-05-27T00:00:00.000Z" }, "this_month": { "requests": { "limit": 5000, "used": 1247, "remaining": 3753, "resets_at": "2026-06-01T00:00:00.000Z" }, "tokens": { "limit": 500000, "used": 83421, "remaining": 416579, "resets_at": "2026-06-01T00:00:00.000Z" } }}Response fields
Section titled “Response fields”| Field | Type | Description |
|---|---|---|
object | "usage" | Object type discriminator |
key_id | string | UUID of the authenticated API key |
key_name | string | Display name of the key (set at creation) |
status | "active" | "suspended" | "revoked" | Current key status |
expires_at | ISO 8601 | null | Expiry timestamp, or null if the key never expires |
is_expired | boolean | true when expires_at is set and the timestamp is in the past; false otherwise. Lets clients detect expired-but-status=active keys without comparing date strings. |
last_used_at | ISO 8601 | null | Timestamp of the most recent authenticated request. Updated at most once per hour (hourly throttle in the auth middleware). null if the key has never been used. |
allowed_models | string[] | null | Stored model allow-list for this key. null or [] removes the per-key restriction; global policy and live availability still apply. New admin writes must use exact live Fuelix model IDs. Older keys may still return legacy wildcard prefixes until normalized. |
this_minute | object | Current RPM window |
this_minute.limit | number | Requests allowed per minute (rpm_limit) |
this_minute.used | number | Requests made in the current minute window |
this_minute.remaining | number | Requests left before RPM limit is hit (clamped at 0) |
this_minute.resets_at | ISO 8601 | UTC timestamp when the minute window resets |
today | object | Current RPD window |
today.limit | number | Requests allowed per day (rpd_limit) |
today.used | number | Requests made since last UTC midnight |
today.remaining | number | Requests left before RPD limit is hit (clamped at 0) |
today.resets_at | ISO 8601 | Next UTC midnight — when the day counter resets |
this_month.requests | object | Monthly request budget |
this_month.requests.limit | number | null | Monthly request cap (monthly_limit); null if not set |
this_month.requests.used | number | Requests made this calendar month |
this_month.requests.remaining | number | null | Requests left; null when no monthly_limit is configured |
this_month.requests.resets_at | ISO 8601 | First UTC second of next month |
this_month.tokens | object | Monthly token budget |
this_month.tokens.limit | number | null | Monthly token cap (monthly_token_limit); null if not set |
this_month.tokens.used | number | null | Tokens consumed this month; null when no monthly_token_limit is configured |
this_month.tokens.remaining | number | null | Tokens left; null when no monthly_token_limit is configured |
this_month.tokens.resets_at | ISO 8601 | First UTC second of next month |
Null fields
Section titled “Null fields”When a key has no monthly_limit configured, this_month.requests.limit and this_month.requests.remaining are null. When a key has no monthly_token_limit, all this_month.tokens fields except resets_at are null. The resets_at timestamps inside this_month are always present.
Examples
Section titled “Examples”const res = await fetch('https://api.bve.me/v1/usage', { headers: { Authorization: 'Bearer sk-bve-YOUR_KEY' },});
const usage = await res.json();
console.log(`RPM: ${usage.this_minute.used}/${usage.this_minute.limit} — resets at ${usage.this_minute.resets_at}`);console.log(`RPD: ${usage.today.used}/${usage.today.limit}`);
if (usage.this_month.requests.limit !== null) { const pct = (usage.this_month.requests.used / usage.this_month.requests.limit * 100).toFixed(1); console.log(`Monthly requests: ${usage.this_month.requests.used}/${usage.this_month.requests.limit} (${pct}%)`);}import urllib.request, json
req = urllib.request.Request( "https://api.bve.me/v1/usage", headers={"Authorization": "Bearer sk-bve-YOUR_KEY"},)with urllib.request.urlopen(req) as resp: usage = json.load(resp)
print(f"RPM: {usage['this_minute']['used']}/{usage['this_minute']['limit']}")print(f"RPD: {usage['today']['used']}/{usage['today']['limit']}")
if usage["this_month"]["requests"]["limit"] is not None: used = usage["this_month"]["requests"]["used"] limit = usage["this_month"]["requests"]["limit"] print(f"Monthly requests: {used}/{limit} ({used/limit*100:.1f}%)")curl -s https://api.bve.me/v1/usage \ -H "Authorization: Bearer sk-bve-YOUR_KEY" | jq .Example output (key with all limits configured):
{ "object": "usage", "key_id": "3f7a2c1b-...", "this_minute": { "limit": 60, "used": 3, "remaining": 57, "resets_at": "2026-05-26T10:18:23.000Z" }, "today": { "limit": 10000, "used": 843, "remaining": 9157, "resets_at": "2026-05-27T00:00:00.000Z" }, "this_month": { "requests": { "limit": 5000, "used": 1247, "remaining": 3753, "resets_at": "2026-06-01T00:00:00.000Z" }, "tokens": { "limit": 500000, "used": 83421, "remaining": 416579, "resets_at": "2026-06-01T00:00:00.000Z" } }}Pre-emptive backoff pattern
Section titled “Pre-emptive backoff pattern”Poll GET /v1/usage before making inference calls to avoid hitting limits mid-request:
async function checkQuotaBeforeRequest(threshold = 0.9): Promise<boolean> { const res = await fetch('https://api.bve.me/v1/usage', { headers: { Authorization: 'Bearer sk-bve-YOUR_KEY' }, }); const usage = await res.json();
// Check RPM headroom const rpmPct = usage.this_minute.used / usage.this_minute.limit; if (rpmPct >= threshold) { const resetMs = new Date(usage.this_minute.resets_at).getTime() - Date.now(); console.log(`RPM at ${(rpmPct * 100).toFixed(0)}% — waiting ${Math.ceil(resetMs / 1000)}s`); await new Promise(r => setTimeout(r, resetMs + 100)); return false; }
// Check monthly budget if configured if (usage.this_month.requests.limit !== null) { const monthPct = usage.this_month.requests.used / usage.this_month.requests.limit; if (monthPct >= 1) throw new Error('Monthly request budget exhausted'); }
return true;}Data sources and accuracy
Section titled “Data sources and accuracy”| Counter | Source | Notes |
|---|---|---|
this_minute | Durable Object | Exact; non-incrementing read (no side-effects) |
today | Durable Object | Exact; resets at UTC midnight |
this_month.requests | Durable Object | Exact per-month counter in the DO |
this_month.tokens | D1 (monthly_usage table) | Aggregated; only present when monthly_token_limit is set; reflects tokens recorded before the current request (asynchronous) |
The Durable Object read is a non-incrementing getUsage() call — it reads current state without modifying any counter. The monthly token total is read from D1 and is the same value used by the quota middleware for its pre-flight token check. Both sources are consistent with what the gateway enforces.
Errors
Section titled “Errors”| Status | code | Cause |
|---|---|---|
401 | invalid_api_key | Missing or invalid Authorization header |
401 | api_key_revoked | Key has been revoked |
401 | api_key_suspended | Key has been suspended |
401 | api_key_expired | Key has passed its expires_at date |
There is no 429 response for this endpoint — it bypasses all quota middleware.