> For the complete documentation index, see [llms.txt](https://docs.aibrow.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aibrow.ai/examples/rewriter-api.md).

# Rewriter API

The rewriter API allows you to rewrite some text using the language model.

{% hint style="success" %}
This API is compatible with the [Writing assistance API proposal](https://github.com/WICG/writing-assistance-apis) shipping with Google Chrome
{% endhint %}

Use the rewriter API to change the length of some text, change the formality, rephrase text or change it to use simpler words and concepts (i.e. explain like I'm 5)

<pre class="language-javascript"><code class="lang-javascript">import AI from '@aibrow/web'

<strong>const rewriter = await AI.AIBrow.Rewriter.create({
</strong>  tone: "more-formal",
  length: "as-is"
})

// Prompt the model and wait for the whole result to come back.
const result = await rewriter.rewrite("An article comparing Vim vs Emacs as the best text editor")

// Prompt the model and stream the result:
const stream = await rewriter.rewriteStreaming("An article comparing Vim vs Emacs as the best text editor")
for await (const chunk of stream) {
  console.log(chunk)
}
</code></pre>
