# Writer API

The writer API allows you to generate 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 writer API to generate textual explanations of structured data, expand pro/con lists, break through writer's block and create a first draft of blog articles.

```javascript
import AI from '@aibrow/web'

const writer = await AI.AIBrow.Rriter.create({
  tone: "formal",
  length: "medium"
})

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

// Prompt the model and stream the result:
const stream = await writer.writeStreaming("An article comparing Vim vs Emacs as the best text editor")
for await (const chunk of stream) {
  console.log(chunk)
}
```
