HTTP API

OpenAI-compatible endpoint for CLIs, CI, and your own tools.

Auth

Generate a key in the Console → API Keys. Pass it as a Bearer token.

Authorization: Bearer cx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

POST /v1/chat/completions

OpenAI Chat Completions wire format. We proxy to Anthropic / OpenAI / etc. based on the model.

curl https://api.codexax.com/v1/chat/completions \
  -H "Authorization: Bearer cx_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "messages": [
      {"role": "system", "content": "You are concise."},
      {"role": "user",   "content": "Explain MCP in one sentence."}
    ]
  }'

Models

  • claude-opus-4-5 — most capable, slower, $15/$75 per 1M tokens
  • claude-sonnet-4-5 — default, balanced, $3/$15
  • claude-haiku-4-5 — fastest, $1/$5
  • gpt-5, gpt-5-mini — OpenAI
  • gemini-2.5-pro, gemini-2.5-flash — Google

GET /v1/usage/summary

Your month-to-date usage. Returns calls, in/out token totals, and spend.

GET /v1/usage/recent

Last 50 API calls with model, tokens, and cost per call.

Rate limits

  • Hobby — 200 chat msgs / month, 10 req/min.
  • Pro — fair use; ~10× the Hobby quota, 60 req/min.
  • Team — pooled quota, 300 req/min per org.

When you hit a limit you get HTTP 429 with Retry-After.

Errors

401  invalid_token        — bad or expired API key
403  forbidden            — key revoked
429  rate_limited         — slow down (Retry-After header)
502  upstream_error       — model provider failed; retry
503  stripe_not_configured — billing endpoint not set up