REST API

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

Base URL

https://backend.sovereigneg.com/v1

Authentication

Include your API key in the Authorization header:

Authorization: Bearer sk-...

Chat completions

curl https://backend.sovereigneg.com/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-oss-20b",
    "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://backend.sovereigneg.com/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-oss-20b",
    "messages": [{"role": "user", "content": "Write a story"}],
    "stream": true
  }'

List models

curl https://backend.sovereigneg.com/v1/models \
  -H "Authorization: Bearer sk-..."

Authentication required: use your API key. The list shows the models your organization and project can call.

Embeddings

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

Response headers

API responses include an X-Request-Id header, and error bodies repeat it as error.request_id. Quote it when you contact support. Responses from /v1/chat/completions, /v1/embeddings, /v1/images/generations, /v1/decisions and /v1/systemone also include the rate-limit headers once your key is recognised, errors included:

HeaderDescription
X-RateLimit-Limit-RequestsYour effective RPM limit for this key
X-RateLimit-Remaining-RequestsRequests left in the current 60-second window

A request refused before it counts (a 422 for a body that fails validation, an expired key's 401, a 403 for a key or organization that may not use the endpoint) reports your key's bucket without spending from it, and a 429 from an RPM limit reports the bucket that refused it, with X-RateLimit-Remaining-Requests: 0, next to Retry-After. A missing, unknown or revoked key's 401, a request from an IP address that is not on your key's allow-list (whatever the error, its 403 ip_not_allowed included), a body the size limits refuse before your key is checked (413 request_too_large, 503 large_request_backpressure) and GET /v1/models don't carry them, and on other errors they are best effort: read them when present (see Rate Limits). Responses that our edge load balancer sends itself (a 429 with Retry-After: 1, a 413, or a 502/504 page) have no request ID and no rate-limit headers.

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)
REST API | SovereignEG Docs