
AI SDK Migration
OfficialFreeStreamline your upgrade from AI SDK 6.x to 7.0.
Free · Opens the source repo
What AI SDK Migration does
The AI SDK Migration skill is designed to assist developers in transitioning their applications from AI SDK version 6.x to version 7.0. This skill serves as a practical checklist that guides users through the migration process, ensuring that they adhere to the necessary steps and updates required by the new version. It leverages the official migration guide as a source of truth, providing a structured approach to handle the migration effectively.
To use this skill, developers should begin by ensuring they have a clean backup of their project before making any changes. The skill prompts users to inspect their package.json and lockfiles to identify the relevant SDK packages and dependencies that need to be upgraded. It emphasizes the importance of adhering to the new runtime requirements, such as using Node.js version 22 or higher and migrating to ESM imports. The skill also highlights key changes in API calls and options, allowing developers to make informed decisions about how to adapt their code.
This skill is particularly useful for teams that are upgrading their applications to leverage the latest features and improvements in AI SDK 7.0. It addresses common migration errors and provides a clear pathway for developers to follow, reducing the risk of issues during the upgrade process. By following the outlined steps, developers can ensure that their applications maintain functionality while adopting the new SDK standards.
Overall, the AI SDK Migration skill is an essential tool for developers looking to upgrade their applications seamlessly. It not only simplifies the migration process but also ensures that best practices are followed, ultimately leading to a smoother transition to the latest SDK version.
When to use it
Use this skill when you are preparing to upgrade your applications that rely on the Vercel AI SDK and need guidance on the migration process.
When not to use it
This skill is not suitable for projects that do not currently use AI SDK 6.x or for those that are not planning to upgrade to version 7.0.
What you can build with it
Upgrading a Legacy Application
A developer needs to upgrade a legacy application using AI SDK 6.x to take advantage of new features in SDK 7.0.
Resolving Migration Errors
A team encounters errors during the migration process and uses this skill to identify and fix issues.
Preparing for Future SDK Updates
A developer wants to ensure their application is ready for future updates by following best practices during the migration to SDK 7.0.
How to install AI SDK Migration
View source1. Install with the skills CLI
npx skills add vercel/ai/migrate-ai-sdk-v6-to-v7 --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by vercelAI SDK 6 to 7 Migration
Use content/docs/08-migration-guides/23-migration-guide-7-0.mdx from the AI SDK repo as the source of truth. This skill is the working checklist; read the guide for exact examples or when behavior is unclear.
Migration Workflow
- Ensure the user has a clean backup or committed baseline before editing.
- Inspect
package.jsonand lockfiles to identify installedai,@ai-sdk/*, provider, UI, MCP, and telemetry packages. - Upgrade AI SDK packages to latest versions, and add
@ai-sdk/otelonly if the project uses OpenTelemetry spans. - Update runtime and module assumptions: Node.js must be
>=22, and AI SDK packages are ESM-only. Replacerequire()imports with ESM imports and add"type": "module"or use.mjswhere needed. - Search for the v6 patterns below, migrate only the code that exists, then run typecheck and targeted tests.
Prefer behavior-preserving changes. When v7 changes semantics, decide whether the app wants the new all-steps behavior or the previous final-step-only behavior.
Core API Changes
experimental_customProvider->customProvider.experimental_generateImage->generateImage;Experimental_GenerateImageResult->GenerateImageResult.experimental_transcribe->transcribe;Experimental_TranscriptionResult->TranscriptionResult.experimental_generateSpeech->generateSpeech;Experimental_SpeechResult->SpeechResult.experimental_outputoption/result ->outputoption/result.CallSettings->LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>;prepareCallSettings->prepareLanguageModelCallOptions.stepCountIs->isStepCount.
Prompts and Steps
- Rename top-level
systemtoinstructionsforgenerateText,streamText,generateObject,streamObject, andstreamUI. - Move
{ role: 'system' }messages frompromptormessagesinto top-levelinstructions. Only useallowSystemInMessages: truefor trusted persisted messages. - Rename
experimental_prepareSteptoprepareStep. - In
prepareStep, rename returnedsystemtoinstructions. - In
experimental_repairToolCall, use{ instructions }instead of{ system }. - Audit
prepareStepbehavior: returnedinstructionsandmessagesnow carry forward into later steps. If code depended on one-step-only overrides, rebuild frominitialInstructions,initialMessages, andresponseMessagesexplicitly.
Lifecycle Callbacks
experimental_onStart->onStart.experimental_onStepStart->onStepStart.onFinish->onEnd.onStepFinish->onStepEnd.- For
embed,embedMany, andrerank,experimental_onFinish->onEnd. - Callback event fields use
instructionsinstead ofsystem.
Usage, Telemetry, and Include Options
usage.cachedInputTokens->usage.inputTokenDetails.cacheReadTokens.usage.reasoningTokens->usage.outputTokenDetails.reasoningTokens.- OpenTelemetry moved out of
ai; install@ai-sdk/oteland callregisterTelemetry(new OpenTelemetry(...))at app startup. - Telemetry is enabled by default once an integration is registered. Remove redundant
isEnabled: true; useisEnabled: falseto opt out per call. - Move
experimental_telemetry.tracerinto theOpenTelemetryconstructor. experimental_telemetry->telemetry.- Telemetry integration callbacks:
onRerankFinish->onRerankEnd,onEmbedFinish->onEmbedEnd. Update tracing-channel subscribers for the same event type names. experimental_include->include.includeRawChunks->include.rawChunks.- Request and response bodies are excluded by default. If code reads
request.bodyorresponse.body, opt in withinclude.requestBodyand, forgenerateText,include.responseBody.
Streaming, Messages, and Tools
StreamTextResult.fullStream->stream.streamTextonChunknow receives all stream parts, including lifecycle, boundary, finish, abort, and error parts. Guard bychunk.typebefore assuming text/tool/raw content.step.response.messagesis no longer accumulated across previous steps. Useresult.responseMessagesfor the full response message history, or flattenresult.steps.- Tool execution callbacks:
experimental_onToolCallStart->onToolExecutionStart,experimental_onToolCallFinish->onToolExecutionEnd. - Tool callback
experimental_context->context. - Split shared runtime data from tool-specific data: use top-level
runtimeContextfor orchestration state, declare per-toolcontextSchema, and pass per-tool values throughtoolsContext. - Move
needsApprovalfromtool()/dynamicTool()into per-call or agenttoolApproval. experimental_activeTools->activeTools.ToolCallOptions->ToolExecutionOptions.isToolOrDynamicToolUIPart->isToolUIPart.
Content Parts and Reasoning
- Tool result
{ type: 'media' }is removed; use{ type: 'file-data' }. - Migrate
toModelOutputimage-*,file-*,file-id, andimage-file-idvariants to canonical{ type: 'file', mediaType, data: { type: 'data' | 'url' | 'reference', ... } }. - User message
{ type: 'image', image, mediaType? }is deprecated; use{ type: 'file', mediaType: 'image' | 'image/*', data }. - Add support for the new
reasoning-filecontent type in exhaustive switches, renderers, serializers, and validators. - When adopting top-level
reasoning, remove overlapping provider-specific reasoning settings fromproviderOptionsunless provider-specific settings intentionally take precedence.
Multi-Step Result Shape
result.usagenow includes all steps;result.totalUsageis deprecated. Useresult.finalStep.usagefor final-step-only usage.- Top-level
content,toolCalls,staticToolCalls,dynamicToolCalls,toolResults,staticToolResults,dynamicToolResults,files,sources, andwarningsnow include all steps. UsefinalStepfor previous final-step-only behavior. - Top-level
reasoning,reasoningText,request,response, andproviderMetadataare deprecated for final-step data. Useresult.finalStep.*; forstreamText, awaitresult.finalStep. - Apply the same result-shape rules to
onEndevents.
Stream Response Helpers
The streamText result helper methods are deprecated. Replace result methods with top-level stateless helpers:
result.toUIMessageStream(...)->toUIMessageStream({ stream: result.stream, ... }).result.toUIMessageStreamResponse(...)->toUIMessageStream(...)pluscreateUIMessageStreamResponse({ stream }).result.pipeUIMessageStreamToResponse(response, ...)->toUIMessageStream(...)pluspipeUIMessageStreamToResponse({ response, stream }).result.toTextStreamResponse()->toTextStream({ stream: result.stream })pluscreateTextStreamResponse({ stream }).result.pipeTextStreamToResponse(response)->toTextStream({ stream: result.stream })pluspipeTextStreamToResponse({ response, stream }).
Package-Specific Checks
- MCP:
MCPTransportConfig.redirectnow defaults to'error'. Only setredirect: 'follow'for trusted MCP servers that rely on redirects. - Vue:
@ai-sdk/vueChatclass is deprecated. PreferuseChat, including getter/ref init for reactive chat inputs. - Anthropic and
@ai-sdk/google-vertex/anthropic:providerMetadata.anthropic.cacheCreationInputTokenswas removed. Useusage.inputTokenDetails.cacheWriteTokens; raw Anthropic usage remains atfinalStep.providerMetadata?.anthropic?.usage. - Google: rename
GoogleGenerativeAI*types, classes, and functions toGoogle*, e.g.createGoogleGenerativeAI->createGoogle. Thegoogleentry point is unchanged.
Validation
Run the project typecheck after edits, then the smallest relevant test suite. Also smoke-test streaming, chat UI, tool execution, telemetry, and multi-step flows if the migration touched them. If type errors remain, search the migration guide for the exact removed or renamed symbol before inventing a workaround.
Frequently asked questions about AI SDK Migration
Similar skills
WinMD API Search
Easily find and explore Windows desktop APIs.
WebMCPify
Transform any web app into an agent-ready platform.
Phoenix Tracing
Instrument LLM applications with OpenInference tracing.
Foundry Hosted Agent CopilotKit
Guidance for developing agentic web apps on Azure.
Power Automate Foundation
Connect AI agents to Power Automate seamlessly.
Power Automate Flow Builder
Efficiently build and deploy Power Automate flows programmatically.
