Getting started
Base URL & authentication
All OpenAI-compatible endpoints live under /v1 and authenticate with an API key sent as a Bearer token.
Base URL#
Use this URL as base_url (Python) or baseURL (JavaScript) in the OpenAI SDK:
https://<host>/v1POST /v1/chat/completions- Description
- Chat completions, streaming and non-streaming. See Chat completions.
GET /v1/models- Description
- The models this key may use (OpenAI format, plus a kind field: chat | embedding).
POST /v1/embeddings- Description
- Embeddings (embedding models). See Embeddings.
API key#
Send the key in the Authorization header of every request:
Authorization: Bearer sk-kompa-YOUR_API_KEY- Keys are
sk-kompa-followed by 43 characters. Only a hash is stored; the key is shown only once, when it is created. - Each account can have up to 50 active keys.
- Revoking a key in the dashboard takes effect almost immediately (≤ 1 second).
- Never embed keys in code that runs in a browser or mobile app. Call the API from your server.
Per-key limits#
When you create or edit a key in API keys, you can set:
- Allowed models
- Meaning
- Restrict the key to specific models. Empty = all models.
- When exceeded
403 model_not_allowed
- Spend limit
- Meaning
- Maximum total amount (USD) the key may spend, including in-flight requests.
- When exceeded
402 key_spend_limit_exceeded
- Rate limit (rpm)
- Meaning
- Requests per minute for the key. Empty = system default.
- When exceeded
429 rate_limit_exceeded
Authentication errors#
- 401
- code
missing_api_key- Cause
- No Authorization: Bearer … header.
- 401
- code
invalid_api_key- Cause
- The key is wrong, revoked, or truncated.
- 403
- code
account_suspended- Cause
- The account is suspended. Contact support.
Leaked a key?
Revoke it in the dashboard right away and create a new one. Requests already made with the old key are still charged to your wallet.