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)

OptionTypeDefaultDescription
apiKeystringPublishable key (ik_pub_…). Required.
mode'auto'|'local'|'remote''auto'Force a mode, or let it choose by device/tier.
modelstring'auto'Local model size: nano/small/balanced/quality, or 'auto'. 'auto' picks by detected GPU tier.
contextstring | object'page'Content scope. 'page' = current page only. 'site' = crawl same-origin /sitemap.xml. { urls: ['/docs/a', …] } = explicit pages. Object also accepts sitemap, maxPages (≤100), maxCharsPerPage, maxCorpusChars, fetchTimeoutMs, concurrency, sameOriginOnly, and credentials (default 'omit' — public content only; set 'same-origin' to crawl auth-gated pages). Same-origin only; answers cite the source page.
redactbool | string | objectfalseOpt-in masking of extracted text before it reaches the model. 'secrets' (API-key/JWT shapes), 'pii' (emails/phones/cards), ['secrets','pii'], true (both), or { secrets, pii, patterns:[RegExp], replacement }. Off by default — visible page text is already visible to the visitor.
gpuBenchmarkbooleantrueRun a brief WebGPU timing pass at init to refine the detected GPU tier (catches throttled/software GPUs).
groundingMinMatchesnumber1Min page-vocabulary overlap before a question reaches the model.
groundingbooleantrueDisable the on-page grounding gate.
autoOpenbooleanfalseOpen the widget on load.
refusalMessagestringCustom “I can only answer about this page” text.
onReady / onError / onMessagefunctionLifecycle callbacks.

The instance exposes ask(), open(), close(), on(evt, fn), and destroy().

Platform API (base: https://api.synapticortex.dev/v1)

EndpointAuthPurpose
GET /configpublishable keySDK init: tier, mode, model, limits, bot-challenge
POST /sessionpublishable keyExchange a Turnstile token for a short-lived session
POST /chatpublishable / secret keyRemote inference (SSE streaming)
POST /auth/signup · /auth/loginDeveloper accounts
GET /keys · POST /keys · …/rotate · DELETEJWTKey management (role-gated)
GET /usageJWTToken usage + breakdown
GET /org · members · POST /billing/checkoutJWTTeam & 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.