Prompt API for extension

This document describes the status of the current implementation of the Prompt API for Chrome extension, and how to verify.

Note that this API is not available by default. Chrome plans to do an extension origin trial starting from M131 to evaluate its effectiveness and to allow extension authors to give feedback.

What’s supported

The API is implemented according to the explainer, but the API namespace will be under chrome.aiOriginTrial.languageModel for the extension origin trial.

Activation

The API can be enabled by participating in the extension origin trial named AIPromptAPIForExtension. After obtaining the trial token, the extension authors need to configure it in the manifest.json together with the aiLanguageModelOriginTrial permission.

{
  "permissions": ["aiLanguageModelOriginTrial"],
  "trial_tokens": [<GENERATED_TOKEN>],
}

Verifying the API is working

The extension authors can verify if the API is available by checking the chrome.aiOriginTrial.languageModel from the service worker script. If the AILanguageModel object is defined, the authors can follow the explainer to test the APIs usage.

Related Links