Skip to main content

1. Register a backend, then initialize

initialize is async here, unlike the native SDKs, and takes one options object.

2. Generate text

Generation auto-loads what it needs, and downloads the model when options.model names one that is not on disk.

3. Stream it instead

Breaking out of the loop cancels the request.

4. Hold a conversation

generate takes either a string or a message array.

5. Add speech

A complete page

Next

Managing models

Download, load, and storage

Tool calling

Let the model call your functions

Voice agent

A full spoken conversation

Error handling

What throws and when