Chat persistence for the Vercel AI SDK
Threads, message trees, branching and resumable streams in your own database. Zero runtime dependencies.
Coverage
What ai-sdk-threads gives you
- One-line chat route
- chatHandler replaces the load, store, stream, store boilerplate every AI SDK app writes by hand.
- Branching
- Edit or regenerate and the old version survives as a sibling, the way ChatGPT does it.
- Resumable streams
- resumableChat ships the POST, GET and DELETE trio, so a reload mid-answer picks the stream back up.
- Postgres or SQLite
- One ThreadStore contract over either, verified by a parity suite run against both.
- UIMessage-native
- Parts and metadata stored verbatim, never flattened to a content string that loses tool calls.
- Zero runtime dependencies
- ai, drizzle-orm and resumable-stream are peers, the last two optional. Install only what you use.