Authentication
Every request is authenticated with your Primex API key (prx-…). The gateway
accepts both common header styles on all routes, so whichever SDK you use
will work:
| Header | Style | Typical client |
|---|---|---|
Authorization: Bearer prx-… | OpenAI | OpenAI SDK, Cursor, Windsurf, Codex |
x-api-key: prx-… | Anthropic | Anthropic SDK, Claude Code, Cline |
Examples
# OpenAI style
curl https://gateway.primexos.com/v1/chat/completions \
-H "Authorization: Bearer prx-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.5","messages":[{"role":"user","content":"hi"}]}'
# Anthropic style
curl https://gateway.primexos.com/v1/messages \
-H "x-api-key: prx-YOUR_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-opus-4-8","max_tokens":256,"messages":[{"role":"user","content":"hi"}]}'
Keeping keys safe
- Never commit keys to source control or ship them in client-side code. Use
environment variables (
OPENAI_API_KEY,ANTHROPIC_API_KEY). - Your key can spend from your AI account. Treat it like a wallet credential.
- Rotate a key immediately if it may have leaked. See API Keys.
Errors
| Status | Meaning |
|---|---|
401 | Missing or invalid key. |
402 | No available credits or plan allowance. Review billing in the Primex app. |
400 | Malformed request (bad model name, unsupported params). |
429 | Rate or concurrency limited. Back off and retry. |
5xx | Upstream/gateway error. You are not charged (see Billing). |