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
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
}'{
"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
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| POST | /v1/chat/completions | key | Chat inference — streaming (SSE) & buffered |
| GET | /v1/models | key | Models available across the network |
Marketplace
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /v1/nodes | public | Active nodes: wallet, reputation, models, prices |
| GET | /v1/stats | public | Network totals — nodes, jobs, tokens, treasury |
| GET | /v1/network/economics | public | Supply, burned, treasury, staker pool |
| GET | /v1/network/recent-jobs | public | Recent-jobs ticker (hashes + models only) |
| GET | /v1/jobs | key/session | Your recent jobs |
| GET | /v1/usage | key/session | Your jobs, tokens, and $QAIS spent |
Credit & sessions
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /v1/credit/info | public | Contract data needed to sign a spending cap |
| GET | /v1/sessions | key/session | Live session: cap, spend, balance, headroom |
| POST | /v1/sessions | key/session | Register an EIP-712 cap for batched settlement |
| GET | /v1/models/manifest | public | Signed model-digest manifest (404 if unpinned) |