|
| 1 | +--- |
| 2 | +title: Migrate AI SDK 5.0 to 6.0 Beta |
| 3 | +description: Learn how to upgrade AI SDK 5.0 to 6.0 Beta. |
| 4 | +--- |
| 5 | + |
| 6 | +# Migrate AI SDK 5.0 to 6.0 Beta |
| 7 | + |
| 8 | +<Note type="warning"> |
| 9 | + AI SDK 6 is currently in beta and introduces new capabilities like agents and |
| 10 | + tool approval. This guide will help you migrate from AI SDK 5.0 to 6.0 Beta. |
| 11 | + Note that you may want to wait until the stable release for production |
| 12 | + projects. See the [AI SDK 6 Beta announcement](/docs/announcing-ai-sdk-6-beta) |
| 13 | + for more details on what's new. |
| 14 | +</Note> |
| 15 | + |
| 16 | +## Recommended Migration Process |
| 17 | + |
| 18 | +1. Backup your project. If you use a versioning control system, make sure all previous versions are committed. |
| 19 | +1. Upgrade to AI SDK 6.0 Beta. |
| 20 | +1. Follow the breaking changes guide below. |
| 21 | +1. Verify your project is working as expected. |
| 22 | +1. Commit your changes. |
| 23 | + |
| 24 | +## AI SDK 6.0 Beta Package Versions |
| 25 | + |
| 26 | +You need to update the following packages to the beta versions in your `package.json` file(s): |
| 27 | + |
| 28 | +- `ai` package: `6.0.0-beta` (or use the `@beta` dist-tag) |
| 29 | +- `@ai-sdk/provider` package: `3.0.0-beta` (or use the `@beta` dist-tag) |
| 30 | +- `@ai-sdk/provider-utils` package: `4.0.0-beta` (or use the `@beta` dist-tag) |
| 31 | +- `@ai-sdk/*` packages: `3.0.0-beta` (or use the `@beta` dist-tag for other `@ai-sdk` packages) |
| 32 | + |
| 33 | +An example upgrade command would be: |
| 34 | + |
| 35 | +``` |
| 36 | +pnpm install ai@beta @ai-sdk/react@beta @ai-sdk/openai@beta |
| 37 | +``` |
| 38 | + |
| 39 | +## Codemods |
| 40 | + |
| 41 | +The AI SDK **will** provide Codemod transformations to help upgrade your codebase when a |
| 42 | +feature is deprecated, removed, or otherwise changed. |
| 43 | + |
| 44 | +Codemods are transformations that run on your codebase automatically. They |
| 45 | +allow you to easily apply many changes without having to manually go through |
| 46 | +every file. |
| 47 | + |
| 48 | +<Note> |
| 49 | + Codemods are intended as a tool to help you with the upgrade process. They may |
| 50 | + not cover all of the changes you need to make. You may need to make additional |
| 51 | + changes manually. |
| 52 | +</Note> |
| 53 | + |
| 54 | +## Codemod Table |
| 55 | + |
| 56 | +| Codemod Name | Description | |
| 57 | +| ------------ | ----------- | |
| 58 | +| TBD | TBD | |
0 commit comments