demo · v137 · origin trial

Rewriter API

On-device Rewriter refactors text in-place by tone, length, or format — same Gemini Nano backend as the rest of the built-in AI APIs, but specialised for rewrites. Paste text on the left, pick a tone / length, click rewrite.

Heads up · origin trial / flagEnable chrome://flags/#rewriter-api-for-gemini-nano and ensure Optimization Guide On Device Model is downloaded via chrome://components. If the API isn't available the probe and right-hand panel will say so.
probing…
no output yet

the code

const rewriter = await Rewriter.create({ tone: "more-formal", length: "as-is" });
const stream = await rewriter.rewriteStreaming(text);
for await (const chunk of stream) out.textContent += chunk;

see also