Skip to main content
API Keys authenticate into /v1/chat/completions, /v1/images/generations, /v1/videos/generations, and /v1/audio/*. If you just want to understand RouterBase’s keys at a high level, start with Keys. Authentication for these endpoints: JWT (logged-in dashboard session).

Key format

The public_id is safe to log / display (it’s the URL slug used in rate-limit lookups). The secret half is returned only once at create time — never shown again.

List API Keys

Returns all API Keys for the authenticated user, newest first. key_prefix is always a masked display string (first12…last4). full_key carries the full plaintext only for keys minted after plaintext persistence shipped — legacy keys omit the field, keeping their secret half unavailable.

Example

Response


Create API Key

Request Body

string
required
A human-readable label for the key.
number
Max requests per minute. No limit if omitted.
number
Max tokens per hour. No limit if omitted.
number
Max tokens per day. No limit if omitted.
string[]
Up to 10 allowed IPs (IPv4 / CIDR). Empty array or omitted means no restriction.
number
USD spend cap for the key. Omit or null for unlimited. Once the cap is hit within the current period the key returns 403 until the period resets.
string
How the spend window rolls over: none (default), daily, weekly, or monthly. Only meaningful alongside credit_limit.
string (ISO 8601)
Optional auto-disable cutoff. After this moment the key returns 401.

Example

Response

The full key value is returned only once at creation time. Copy it into a secrets manager or environment variable before the response leaves your terminal.

Update API Key

Request Body

Any subset of:
string
string[]
number
number
number
boolean
Pause the key without losing history. true rejects auth; false re-enables.
number
Set the USD spend cap. Send a number to set, omit to leave unchanged.
string
none | daily | weekly | monthly. Omit to leave unchanged.
string (ISO 8601) | null

Example

Response

The full masked key record (same shape as a List item).

Delete API Key

Immediately revokes the key. Any in-flight requests using it will fail with 401 before the next upstream call. Rate-limit state in Redis is cleared as part of the delete. Returns 204 No Content.

Errors

Rate-limit enforcement on /v1/* calls returns 429 with Retry-After on violation. See Rate Limits.