API Reference
Chat Completions
Create a model response. OpenAI-compatible — works with any OpenAI SDK by changing the base URL.
POST /v1/chat/completions
Request
Headers
| Header | Required | Description |
| Authorization | ✅ | Bearer ngk_your_key |
| Content-Type | ✅ | application/json |
Body parameters
| Parameter | Type | Required | Description |
| model | string | ✅ | Model ID or "auto" for smart routing |
| messages | array | ✅ | Array of message objects with role and content |
| max_tokens | integer | — | Maximum tokens to generate |
| stream | boolean | — | Enable SSE streaming (default: false) |
| temperature | float | — | Sampling temperature 0–2 |
| tier | string | — | cheapest | balanced | fastest |
| privacy_mode | boolean | — | Never use cloud fallback |
| trusted_only | boolean | — | Only trust_score > 0.8 hosters |
| max_latency_ms | integer | — | Skip hosters slower than N ms |
| fallback_models | array | — | Ordered fallback model IDs |
| allow_hosters | array | — | Allowlist of hoster UUIDs |
| deny_hosters | array | — | Denylist of hoster UUIDs |
Example request
curl https://api.computeshare.servequake.com/v1/chat/completions \
-H "Authorization: Bearer ngk_your_key" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum entanglement briefly."}
],
"max_tokens": 200
}'
Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1744502400,
"model": "auto",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum entanglement is a phenomenon where..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 64,
"total_tokens": 92
}
}
Message roles
| Role | Description |
| system | Instructions for the model. Sets behavior and context. |
| user | The human's message. |
| assistant | Previous model responses (for multi-turn conversations). |
Error codes
| Code | Meaning |
| 401 | Invalid or missing API key |
| 402 | Insufficient credits or daily spend cap reached |
| 429 | Rate limit exceeded. Check Retry-After header. |
| 500 | Internal error — all hosters failed or upstream unavailable |