Skip to content

Get started

Authentication

How AZRouter API keys work and which headers carry them.

One key with each request
One key with each request
Your server
Keep your key here
Request header
Authorization: Bearer <key>
AZRouter
Checks your API key
  1. Your server. Keep your key here
  2. Request header. Authorization: Bearer <key>
  3. AZRouter. Checks your API key

Every request carries one AZRouter API key.

API keys

Formatsk-...51 characters: sk- and 48 letters or digits.
ShownOnceAt creation. Copy it then; it can't be shown again.
ScopeYour accountAll keys on an account share its credits and rate limits.
RevokeAny timeIn Dashboard → API keys. A revoked key gets 401.

Headers

Send the key as a bearer token.

This works on every endpoint, including /v1/messages.

Shell
curl https://api.azrouter.dev/v1/models \
  -H "Authorization: Bearer $AZROUTER_API_KEY"

Anthropic clients send the key in x-api-key instead.

AZRouter accepts that header on /v1/messages:

Shell
curl https://api.azrouter.dev/v1/messages \
  -H "x-api-key: $AZROUTER_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen/qwen3.8-flash", "max_tokens": 200, "messages": [{"role": "user", "content": "Reply with exactly: Hello from AZRouter"}]}'

A missing or wrong key

The gateway answers 401 invalid_api_key.

The same 401 comes back for a revoked key, and for keys switched off once your spending reached your tier's monthly cap.

A key that reached its own spending limit gets 403 access_denied instead; see Errors.

Shell
curl https://api.azrouter.dev/v1/models \
  -H "Authorization: Bearer sk-not-a-real-key"
JSON
{"error":{"message":"Invalid or expired API key.","type":"authentication_error","code":"invalid_api_key"},"request_id":"..."}

Keep keys on the server

Never ship a key inside a browser or mobile app.

Anyone who reads it can spend your credits.