blob: 6e54178368a3d1c4873aefc0e781c2d1e12857c0 [file] [log] [blame] [view]
Mingyu Lei3caacb172024-11-01 07:18:551# Prompt API for extension
2
Mingyu Lei3caacb172024-11-01 07:18:553This document describes the status of the current implementation of the
Mike Wassermaned1591492025-05-01 04:54:574[**Prompt API**](https://github.com/webmachinelearning/prompt-api) for Chrome
5extensions, and how to verify.
Mingyu Lei3caacb172024-11-01 07:18:556
7## What’s supported
8
Mike Wassermaned1591492025-05-01 04:54:579The implementation generally intends to follow the
10[explainer](https://github.com/explainers-by-googlers/prompt-api).
Mingyu Lei3caacb172024-11-01 07:18:5511
12## Activation
13
14The API can be enabled by participating in the
Mike Wassermaned1591492025-05-01 04:54:5715[extension origin trial](https://developer.chrome.com/blog/prompt-api-origin-trial)
Mingyu Lei3caacb172024-11-01 07:18:5516named `AIPromptAPIForExtension`. After obtaining the trial token, the
Mike Wasserman38487222025-05-13 17:07:3217extension authors need to configure it in the `manifest.json`:
Mingyu Lei3caacb172024-11-01 07:18:5518
19```json
20{
Mingyu Lei3caacb172024-11-01 07:18:5521 "trial_tokens": [<GENERATED_TOKEN>],
22}
Mingyu Lei3caacb172024-11-01 07:18:5523```
24
25## Verifying the API is working
26
Mike Wassermaned1591492025-05-01 04:54:5727The extension authors can verify if the API is available by checking for the
Mike Wasserman38487222025-05-13 17:07:3228presence of the `LanguageModel` entrypoint from extension window and worker
29scripts. If the object is defined, the authors can follow the
30[explainer](https://github.com/explainers-by-googlers/prompt-api) and
31[developer docs](https://developer.chrome.com/docs/extensions/ai/prompt-api)
Mike Wassermaned1591492025-05-01 04:54:5732to check availability and test the APIs usage.
Mingyu Lei3caacb172024-11-01 07:18:5533
34## Related Links
35
Mike Wassermaned1591492025-05-01 04:54:5736- [Explainer on GitHub](https://github.com/webmachinelearning/prompt-api)
37- [API feedback](https://github.com/webmachinelearning/prompt-api/issues)
38- [Reporting bugs](https://issues.chromium.org/issues/new?component=1583624)
39- [Extension origin trial](https://developer.chrome.com/blog/prompt-api-origin-trial)
40- [Developer docs](https://developer.chrome.com/docs/extensions/ai/prompt-api)