Create and manage the sk-… keys used for the AI API.
List API keys
Active (non-revoked) keys, newest first. The secret is never returned again; key_prefix is a masked form for display.
query Parameters
limitoffsetList API keys › Responses
A page of keys.
totalActive keys in total, across all pages.
Create an API key
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
namecredit_limit_nanoSpend cap in nano-USD (per budget period, if set). null = no cap beyond the account balance.
budget_periodResets the key's spend each period (in the site time zone). Requires credit_limit_nano.
allowed_modelsModel slugs this key may use. null or empty = all models.
expires_atMust be in the future.
allowed_ipsIP addresses or CIDR ranges (203.0.113.7, 10.0.0.0/8, 2001:db8::/32). null or empty = any address.
rpm_limitRequests per minute for this key, up to the account limit. null = the default per-key limit.
max_parallelRequests in progress at once for this key.
redact_secretsMask credentials (API keys, tokens, …) found in prompts before they are sent to the provider.
Create an API key › Responses
The new key.
idkeyThe full secret, sk- followed by 48 characters. Shown once.
key_prefixMasked form for display.
nameUpdate an API key
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.
path Parameters
idAPI key id.
Update an API key › Request Body
namecredit_limit_nanoSpend cap in nano-USD (per budget period, if set). null = no cap beyond the account balance.
budget_periodResets the key's spend each period (in the site time zone). Requires credit_limit_nano.
allowed_modelsModel slugs this key may use. null or empty = all models.
expires_atMust be in the future.
allowed_ipsIP addresses or CIDR ranges (203.0.113.7, 10.0.0.0/8, 2001:db8::/32). null or empty = any address.
rpm_limitRequests per minute for this key, up to the account limit. null = the default per-key limit.
max_parallelRequests in progress at once for this key.
redact_secretsMask credentials (API keys, tokens, …) found in prompts before they are sent to the provider.
Update an API key › Responses
The updated key.
idnamekey_prefixMasked key for display, e.g. sk-****abcd.
credit_limit_nanoSpend cap in nano-USD.
usage_nanoSpend in nano-USD in the current budget period (or ever, without a period).
allowed_modelsexpires_atallowed_ipsrpm_limitmax_parallelbudget_periodbudget_reset_atWhen the current budget period ends.
redact_secretslast_used_atcreated_atRotate an API key's secret
Issues a new secret with the same settings and usage; the old secret stops working immediately. The new key is returned once.
path Parameters
idAPI key id.
Rotate an API key's secret › Responses
The new secret.
idkeyThe full new secret. Shown once.
key_prefix