Keys and authentication
API keys, the Authorization and x-api-key headers, SDK environment variables.
Every request is authorized with an API key. Keys are issued in the cabinet's “API keys” section; the key is stored encrypted and you can copy it at any time with “Show key”. The oldest keys, issued before this button existed, do not have it: if you lose such a key, issue a new one.
Headers
Pass the key in the Authorization: Bearer header — this is what
OpenAI-compatible SDKs and tools use:
curl https://llmbox.cc/v1/models \
-H "Authorization: Bearer $LLMBOX_API_KEY"
The gateway also accepts the key in the x-api-key header. Both headers work on every endpoint.
$LLMBOX_API_KEY in all examples is a placeholder. Put your own key from
the cabinet in its place: the documentation never injects real secrets.
GET /v1/models works without a key. But if a key header is sent, the key must
be valid: an invalid key gets 401 invalid_api_key.
SDK environment variables
The OpenAI SDK (Python and Node) reads the OPENAI_BASE_URL / OPENAI_API_KEY
pair:
export OPENAI_BASE_URL=https://llmbox.cc/v1
export OPENAI_API_KEY=$LLMBOX_API_KEY
LiteLLM-based tools (such as aider) read OPENAI_API_BASE instead of
OPENAI_BASE_URL. Ready-made configs are in Integrations.
Key safety
- Do not commit the key to repositories or embed it in client-side code — pass it through environment variables or CI secrets.
- A key can have a spend limit: once reached, new requests get
403 spend_limit_exceededwhile your other keys keep working. - A compromised key can be revoked in the cabinet instantly; a revoked key cannot be restored — issue a new one.
Requests from a browser
/v1/* answers CORS from any origin and uses no cookies — the key travels
only in a header. A key in browser code is visible to anyone using the page, so
a frontend needs its own server-side proxy that keeps the key and calls the
gateway itself.