Skip to Content
Konduit docs

Authentication

One header, one scheme, scopes, and what each refusal means.

Every konduit endpoint takes an API key in the standard OpenAI place:

Authorization: Bearer kdt-...

The scheme is matched case-insensitively, so Bearer, bearer and BEARER all work. The key may also be sent in an x-api-key header instead, which is what Anthropic's SDKs and tools do; it is read only when the request has no Authorization header. There is no query parameter and no cookie.

The key

A key is a prefix — kdt-, unless an installation configures a different one — followed by 32 characters from the lowercase base32 alphabet (a–z, 2–7).

Keys are created in the console and shown once, at creation time. konduit stores only a SHA-256 digest of the key, so a key that was not saved cannot be recovered — it has to be revoked and replaced. The console can still show you the first few characters of an existing key, which is enough to tell two keys apart without being enough to use one.

Which endpoints need one

All of them. GET /v1/models is not an exception: konduit's catalog carries prices and sovereignty metadata, and it is rate limited by the same key that authorises a completion. A public list of what konduit serves, without those details, is on konduit.eu.

The only unauthenticated routes are the operational probes, /healthz and /readyz, which report whether the process is alive and whether its dependencies are reachable and nothing else.

Scopes

A new key needs at least one of these, chosen when you create it; there is no default and no "all scopes" shortcut. A key may hold any combination of:

ScopeEndpoint
models:readGET /v1/models, GET /v1/models/{model}
chat:writePOST /v1/chat/completions and POST /v1/messages
completions:writePOST /v1/completions, POST /v1/fim/completions
embeddings:writePOST /v1/embeddings
audio:writePOST /v1/audio/transcriptions
decisions:writePOST /v1/systemone
usage:readGET /v1/usage

Keys created before scopes were required and still without any remain unrestricted until you set scopes on them. A scoped key fails closed on an endpoint that has no scope mapping, so a new route cannot silently expand its authority.

A valid key missing the route's scope is refused with 403 and code insufficient_scope. This happens before routing, billing, or a provider call.

The two refusals

Both are 401 with the OpenAI error envelope, and the code field is what tells them apart. On the Messages routes the same 401 and 403 arrive in Anthropic's envelope, which has no code; see Errors.

codeWhenMessage
missing_api_keyNeither an Authorization nor an x-api-key header, an empty one, a scheme other than Bearer, or Bearer with nothing after it.no API key was provided; send it as an Authorization: Bearer or x-api-key header
invalid_api_keyA key was sent and konduit will not accept it.the API key is not valid
{
  "error": {
    "message": "the API key is not valid",
    "type": "invalid_request_error",
    "param": null,
    "code": "invalid_api_key"
  }
}

Every rejected key gets the same answer

Unknown, revoked, expired, or a key from a different installation — all of them produce a byte-identical invalid_api_key body. Telling them apart would tell a caller whether a key they hold used to exist, which is information they have not earned. If a key stops working and you did not revoke it, the console's audit log is where to look.

Watch for a trailing newline

Only the whitespace between Bearer and the key is trimmed. A key pasted with a trailing space or newline — KEY=$(cat key.txt) is the usual culprit — is sent as a different string and comes back as invalid_api_key, not as missing_api_key.

No WWW-Authenticate

A konduit 401 deliberately carries no WWW-Authenticate header, although RFC 9110 asks for one. OpenAI's API sends none, and konduit is a drop-in for it: a client that branches on the header's presence, or an HTTP library that reacts to a challenge it suddenly sees, would behave differently against konduit than against the API it was written for. Nothing about konduit's authentication is negotiable anyway — there is one scheme, and it is on this page.

Keeping a key safe

  • Keys are bearer credentials. A key carrying chat:write, completions:write, embeddings:write or audio:write — or an older key that still has no scopes — can spend the organisation's credit; every key can access whatever its scopes permit. Treat one like a password, not like an account id.
  • Never put a key in a browser bundle. A NEXT_PUBLIC_-style variable, a mobile app, or anything else a user can read is a published key.
  • Rotate by creating the new key first, deploying it, and revoking the old one afterwards. A revocation is pushed to every gateway immediately and, if a gateway missed the push, is picked up by its next periodic reload — so the reverse order is a small outage rather than a clean handover.
  • One key per workload rather than one per organisation. Rate limits are set per key, and a key that only one service uses is a key you can revoke without taking anything else down.

On this page