Skip to main content

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:

HeaderStyleTypical client
Authorization: Bearer prx-…OpenAIOpenAI SDK, Cursor, Windsurf, Codex
x-api-key: prx-…AnthropicAnthropic 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​

StatusMeaning
401Missing or invalid key.
402No available credits or plan allowance. Review billing in the Primex app.
400Malformed request (bad model name, unsupported params).
429Rate or concurrency limited. Back off and retry.
5xxUpstream/gateway error. You are not charged (see Billing).