SumoRouter
SumoRouter Customer API

API Keys

Server

Create and manage the sk-… keys used for the AI API.


List API keys

GET
https://ai.brandkamu.id
/api/keys

Active (non-revoked) keys, newest first. The secret is never returned again; key_prefix is a masked form for display.

List API keys › query Parameters

limit
​integer · min: 1 · max: 100
Default: 20
offset
​integer · min: 0
Default: 0

List API keys › Responses

A page of keys.

​ApiKey[] · required
total
​integer · int64 · required

Active keys in total, across all pages.


Create an API key

POST
https://ai.brandkamu.id
/api/keys

Creates a key. The full secret (key) is returned exactly once; store it now. At most 50 active keys per account (400 beyond that). All limits are optional.

Create an API key › Request Body

Settings for create and update. On update the whole object replaces the current settings.
name
​string · minLength: 1 · maxLength: 100 · required
credit_limit_nano
​integer | null · int64 · min: 0

Spend cap in nano-USD (per budget period, if set). null = no cap beyond the account balance.

budget_period
​string | null · enum

Resets the key's spend each period (in the site time zone). Requires credit_limit_nano.

Enum values:
daily
weekly
monthly
allowed_models
​array | null · maxItems: 200

Model slugs this key may use. null or empty = all models.

expires_at
​string | null · date-time

Must be in the future.

allowed_ips
​array | null · maxItems: 50

IP addresses or CIDR ranges (203.0.113.7, 10.0.0.0/8, 2001:db8::/32). null or empty = any address.

rpm_limit
​integer | null · min: 1

Requests per minute for this key, up to the account limit. null = the default per-key limit.

max_parallel
​integer | null · min: 1 · max: 1000

Requests in progress at once for this key.

redact_secrets
​boolean

Mask credentials (API keys, tokens, …) found in prompts before they are sent to the provider.

Default: false

Create an API key › Responses

The new key.

id
​string · uuid · required
key
​string · required

The full secret, sk- followed by 48 characters. Shown once.

key_prefix
​string · required

Masked form for display.

name
​string · required

Update an API key

PUT
https://ai.brandkamu.id
/api/keys/{id}

Replaces all settings of the key (send every field you want to keep; omitted optional fields are cleared). The secret and usage stay the same. Setting a new or different budget_period resets the period's spend to zero. Changes apply immediately.

Update an API key › path Parameters

id
​string · uuid · required

API key id.

Update an API key › Request Body

Settings for create and update. On update the whole object replaces the current settings.
name
​string · minLength: 1 · maxLength: 100 · required
credit_limit_nano
​integer | null · int64 · min: 0

Spend cap in nano-USD (per budget period, if set). null = no cap beyond the account balance.

budget_period
​string | null · enum

Resets the key's spend each period (in the site time zone). Requires credit_limit_nano.

Enum values:
daily
weekly
monthly
allowed_models
​array | null · maxItems: 200

Model slugs this key may use. null or empty = all models.

expires_at
​string | null · date-time

Must be in the future.

allowed_ips
​array | null · maxItems: 50

IP addresses or CIDR ranges (203.0.113.7, 10.0.0.0/8, 2001:db8::/32). null or empty = any address.

rpm_limit
​integer | null · min: 1

Requests per minute for this key, up to the account limit. null = the default per-key limit.

max_parallel
​integer | null · min: 1 · max: 1000

Requests in progress at once for this key.

redact_secrets
​boolean

Mask credentials (API keys, tokens, …) found in prompts before they are sent to the provider.

Default: false

Update an API key › Responses

The updated key.

id
​string · uuid · required
name
​string · required
key_prefix
​string · required

Masked key for display, e.g. sk-****abcd.

credit_limit_nano
​integer | null · int64 · required

Spend cap in nano-USD.

usage_nano
​integer · int64 · required

Spend in nano-USD in the current budget period (or ever, without a period).

allowed_models
​array | null · required
expires_at
​string | null · date-time · required
allowed_ips
​array | null · required
rpm_limit
​integer | null · required
max_parallel
​integer | null · required
budget_period
​string | null · enum · required
Enum values:
daily
weekly
monthly
budget_reset_at
​string | null · date-time · required

When the current budget period ends.

redact_secrets
​boolean · required
last_used_at
​string | null · date-time · required
created_at
​string · date-time · required

Revoke an API key

DELETE
https://ai.brandkamu.id
/api/keys/{id}

The key stops working immediately. Its past usage stays in the logs.

Revoke an API key › path Parameters

id
​string · uuid · required

API key id.

Revoke an API key › Responses

Done.

ok
​boolean · const · required
Const value:

Rotate an API key's secret

POST
https://ai.brandkamu.id
/api/keys/{id}/regenerate

Issues a new secret with the same settings and usage; the old secret stops working immediately. The new key is returned once.

Rotate an API key's secret › path Parameters

id
​string · uuid · required

API key id.

Rotate an API key's secret › Responses

The new secret.

id
​string · uuid · required
key
​string · required

The full new secret. Shown once.

key_prefix
​string · required