Overview
The ZeroGPU browser SDK turns the browsers running your website or web app into on-device inference nodes on the ZeroGPU network. It downloads a small model, registers the device, and serves inference tasks locally, in a Web Worker so your page’s main thread stays responsive. Add it with the always-latest loader script fromjs-sdk.zerogpu.ai, or install the npm package if you bundle your own JavaScript.
Building a Chrome extension instead? See Chrome Extension. Building a Telegram Mini App? See Telegram Mini Apps.
Requirements
- A modern desktop or mobile browser with WebAssembly, IndexedDB (for the model cache), and Web Workers.
- An SDK key (
zgpu-sdk-…) from the Edge Operator Portal. - Websites with a strict Content Security Policy: allow
blob:workers, or host the worker yourself and setoverrides.inference.workerUrl.
Download
Installation
Add the loader to your page. It always resolves the latest released SDK, so you never pin or bump versions:Initialization
Script tag (auto-init). The SDK starts as soon asedgeOperatorKey is present:
initZeroGpuSdk. Calls made before the SDK finishes loading are queued and replayed:
App ID and app name (optional)
Pass the app ID and name from the Edge Operator Portal so the inference this browser serves is attributed to your app. Copy the ID from your app’s row on My Apps.initZeroGpuSdk, pass appId and appName instead. Both are optional: leaving them unset never affects registration or inference, and ZeroGPU then uses the app your SDK key belongs to.
| overrides.telemetry.enableConsoleLogs | Log SDK activity to the console (redacted). Script tag: enableConsoleLogs="true". |
| overrides.inference.workerUrl | Same-origin worker URL for pages whose CSP forbids blob: workers. |
Authentication
The SDK authenticates with your SDK key (zgpu-sdk-…), passed as edgeOperatorKey. The key can only join devices to your fleet; it can’t call the inference API or spend credits. Still, inject it at build time rather than committing it.
Register device
Registration is automatic. When the SDK starts with your SDK key, it checks the device can run a model, downloads one, and connects the device to ZeroGPU. Models are cached, so later starts are faster. To match the device to a model, the SDK shares coarse device information, such as platform, CPU cores, approximate memory, and battery level.Start contributing compute
The SDK starts when it’s initialized with your SDK key and keeps contributing while the page is open.Stop / pause
initZeroGpuSdk returns a handle. Call shutdown() to stop gracefully:
Device lifecycle
The handle’sstatus is one of starting, running, degraded, shutdown, or error. Subscribe to changes:
initZeroGpuSdk never throws: if the SDK can’t run on a device, status reports it instead of breaking your page. Before downloading models, the SDK checks memory and storage, and blocks downloads when the battery is below 20% and the device isn’t charging.
Example integration
index.html
enableConsoleLogs on, you’ll see the SDK register the device, load a model, and become ready.
Once the device is online, check that it’s eligible and earning.

