PL Log inOpen Studio
Preview version. Model catalog, prices, calculator and docs are live. Generation goes live at launch.

Authentication

Docs: every page

The only endpoint you can call without a key is the public model catalog (GET /v1/models). Everything else requires a Kadraris API key. A key is not tied to a model or an endpoint: the same one works across the whole API and charges your account balance.

Which header to use

The API reads the key from either of two headers. Pick the one your client already sends.

HeaderValueUsually sent by
AuthorizationBearer sk-kd-...curl, the OpenAI SDK, generic HTTP tools
x-api-keysk-kd-...the Anthropic SDK, Claude Code
bash
# Bearer
curl https://kadraris.com/v1/balance -H "Authorization: Bearer $KADRARIS_API_KEY"

# x-api-key
curl https://kadraris.com/v1/balance -H "x-api-key: $KADRARIS_API_KEY"
python
import os, requests

headers = {"Authorization": f"Bearer {os.environ['KADRARIS_API_KEY']}"}
print(requests.get("https://kadraris.com/v1/balance", headers=headers).json())
javascript
const res = await fetch("https://kadraris.com/v1/balance", {
  headers: { "x-api-key": process.env.KADRARIS_API_KEY },
});
console.log(await res.json());

Official SDKs need two things from you, the key and the base URL. Note that the Anthropic client takes the domain without /v1:

python
from openai import OpenAI
from anthropic import Anthropic

openai_client = OpenAI(base_url="https://kadraris.com/v1", api_key="sk-kd-...")
anthropic_client = Anthropic(base_url="https://kadraris.com", api_key="sk-kd-...")

Getting a key

  1. Log in and go to the dashboard.
  2. Under API keys, create a key and label it, for example n8n or prod-backend.
  3. If you want, give it a monthly spend limit.
  4. Copy the value now. After you close the dialog it cannot be shown again.

A key is the prefix sk-kd- followed by 32 characters:

text
sk-kd-4f9c2a7e1b8d3f6a0c5e9b2d7a1f4c8e

Lost a key? There is no way to recover it. Make a new one, then remove the old one from the dashboard.

Capping spend per key

You can attach a monthly spend limit to any key when you create it. This is useful for keys you hand to a staging setup, a client project or an automation that could run in a loop by mistake.

A request that would take the key over its cap is rejected with 403:

json
{ "error": { "type": "permission_error", "message": "This key reached its monthly spend limit. Create a new key with a higher limit in the dashboard or use another key." } }

Nothing is taken from your balance in that case. To keep going, switch to a different key or create a new one with a higher cap. Each limit covers only its own key; the overall ceiling for the account is simply how much balance you have (see Billing).

Statuserror.typeReason
401authentication_errorNo key, a malformed key, or a key that was deleted
402insufficient_balanceThe key is fine, but there is not enough balance
403permission_errorThe key hit its spend limit

Every error type is listed in Errors.

Handling keys safely

  • Call the API from your server only. A key inside frontend code, a mobile app or a public repo can be copied by anyone.
  • Give each application or environment its own key. Then you can revoke one without touching the others.
  • Load keys from environment variables or a secrets manager rather than committing them.
  • If a key is exposed, delete it in the dashboard straight away. Any later request using it gets 401.