Platform notice: all DeepSeek models are now live. New users receive trial credits on sign-up.
Api reference

API Keys API

REST endpoints for key management: create, list, usage statistics, and revoke.

Management endpoints use session authentication: the request header Authorization: Bearer <accessToken> (the token returned by the login endpoint, the same as in the Console), not an API Key starting with sk-tp-. Creating a key requires identity verification first.

POST /api/keys

Create a key.

ParameterTypeRequiredDescription
namestringYesKey name, 1–50 characters
groupstringNoGroup tag (e.g. "Production"), ≤ 30 characters
quotaLimitnumberNoTotal spending limit for this key's subtree (yuan); omit for no limit
parentIdstringNoParent key id; pass it when creating a sub-key

In the response, key is the plaintext key (sk-tp-...), returned only this once and never viewable again—save it immediately. The remaining fields are key metadata (prefix, depth, quotaLimit, used, status, etc.).

Constraints:

  • A key tree has at most 4 levels.
  • A sub-key's quota cannot exceed its parent's.

GET /api/keys

Returns all keys for the current user (excluding plaintext), in ascending order of creation time.

GET /api/keys/usage

Returns the 20 most recent call records: model, keyName, inputTokens, outputTokens, cost, createdAt.

GET /api/keys/usage-stats

Returns usage statistics for the last 30 days:

  • days: cost / tokens / call count aggregated by day
  • models: top 8 models by cost
  • totals: total cost, total tokens, total call count

POST /api/keys/{id}/revoke

Revoke a key. After revocation, the key and all of its sub-keys are cascaded out of service; this action cannot be undone. Bills already incurred are unaffected.

On this page