Authentication
Learn how to authenticate LEAPERone API requests with bearer tokens, manage API keys, and avoid common authorization errors.
LEAPERone uses separate credentials for model traffic and account control-plane operations.
Base URL
https://api.leaper.oneModel API Keys (sk-)
Use an API key for authenticated model, media, and data endpoints under /v1/*. Pass it in the Authorization header. Public discovery endpoints such as GET /v1/models do not require a key.
curl https://api.leaper.one/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model":"auto","messages":[{"role":"user","content":"Hello"}]}'X-API-Key Header
Alternatively, use the X-API-Key header:
curl https://api.leaper.one/v1/chat/completions \
-H "X-API-Key: sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model":"auto","messages":[{"role":"user","content":"Hello"}]}'Control Tokens (lpc_)
CLI, EnvX, account automation, usage queries, tickets, and organization operations use
scoped control tokens under /api/v1/*. Sign in through the Dashboard authorization UI:
npx @leaperone/cli auth login
npx @leaperone/cli auth statusControl tokens carry explicit scopes such as api_keys:read, credits:read,
usage:read, or envx:write. Do not use a model API key as a permanent substitute for
a control token.
For non-interactive CLI automation, set the control token separately:
export LEAPERONE_CONTROL_TOKEN=lpc-your-control-token
npx @leaperone/cli --json auth statusCreating API Keys
You can create and manage keys in two ways:
Dashboard — go to Settings > API Keys and click Create Key.
CLI — create or list keys from the terminal:
npx @leaperone/cli apikey create -n "my-app-key"
npx @leaperone/cli apikey listThe complete API key is shown only once by apikey create. apikey list returns a preview and cannot recover a lost key. Store new keys securely.
Error Codes
| Code | Meaning |
|---|---|
401 | Invalid, expired, revoked, or missing credential. |
403 | The control token does not include the required scope. |
402 | Insufficient credits. Top up your balance to continue. |
For full error response schemas, see the API Reference.