API reference
Every export ai-sdk-threads ships, grouped by what you reach for it to do.
Everything here builds on one object. A store, created once from your drizzle instance, holds the threads and messages; the rest of the API is what that store can do and the route handlers that drive it.
New to the package? Getting started is a shorter path in.
The route
chatHandler is the whole chat route: it loads the thread, stores the incoming message, streams the answer, and stores the reply. Every option, what it does in order, and how to secure a thread.
resumableChat adds the POST, GET and DELETE trio, so a reload mid-answer picks the stream back up. Covers the Redis-backed context you need beyond a single instance.
Storing and reading
The store covers createThreadStore and every thread and message method, keyset pagination, orderPath, and how many round trips each operation costs.
Branching is regenerate, edit-and-fork and sibling navigation - the tree behind them, and why nothing is ever overwritten.
Converting
convertToUIMessages turns ModelMessage[] back into UIMessage[], the direction the AI SDK still does not ship.
Your database
Schema lists both tables, every column, and why the timestamps are millisecond precision.
SQLite is the same contract over SQLite, plus the three constraints that are not optional.
Migrating
Moving between AI SDK majors, or arriving from elsewhere? Migrating explains sdk_version and the migrate CLI, and Importing brings over the Vercel ai-chatbot template's tables.