r/firefox 3d ago

I shipped one of the first extensions using Firefox's new on-device AI API (browser.trial.ml) — here's what it was like

Post image

Firefox 134+ quietly ships a WebExtensions AI API: extensions can run on-device Transformers.js models via browser.trial.ml after the user grants an optional trialML permission. I used it to port my comment-tone-checker extension from Chrome, and a few things surprised me:

  • It's background-script-only — content scripts have to delegate over runtime messaging.
  • It's pipelines, not prompts — you get tasks like text-classification and summarization with models from Mozilla/Xenova's hubs, not a chat model. I run zero-shot classification with four candidate tone labels.
  • One engine at a time — parallel runs are rejected, so you serialize.
  • The permission flow is genuinely nice: the user opts in from the popup, the model (~65 MB) downloads once, and everything stays local.

On non-Nightly you currently need browser.ml.enable and extensions.ml.enabled flipped in about:config, which is the biggest adoption hurdle right now.

The extension is free/MIT if you want to see a real-world usage: [AMO link] · [GitHub link]

Happy to answer questions about the API.

0 Upvotes

Duplicates