Open Source 🇺🇸 27.07.2026 21:04

Experiments with the Proposed Cross-Origin Storage API in Transformers.js

Hugging FaceHugging Face
Transformers.js faces a caching issue: when using the same AI model or Wasm runtime across different websites, the browser downloads and caches them repeatedly due to origin-based cache isolation. The proposed Cross-Origin Storage (COS) API addresses this by identifying files by cryptographic hash rather than URL, enabling secure resource sharing across different origins.
Transformers.js is a library for running transformer models in the browser. When a model — for example, Xenova/whisper-tiny.en — is loaded, the browser caches it via the Cache API. However, when visiting another site that uses the same model, the browser downloads it again (177 MB of duplicated data), because the HTTP cache is isolated by origin (the Network Isolation Key includes both the top-level site and the current-frame site). The same applies to the Wasm runtime ort-wasm-simd-threaded.asyncify.wasm (4,733 KB), which is shared across different models. The proposed Cross-Origin Storage (COS) API introduces navigator.crossOriginStorage, which identifies files by their hash (SHA-256). Developers can store and read files via requestFileHandle(hash). Files can be made globally accessible (origins: '*'), restricted to a list of specific origins, or limited to same-site access only. The hash is verified on write, ensuring integrity. Visibility can only be expanded, never narrowed. For privacy purposes, COS prevents probing via origins and hashes. The API is still experimental but is available through the Cross-Origin Storage extension.
Source: Hugging Face blog — original
Our earlier posts on this topic ↓
Fresh news