Create an API Key
/v1/keysRequest Body
workspace_idstringRequirednamestringRequiredkindstringValues: "api"
scopesstring[]Default: ["audio.write","models.read"]
Show nested fields
string
spend_limitnumber | nullMinimum 0
rate_limitinteger | nullRequests per minute.
Minimum 1
expires_atstring | nullbudgetsobjectA number sets that period's limit in USD, null removes it, and periods left out stay as they are.
Show nested fields
dailynumber | nullMinimum 0 · Maximum 1000000
weeklynumber | nullMinimum 0 · Maximum 1000000
monthlynumber | nullMinimum 0 · Maximum 1000000
access_policyobject | nullThe key's own policy. It applies on top of the workspace's, so it can only narrow what the key may use.
Show nested fields
Option 1: object
allowed_modelsstring[]Show nested fields
See the OpenAPI schema for this nested object.
blocked_modelsstring[]Show nested fields
See the OpenAPI schema for this nested object.
allowed_providersstring[]Show nested fields
See the OpenAPI schema for this nested object.
blocked_providersstring[]Show nested fields
See the OpenAPI schema for this nested object.
allowed_productsstring[]Show nested fields
See the OpenAPI schema for this nested object.
blocked_productsstring[]Show nested fields
See the OpenAPI schema for this nested object.
Option 2: null
null
Responses
201API key created. The raw key is returned once.
keyobjectRequiredShow nested fields
idstringRequiredworkspace_idstringRequirednamestringRequiredprefixstringRequiredNon-secret key prefix for display and lookup.
kindstringRequiredValues: "api"
statestringRequiredValues: "active""disabled""revoked"
scopesstring[]RequiredShow nested fields
string
spend_limitnumber | nullrate_limitinteger | nullexpires_atstring | nulllast_used_atstring | nullcreated_atstringRequiredrevoked_atstring | nullbudgetsobjectSpend limits in USD per UTC calendar period. null means no limit.
Show nested fields
dailynumber | nullRequiredMinimum 0
weeklynumber | nullRequiredWeeks start on Monday.
Minimum 0
monthlynumber | nullRequiredMinimum 0
access_policyobject | nullShow nested fields
Option 1: object
allowed_modelsstring[]Show nested fields
See the OpenAPI schema for this nested object.
blocked_modelsstring[]Show nested fields
See the OpenAPI schema for this nested object.
allowed_providersstring[]Show nested fields
See the OpenAPI schema for this nested object.
blocked_providersstring[]Show nested fields
See the OpenAPI schema for this nested object.
allowed_productsstring[]Show nested fields
See the OpenAPI schema for this nested object.
blocked_productsstring[]Show nested fields
See the OpenAPI schema for this nested object.
Option 2: null
null
usageobjectUSD spent in the current UTC day, week and month, and in total, including holds for requests in progress. Spend counts in the period its request started.
Show nested fields
dailynumberRequiredweeklynumberRequiredmonthlynumberRequiredtotalnumberRequiredvaluestringRequiredRaw API key. Manual keys are returned once; pending default keys remain claimable until acknowledged.
400Request validation failed.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.
401Authentication is missing or invalid.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.
403Authenticated principal lacks permission.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.
500Internal server error.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.