Skip to content

Authentication

primerouter uses Bearer token authentication, fully compatible with OpenAI / Anthropic API.

Bearer token

http
Authorization: Bearer sk-your-key

Used by: all /v1/... endpoints.

Anthropic style

http
x-api-key: sk-your-key
anthropic-version: 2023-06-01

Used by: /v1/messages. The Claude SDK uses this by default.

Get a key

  1. Log in at primerouter.ai
  2. Console → Tokens (details)
  3. After saving, copy the sk-... string — shown only once

Token attributes

Each key supports:

AttributeDefaultDescription
ExpiryNeverAfter expiry, calls return 401
Quota capUse account balanceSet explicit cap to isolate cost
Model restrictionAllOnly allowlisted models can be called
IP allowlistOpenCIDR supported
GroupDefault groupAffects pricing multiplier

Error states

HTTPMeaning
401Key invalid, deleted, or expired
403Key valid but disabled / model not allowed / IP not in allowlist
402Key valid but quota exhausted

Security recommendations

  1. Never commit keys to a repo — use env vars or a secret manager
  2. Set IP allowlist for production keys
  3. One key per project — easier cost attribution
  4. Use expiry + rotate periodically
  5. On suspected leak — delete and recreate immediately

Built for transparent, auditable, crypto-native AI inference. About · Terms · Privacy