REST API

No SDK required. SovereignEG's API is standard REST with JSON request/response bodies.

Base URL

https://sovereigneg.com/v1

Authentication

Include your API key in the Authorization header:

Authorization: Bearer sk-...

Chat completions

curl https://sovereigneg.com/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "...",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is 2+2?"}
    ],
    "temperature": 0.7,
    "max_tokens": 100
  }'

Streaming with curl

Add -N to disable buffering and "stream": true in the body:

curl -N https://sovereigneg.com/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "...",
    "messages": [{"role": "user", "content": "Write a story"}],
    "stream": true
  }'

List models

curl https://sovereigneg.com/v1/models

No authentication required.

Embeddings

curl https://sovereigneg.com/v1/embeddings \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "...",
    "input": "Hello from Cairo!"
  }'

Response headers

Every response includes these headers:

HeaderDescription
X-Request-IdUnique request ID for debugging
X-RateLimit-Limit-RequestsYour RPM limit
X-RateLimit-Remaining-RequestsRequests remaining

Note: spending is enforced through your organization's EGP credit balance, not through a tokens-per-minute header. See Rate Limits and Error Codes.

HTTP status codes

See Error Codes for the full table including machine-readable code values per status.

CodeMeaning
200Success
201Created (e.g. new API key)
400Bad request (invalid parameters)
401Unauthorized (invalid or missing API key)
402Quota / spend cap exhausted — top up or raise the cap
403Forbidden (org suspended, model not on your plan, IP not allow-listed…)
404Resource not found
409Conflict (idempotency / uniqueness collision)
422Schema validation failed
429Rate limited (check Retry-After header)
500Internal server error
503Service unavailable (model temporarily down)