Authentication
Learn how to authenticate UnderSky API requests with bearer tokens, manage API keys, and avoid common authorization errors.
UnderSky uses separate credentials for model traffic and account control-plane operations.
Base URL
https://api.undersky.aiModel 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.undersky.ai/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.undersky.ai/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_)
Scoped control tokens under /api/v1/* are used for account automation, usage queries, tickets, and organization operations. Obtain them through the Dashboard authorization UI when integrating server-side tools.
Control 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.
Example status check with a token you already hold:
curl -sS https://api.undersky.ai/api/v1/credits/balance \
-H "Authorization: Bearer lpc-your-control-token"Creating API Keys
Create and manage keys in the Dashboard → Settings → API Keys page. Click Create Key and store the full sk- value immediately—it is shown only once.
The complete API key is shown only once. Store new keys securely; lost keys cannot be recovered.
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.
Terminal & curl
Discover models with GET /v1/models, call OpenAI-compatible endpoints with curl, stream responses, and use the Python SDK against api.undersky.ai.
Chat Completions Guide
Learn how to call UnderSky chat completions with OpenAI-compatible messages, model selection, streaming, and usage tracking.