The Rewriter API is a Chrome Built-in AI API for revising existing text. It is better understood as an editing API than a blank-page generation API: it can make text shorter or longer, adjust tone, and return a chosen output format.
Main options
- length: shorter, as-is, or longer
- tone: more-formal, as-is, or more-casual
- format: as-is, markdown, or plain-text
- sharedContext: common background for multiple rewrites
These options are set when creating a rewriter object. If you need a different setup, create a new rewriter instead of expecting the existing object to change behavior.
Exact character counts need app logic
The API can request shorter or longer output, but it does not guarantee an exact character count such as exactly 120 characters. If character length matters, count the output in your app and retry or adjust from there.
Basic implementation
if ('Rewriter' in self) {
const availability = await Rewriter.availability();
if (availability !== 'unavailable') {
const rewriter = await Rewriter.create({
format: 'plain-text',
length: 'shorter',
tone: 'as-is'
});
const result = await rewriter.rewrite(inputText, {
context: 'Keep the meaning and proper nouns while making this shorter.'
});
rewriter.destroy();
}
}A real interface should also handle availability(), first-run model preparation, downloadprogress, loading states, and failure states. Even in a supported browser, model preparation can take time.
Consider language settings
The API can accept expectedInputLanguages, expectedContextLanguages, and outputLanguage. Setting them helps the browser reject unsupported language combinations instead of silently producing unsuitable output.
Current caveats
- Treat the Rewriter API as a pre-Stable trial API
- Check Origin Trial registration status and supported Chrome versions
- Behavior can change with Chrome versions and trial requirements
- The model may need a first-run download
- Review the result for changed meaning or proper nouns
- Validate exact length or formatting rules in your app
Rewriter API fits interfaces that polish existing input, such as form text, reviews, meta description drafts, and short explanatory copy. Because availability still depends on trial conditions, be cautious about making it a core public feature.