Reference

API reference

The gateway speaks the OpenAI chat-completions protocol and adds a small marketplace surface on top. Base URL: https://gateway.querais.xyz. See For developers for SDK quickstarts.

Authentication

Most write endpoints take an API key as Authorization: Bearer sk-…. The web dashboard instead uses a wallet session (EIP-4361 “Sign-In with Ethereum”) carried in a cookie; where both are present, the bearer key wins. Public endpoints need no auth.

Example — chat completion

request
curl https://gateway.querais.xyz/v1/chat/completions \
  -H "Authorization: Bearer $QUERAIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma3:4b",
    "messages": [{"role": "user", "content": "Hello"}],
    "stream": false
  }'
response
{
  "id": "chatcmpl-9f2c…",
  "object": "chat.completion",
  "model": "gemma3:4b",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Hello! How can I help?" },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 9, "completion_tokens": 7, "total_tokens": 16 }
}

The response mirrors OpenAI’s shape. Set "stream": true for token-by-token Server-Sent Events; in-band errors arrive as an SSE frame with an error field (HTTP 200), so check for it while streaming.

Endpoints

OpenAI-compatible

MethodEndpointAuthPurpose
POST/v1/chat/completionskeyChat inference — streaming (SSE) & buffered
GET/v1/modelskeyModels available across the network

Marketplace

MethodEndpointAuthPurpose
GET/v1/nodespublicActive nodes: wallet, reputation, models, prices
GET/v1/statspublicNetwork totals — nodes, jobs, tokens, treasury
GET/v1/network/economicspublicSupply, burned, treasury, staker pool
GET/v1/network/recent-jobspublicRecent-jobs ticker (hashes + models only)
GET/v1/jobskey/sessionYour recent jobs
GET/v1/usagekey/sessionYour jobs, tokens, and $QAIS spent

Credit & sessions

MethodEndpointAuthPurpose
GET/v1/credit/infopublicContract data needed to sign a spending cap
GET/v1/sessionskey/sessionLive session: cap, spend, balance, headroom
POST/v1/sessionskey/sessionRegister an EIP-712 cap for batched settlement
GET/v1/models/manifestpublicSigned model-digest manifest (404 if unpinned)