Skip to content

Caveman Cloud· HostedGovernance & Billing

Create, limit, rotate, and revoke Caveman gateway API keys

Manage Caveman gateway API keys: personal vs shared keys, scopes, model allowlists, rate limits, budgets, expiry, IP allowlists, rotation, and revocation.

Apps and agents authenticate to the Caveman gateway with an API key. Each key carries its own limits, and every request it signs is attributed to it, which makes keys the foundation of both access control and cost attribution. Manage keys in Governance → Keys.

For how to send a key with a request, see Authentication.

Create a key#

  1. Open Governance → Keys

    Select the project the key belongs to, then choose Create key.

  2. Name the key and choose an owner

    Under Belongs to, pick a member to create a personal key: its traffic appears under that person's name on People. Pick No one (shared key) for services, CI, and production apps. Binding a key to a member requires the Owner or Platform admin role.

  3. Set a spend limit and expiry

    Optionally set a Spend limit with a reset period of Day, Week, Month, or Total, and an expiry of Never, 7 days, 30 days, or 90 days.

  4. Configure more options (optional)

    Under More options, set a default workflow and the key's scopes. Requests that do not send an x-cave-workflow header are attributed to the default workflow.

  5. Copy the key

    The full key and the gateway base URL are shown once. Store the key in your secret manager. Afterwards, the console only shows the key prefix.

Scopes#

Scopes decide what a key can do. New keys get the two defaults.

ScopeDefaultAllows
proxy:writeYesRoute model traffic through the gateway
sdk:writeYesSend traces from the SDKs
router:writeNoPick models through the router
plan:readNoRead the runtime plan
sql:readNoRun server-side SQL over this project's telemetry. Keys with this scope must expire: choose 7 days, 30 days, 90 days, or 1 year.
admin:bypass_budgetNoSkip spend limits entirely. The gateway never meters or blocks this key against budgets.

Per-key limits#

Open a key to set its limits. A value of 0 means unlimited. Key limits only narrow what the project allows in Governance → Access; they never widen it. Changes take effect on the next request.

LimitBehavior
Allowed modelsComma-separated list such as gpt-4o, openai:gpt-4o, claude-*. Narrows the project allowlist.
Requests/minPer-key cap, applied on top of the project cap.
Tokens/minInput plus output tokens over a rolling 60-second window.
ParallelMaximum concurrent in-flight requests.
Hard budgetDollar cap at catalog prices. Each request reserves its maximum possible cost, then settles to the actual cost. Requests over the cap are refused.
Soft budgetWarns through response headers and an alert, but never blocks.
ResetsBudget period: daily, weekly, monthly, or total. Periods follow UTC.
TagsLowercase labels used in spend reports and imports, such as team, env, or cost-center.
ExpiryA duration such as 30d, 12h, or 45m. Editing it extends the key.
Allowed IPs/CIDRsSource addresses the key may be used from. Empty means anywhere.

A key's budget counter starts when the budget is set: spend before then is not included.

Budget headers#

When a key has a budget, gateway responses include its position so your app can react before it is cut off:

HeaderMeaning
x-cave-key-budget-spend-usdSpend on this key in the current period
x-cave-key-budget-usdThe key's soft budget, or its hard budget if no soft budget is set
x-cave-key-budget-soft-exceededtrue once the soft budget is crossed

Key status and lifecycle#

Each key shows a status: Active, Near limit, At limit, Blocked, Expired, or Revoked. The list also shows when a key was last used and flags keys with no use in 90 days.

ActionEffect
BlockRequests return 401 until you unblock the key. Reversible.
UnblockRestores a blocked key.
RotateIssues a new secret. The old secret stops working immediately.
RevokeDisables the key permanently. Immediate and irreversible.

You can also manage keys through the API:

# Block a key
curl -X POST "${CAVE_API_URL}/api/v1/projects/$PROJECT_ID/keys/$KEY_ID/block" \
-H "Authorization: Bearer $CAVE_TOKEN"

The same path accepts unblock, rotate, and revoke. Use PATCH /api/v1/projects/{id}/keys/{keyId} to update limits.

Best practices#

  • Issue one key per person and one per service, so spend and incidents trace back to an owner.
  • Use separate keys for production, staging, and CI.
  • Give experimental and autonomous-agent keys a hard budget and a spend-rate quota.
  • Set an expiry on every key that does not need to live forever, and review keys flagged as unused.
  • Rotate on a schedule and immediately after anyone with access leaves.

Next steps#

Esc

Start here