Home / Docs / Authentication

Authentication

How to send your key, which header each format expects, and how to keep keys safe.

Every request needs an API key created in your dashboard. Keys start with sk- and carry the permissions and balance of the account that made them.

Two headers, one key

The same key works in both formats — only the header name changes.

FormatEndpointHeader
Anthropic/v1/messagesx-api-key: sk-...
Anthropic (alt)/v1/messagesAuthorization: Bearer sk-...
OpenAI/v1/chat/completionsAuthorization: Bearer sk-...

The Anthropic format additionally expects a version header. Any Anthropic SDK sets it automatically:

-H "anthropic-version: 2023-06-01"

Environment variables

Most tooling reads these rather than taking a key as an argument:

VariableUsed byValue
ANTHROPIC_BASE_URLClaude Code, Anthropic SDKhttps://aiprimetech.io
ANTHROPIC_AUTH_TOKENClaude Codeyour sk- key
ANTHROPIC_API_KEYAnthropic SDK (Python/TS)your sk- key
OPENAI_BASE_URLOpenAI SDK, LangChain, LiteLLMhttps://aiprimetech.io/v1
OPENAI_API_KEYOpenAI SDKyour sk- key
Note the /v1 suffix on OPENAI_BASE_URL but not on ANTHROPIC_BASE_URL. That asymmetry is in the official SDKs, not something we introduced — the OpenAI client appends paths to the base you give it, the Anthropic client appends /v1 itself. Getting this wrong is the single most common setup error.

Key hygiene

Revoking and rotating

  1. Dashboard → API Keys.
  2. Create the replacement key first and deploy it.
  3. Delete the old key once traffic has moved. In-flight requests using it fail immediately after deletion.