Skip to main content
RunAnywhere.models is the model catalog and its residency. In a browser it matters more than anywhere else, because the download is the user’s bandwidth and the storage is their disk.

The short version

Generation loads what it needs and downloads when options.model names a model that is not present:
Reach for the models namespace when you want to control when that cost is paid, show progress, or let a person choose.

What is available

list, get, and register are synchronous on Web and async on every other SDK. Code ported from Swift or React Native will have await in the wrong places.

Downloading, with progress

Progress carries bytesDone, bytesTotal, fraction, percent, bytesPerSecond, etaSeconds, retryAttempt, currentFileIndex, totalFiles, and overallProgress. Show the size before you start. A 2GB download over a metered connection is a real cost, and a browser gives the user no other warning.

Where downloads go

This is the browser-specific part, and it decides whether a returning user re-downloads everything.
Offer a real directory to anyone who will come back:
chooseDirectory() requires a user gesture. Calling it outside a click handler is rejected by the browser, not by the SDK.
After a reload, a granted directory has to be re-acquired, and a lapsed permission re-asked:
Neither happens automatically.

Loading

Downloading puts the model in storage. Loading puts it in memory.
contextLength costs memory whether you use it or not. A tab has less headroom than a phone, so allocate what your longest conversation actually needs.

CPU or WebGPU

autoRegister picks the right build for the browser, so you normally do not choose. When a WebGPU model produces garbage, switch that model to its CPU variant rather than disabling WebGPU globally.

Will it fit

checkCompatibility exists only on Web. Use it before offering a large model.

Switching models

In a tab, unload before loading. Holding two language models is how you get insufficientMemory. Or switch per call, without touching residency:

Unloading

Frees memory and leaves the bytes in storage, so the next load is fast.

What is resident right now

Deleting and reclaiming space

storage.refresh() returns the number of entries reconciled. Call it after the user has deleted files outside the app, or after a storage backend change.

Registering your own model

Synchronous, like list and get. The URL has to be reachable from the page, which means CORS applies. A model host that does not send permissive headers will fail the fetch, and that failure looks like a network error rather than a configuration one. This bites more on Web than on any other platform.

Gated repositories

Never ship a server-side secret this way. Vite inlines build-time variables into the bundle, so anything you put there is public.

A complete picker

Errors worth handling

Storage errors on Web are about the origin’s quota, which is smaller than the disk and varies by browser. Offering a real directory through chooseDirectory() sidesteps it.