Get started

Authentication

Authenticate to the Abliterator API with a Bearer token or x-api-key header, set per-key spend limits, restrict keys to plan credit, and rotate keys safely.

Reviewed APIAuthentication

Quick answer

Send your Abliterator key as Authorization: Bearer <key> or x-api-key: <key>. Create, limit and revoke keys at /account; each account can have 25 live keys.

Send your key

Abliterator accepts a key in either header. Use whichever your client sends by default.

Header Format Sent by
Authorization Bearer sk-abl-v1-... OpenAI SDKs, most OpenAI-compatible tools, Claude Code with ANTHROPIC_AUTH_TOKEN
x-api-key sk-abl-v1-... Anthropic SDKs, Claude Code with ANTHROPIC_API_KEY
curl https://abliterator.ai/v1/chat/completions \
  -H "Authorization: Bearer $ABL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4.1-flash-abliterated", "max_tokens": 512, "messages": [{"role": "user", "content": "ping"}]}'

curl https://abliterator.ai/v1/messages \
  -H "x-api-key: $ABL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4.1-flash-abliterated", "max_tokens": 512, "messages": [{"role": "user", "content": "ping"}]}'

Both headers work on every endpoint: /v1/chat/completions, /v1/messages, /api/v1/key, /api/v1/generation and /api/v1/activity. GET /v1/models needs no key.

Rules the gateway applies:

  • The Authorization value must start with Bearer (any case). Any other scheme is rejected.
  • If you send both headers, they must hold the same key.
  • Keys start with sk-abl-. Anything else is treated as an invalid key.

Authentication errors

All three cases return HTTP 401, in the error format of the endpoint you called (OpenAI or Anthropic shape).

Message Cause Fix
Missing API key. Create one at https://abliterator.ai/keys. No key in either header Set ABL_API_KEY and check your client actually sends it
Invalid credentials: send one abliterator key as `Authorization: Bearer` or `x-api-key`. Two different keys in the two headers, or an Authorization value without Bearer Unset the other credential, for example a leftover ANTHROPIC_API_KEY
Invalid or revoked API key. The key does not exist or was revoked Create a new key at /account

Create and manage keys

Create your first key at /keys. After that, manage keys on the account page, where each key has:

  • A name, so you can tell your CI key from your laptop key.
  • An optional spend limit in dollars.
  • An option to spend only monthly plan credit, described below.

The account page shows each key's prefix (the first 15 characters), what it has spent and its limit. Abliterator stores only a hash of the key, so the full key is shown once, when you create it.

An account can have 25 live keys. Revoke one before creating another. Every key on an account shares that account's balance, monthly credit and rate limits.

Key spend limits

A spend limit caps what one key can spend over its lifetime. It counts all of the key's spending, whether monthly plan credit or prepaid balance paid for it.

  • When the key has spent its limit, requests fail with 402 This API key reached its spend limit.
  • Before each request, Abliterator also checks that the key's remaining limit covers the estimated prompt plus max_tokens of output. A request that would exceed it is refused with a 402 that says how many output tokens the remaining budget covers.
  • The limit does not reset. Create a new key when you need a new budget.

Give every shared or automated workload its own key with a limit: a CI job, a red-team run, a demo deployment. A runaway loop then stops at the limit instead of draining the account.

Keys that spend only plan credit

On a paid plan you can create a key that spends only your monthly plan credit and never touches your prepaid balance.

  • While monthly credit remains, the key works normally on both models.
  • When the monthly credit is used up, the key's requests fail with 402 Your monthly plan credit is used up. It resets when your plan renews; this key won't spend your balance.
  • If the last request in a period costs more than the credit left, the overrun is not charged to your balance.

GET /api/v1/key reports this setting as "pass_only": true.

Check a key

GET /api/v1/key returns the key's label, account, balance, usage, limit, plan and rate limits:

curl https://abliterator.ai/api/v1/key -H "Authorization: Bearer $ABL_API_KEY"
{
  "data": {
    "label": "ci-redteam",
    "account": "Example Security Team",
    "balance": 87.42,
    "usage": 12.58,
    "limit": 25,
    "is_free_tier": false,
    "plan": "growth",
    "pass_credit": 31.2,
    "pass_only": false,
    "rate_limit": {"requests_per_minute": 300, "concurrency": 16}
  }
}

Field meanings are in usage and billing. limit is null when the key has no spend limit.

Rotate a key

  1. Create a new key at /account, with the same spend limit if the old one had one.
  2. Deploy the new key everywhere the old one is used.
  3. Confirm traffic moved: the old key's spend on the account page stops increasing.
  4. Revoke the old key. A revoked key fails with Invalid or revoked API key. on its next request.

Rotate right away if a key leaks. Revoking is the only way to stop a leaked key; there is no way to rename or re-scope a key after creation.

Keep keys out of the browser

Call Abliterator from a server, not from front-end code you ship to other people. A key in a public web page is readable by anyone who opens it.

The API does send CORS headers (Access-Control-Allow-Origin: *) and answers preflight requests, so browser-based clients where each user enters their own key work directly. TypingMind and Chatbox in a browser are examples. Give each of those its own key with a spend limit, so you can revoke it without touching your other integrations.

Frequently asked questions

Can I send the key in both headers?

Yes, if both headers carry the same key. If Authorization and x-api-key hold different values, Abliterator rejects the request with a 401 rather than guess which one you meant.

Does a key spend limit reset every month?

No. A key's spend limit counts everything the key has spent since it was created. To get a fresh budget, create a new key with its own limit.