Skip to main content

Packages

npm install pulls the WASM artifacts with the packages. There is no separate WASM build step and no Emscripten toolchain to install.

Cross-origin isolation

This is the one thing that stops a first attempt working. The SDK needs SharedArrayBuffer, which browsers only expose to a cross-origin isolated page. Serve both headers:
For Vite in development:
vite.config.ts
For Vercel:
vercel.json
Where you cannot set headers, a service worker can add them client-side. That is what coi-serviceworker.js does, and it is also what forces the one-time reload you will see on Safari. If you see SharedArrayBuffer is not defined, the page is not isolated. Nothing else is wrong.

Registering a backend

Register before initializing.
autoRegister picks the CPU or WebGPU build for the current browser.

Build-time configuration

For a hosted deployment, two Vite variables boot the SDK straight into production: Both must be set, or the app boots in the development environment.

Where models are stored

Downloads land in OPFS by default, which is private to the origin. The user can grant a real directory instead. See Configuration.

Troubleshooting