Authentication
Every request to /v1/* must include your customer API key.
Accepted headers
Send the key in either of these headers. Both are accepted on every endpoint, so the openai SDK (which uses Authorization) and the anthropic SDK (which uses x-api-key) both work.
| Header | Value |
|---|---|
Authorization | Bearer sk-… |
x-api-key | sk-… |
curl https://octalabs.id/v1/chat/completions \ -H "Authorization: Bearer $API_KEY" \ ... If you send both headers, they must carry the same key; otherwise the request is rejected with 401.
Key format
- Customer keys always start with
sk-. - A key is shown only once, when it is created, and we store only a hash of it, so it can’t be displayed again. If you lose it, create a new one.
- An account can have up to 20 active keys.
Revoking a key
Revoke a key from the API keys page of the dashboard. A revoked key stops working from the very next request.
When authentication fails
A wrong, revoked or missing key, or a key that belongs to a disabled account, gets the same 401, in the error format of the endpoint. Example for /v1/chat/completions:
401 · JSON
{ "error": { "message": "Invalid API key.", "type": "authentication_error", "param": null, "code": "invalid_api_key" }, "request_id": "…"}Other codes are covered in Errors & status codes.
Keep your key secret
Never put an API key in frontend code, a mobile app or a public repository. Anyone holding the key can spend your balance. Call the API from your own server.