API & SDK Reference
Most integrations only need the SDK (see Quickstart). This page summarizes the SDK surface and the Platform API for advanced / server-side use.
SDK — InferKit.init(config)
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | — | Publishable key (ik_pub_…). Required. |
mode | 'auto'|'local'|'remote' | 'auto' | Force a mode, or let it choose by device/tier. |
model | string | 'auto' | Local model size: nano/small/balanced/quality, or 'auto'. 'auto' picks by detected GPU tier. |
gpuBenchmark | boolean | true | Run a brief WebGPU timing pass at init to refine the detected GPU tier (catches throttled/software GPUs). |
groundingMinMatches | number | 1 | Min page-vocabulary overlap before a question reaches the model. |
grounding | boolean | true | Disable the on-page grounding gate. |
autoOpen | boolean | false | Open the widget on load. |
refusalMessage | string | — | Custom “I can only answer about this page” text. |
onReady / onError / onMessage | function | — | Lifecycle callbacks. |
The instance exposes ask(), open(), close(), on(evt, fn), and destroy().
Platform API (base: https://api.synapticortex.dev/v1)
| Endpoint | Auth | Purpose |
|---|---|---|
GET /config | publishable key | SDK init: tier, mode, model, limits, bot-challenge |
POST /session | publishable key | Exchange a Turnstile token for a short-lived session |
POST /chat | publishable / secret key | Remote inference (SSE streaming) |
POST /auth/signup · /auth/login | — | Developer accounts |
GET /keys · POST /keys · …/rotate · DELETE | JWT | Key management (role-gated) |
GET /usage | JWT | Token usage + breakdown |
GET /org · members · POST /billing/checkout | JWT | Team & billing (role-gated) |
Errors
Every error returns a stable shape:
{ "error": { "code": "rate_limited", "message": "…", "request_id": "9f3c…" } }
Branch on code; quote request_id to support. Full catalog: ERRORS.md.
Server-side use (Mode B)
Keep a secret key on your server and either call /v1/chat directly, or front
InferKit with your own proxy and point the SDK at it via endpoint. Secret keys
support an IP allowlist and are exempt from the browser bot challenge.