Migrate AI SDK 5.0 to 6.0 Beta

AI SDK 6 is currently in beta and introduces new capabilities like agents and tool approval. This guide will help you migrate from AI SDK 5.0 to 6.0 Beta. Note that you may want to wait until the stable release for production projects. See the AI SDK 6 Beta announcement for more details on what's new.

  1. Backup your project. If you use a versioning control system, make sure all previous versions are committed.
  2. Upgrade to AI SDK 6.0 Beta.
  3. Follow the breaking changes guide below.
  4. Verify your project is working as expected.
  5. Commit your changes.

AI SDK 6.0 Beta Package Versions

You need to update the following packages to the beta versions in your package.json file(s):

  • ai package: 6.0.0-beta (or use the @beta dist-tag)
  • @ai-sdk/provider package: 3.0.0-beta (or use the @beta dist-tag)
  • @ai-sdk/provider-utils package: 4.0.0-beta (or use the @beta dist-tag)
  • @ai-sdk/* packages: 3.0.0-beta (or use the @beta dist-tag for other @ai-sdk packages)

An example upgrade command would be:

pnpm install ai@beta @ai-sdk/react@beta @ai-sdk/openai@beta

Codemods

The AI SDK will provide Codemod transformations to help upgrade your codebase when a feature is deprecated, removed, or otherwise changed.

Codemods are transformations that run on your codebase automatically. They allow you to easily apply many changes without having to manually go through every file.

Codemods are intended as a tool to help you with the upgrade process. They may not cover all of the changes you need to make. You may need to make additional changes manually.

Codemod Table

Codemod NameDescription
TBDTBD