Skip to main content
The Management API lets a script do what you would otherwise do on the API Keys and Usage pages: create keys for your own customers or services, limit and budget them, rotate or revoke them, and read usage. It lives under https://api.omnirelay.ai/v1/manage/.

Management keys

The Management API accepts a management key (or-mgmt-…), never an API key. The two are separate on purpose: a key that calls models can never provision keys, and a management key can never call a model. After verified activation, create one on the API Keys page under Management keys. Creation is disabled before activation. It is shown once and only its hash is stored. Each key has a scope: A read key that attempts a write gets 403 insufficient_scope. A management key acts as you: it changes your API keys; usage visibility follows your account permissions, and every change it makes appears in the audit log as you@example.com via management key <name>. Revoking it, suspending your account or deleting your account stops it on the next call. You can hold up to 10 active management keys.
A write key can mint API keys that spend your balance. Keep management keys on a server, never in a browser, and use a read key wherever reading is enough.

Endpoints

Every request sends Authorization: Bearer $OMNIRELAY_MANAGEMENT_KEY. Bodies are JSON. Limited to 120 requests per minute per management key. Anything else under /v1/manage/ returns 404. There is no way to reach billing, account or admin routes with a management key.

Create a key for a customer

The owner’s workspace must currently have verified service readiness. Otherwise POST /v1/manage/keys returns 403 activation_required and creates no key. Check Overview → Live model service and complete activation before retrying. Existing key rotation and revocation remain separate operations.
budget is in micro-USD (50,000,000 is $50). defaultTags follow the Tags and allowedModels the model limits. Store the returned key right away; it is not shown again.

Read usage

The response holds totals, previous (the period before, for comparison), series, and groups by model, provider, key and status. Amounts are micro-USD and times are UTC. GET /v1/manage/requests takes the same filters plus limit (up to 1,000) and before (the next cursor from the previous page).

Calling order and fields

Create a management key in the console first. read and write scopes control management operations and do not activate models. Query List models with an inference key to confirm access. Creation returns 201; other successful operations return 200. Response examples use placeholder IDs and credentials. Creation and rotation return the full key once. PATCH preserves omitted fields. Changing budget does not refill remaining; explicitly set remaining to refill. Periodic budgets must be positive. Clear a budget with budget=null, remaining=null and resetPeriod=none together. Set expiry using the key update endpoint, not the budget endpoint. Each owner can have 20 active API keys. Rotation preserves ID, expiry, restrictions, tags and spending counters; the old credential stops working immediately. Limited to 10 rotations per owner per hour. Creation and rotation are not idempotent: check current state before retrying an ambiguous result.

List keys and budgets

The key list returns { "keys": [...] }, including revoked entries, without full credentials. Response fields use expires_at, default_tags and allowed_models; write parameters use expiresAt, defaultTags and allowedModels. Budget response example:

Update a key and its budget

Set KEY_ID to the ID from creation or listing, not the full credential.
Both return { "ok": true }. After 409 key_changed, fetch current state before deciding to update again.

Rotate and revoke a key

Rotation returns { "id": "example-key-id", "key": "or-live-…" }; store it securely and update your service. Revocation returns { "ok": true } and preserves historical usage.

Request records and pagination

Records include failures, sorted descending by created and id. limit defaults to 50, allowed 1–1,000. id filters an exact Request ID and accepts the chatcmpl- prefix. With a non-null next, keep the same filters and pass it unchanged as before:
Do not modify the cursor. next=null ends pagination. Record status is a numeric HTTP status; tags is a JSON-encoded string or null. cost is settled spend and does not identify outstanding reservations. Usage scope is workspace when the owner has members.read permission, otherwise user; member filtering requires that permission. Key listing and changes always apply only to the owner’s keys. Usage and request reads also share a limit of 240 monitoring requests per owner per minute.

Errors

Validation errors from key changes (invalid_input, invalid_tags, invalid_model_rules, invalid_key_policy, invalid_key_expiry) are the same as in the console.

API call reference

Management-key help

On Console → API Keys, select the question-mark icon beside the Management keys title to open contextual help. This icon opens help in place; the API documentation link remains in the description. Management keys do not grant model access, and inference keys cannot call the Management API.