[Experimental Feature] Add support for cross-origin storage#748
Merged
akaashrp merged 13 commits intomlc-ai:mainfrom Mar 22, 2026
Merged
[Experimental Feature] Add support for cross-origin storage#748akaashrp merged 13 commits intomlc-ai:mainfrom
akaashrp merged 13 commits intomlc-ai:mainfrom
Conversation
d353559 to
7cbfd07
Compare
tomayac
reviewed
Mar 20, 2026
Contributor
tomayac
left a comment
There was a problem hiding this comment.
This looks great. I just left a couple of suggestions, mostly minor cosmetic things like updating links and such.
Here's an additional suggestion for what you could add to the docs at docs/user/advanced_usage.rst (line 119):
Using Cross-Origin Storage Cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
WebLLM also supports caching model artifacts across different origins using the experimental Cross-Origin Storage API. You can enable this cache backend by setting ``appConfig.cacheBackend = "cross-origin"``. For users with the `Cross-Origin Storage browser extension <https://chromewebstore.google.com/detail/cross-origin-storage/denpnpcgjgikjpoglpjefakmdcbmlgih>`_ installed, resources will then be cached and shared across origins. This means two independent apps opted into this cache backend using the same AI model will download and cache the required resources only once. See the `cache usage example <https://github.com/mlc-ai/web-llm/tree/main/examples/cache-usage>`_ for more details. If Cross-Origin Storage isn't available, WebLLM will automatically fall back to using the default cache.
.. code-block:: typescript
const engine = await CreateMLCEngine("Llama-3.1-8B-Instruct", {
appConfig: {
cacheBackend: "cross-origin",
},
});
Co-authored-by: Thomas Steiner <tomac@google.com>
Co-authored-by: Thomas Steiner <tomac@google.com>
Co-authored-by: Thomas Steiner <tomac@google.com>
Co-authored-by: Thomas Steiner <tomac@google.com>
Co-authored-by: Thomas Steiner <tomac@google.com>
201ae5c to
731eaab
Compare
Contributor
|
Amazing, thank you very much for landing this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See apache/tvm#18893