Skip to content
Development
Skill

/migrate-ai-sdk-v6-to-v7

Migrate applications from AI SDK 6.x to AI SDK 7.0. Use when upgrading Vercel AI SDK packages, fixing v7 migration errors, or when the user mentions AI SDK v6, v7, upgrade, migration, breaking changes, system to instructions, fullStream, telemetry, tool context, or finalStep.

From plugin
ai
28k13 skills

Claude Code

$ npx -y skills add vercel/ai --skill migrate-ai-sdk-v6-to-v7 --agent claude-code

SKILL.md

migrate-ai-sdk-v6-to-v7.SKILL.md
name: migrate-ai-sdk-v6-to-v7
description: Migrate applications from AI SDK 6.x to AI SDK 7.0. Use when upgrading Vercel AI SDK packages, fixing v7 migration errors, or when the user mentions AI SDK v6, v7, upgrade, migration, breaking changes, system to instructions, fullStream, telemetry, tool context, or finalStep.

AI 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

1. Ensure the user has a clean backup or committed baseline before editing. 2. Inspect `package.json` and lockfiles to identify installed `ai`, `@ai-sdk/*`, provider, UI, MCP, and telemetry packages. 3. Upgrade AI SDK packages to latest versions, and add `@ai-sdk/otel` only if the project uses OpenTelemetry spans. 4. Update runtime and module assumptions: Node.js must be `>=22`, and AI SDK packages are ESM-only. Replace `require()` imports with ESM imports and add `"type": "module"` or use `.mjs` where needed. 5. 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_output` option/result -> `output` option/result.
  • `CallSettings` -> `LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>`; `prepareCallSettings` -> `prepareLanguageModelCallOptions`.
  • `stepCountIs` -> `isStepCount`.

Prompts and Steps

  • Rename top-level `system` to `instructions` for `generateText`, `streamText`, `generateObject`, `streamObject`, and `streamUI`.
  • Move `{ role: 'system' }` messages from `prompt` or `messages` into top-level `instructions`. Only use `allowSystemInMessages: true` for trusted persisted messages.
  • Rename `experimental_prepareStep` to `prepareStep`.
  • In `prepareStep`, rename returned `system` to `instructions`.
  • In `experimental_repairToolCall`, use `{ instructions }` instead of `{ system }`.
  • Audit `prepareStep` behavior: returned `instructions` and `messages` now carry forward into later steps. If code depended on one-step-only overrides, rebuild from `initialInstructions`, `initialMessages`, and `responseMessages` explicitly.

Lifecycle Callbacks

  • `experimental_onStart` -> `onStart`.
  • `experimental_onStepStart` -> `onStepStart`.
  • `onFinish` -> `onEnd`.
  • `onStepFinish` -> `onStepEnd`.
  • For `embed`, `embedMany`, and `rerank`, `experimental_onFinish` -> `onEnd`.
  • Callback event fields use `instructions` instead of `system`.

Usage, Telemetry, and Include Options

  • `usage.cachedInputTokens` -> `usage.inputTokenDetails.cacheReadTokens`.
  • `usage.reasoningTokens` -> `usage.outputTokenDetails.reasoningTokens`.
  • OpenTelemetry moved out of `ai`; install `@ai-sdk/otel` and call `registerTelemetry(new OpenTelemetry(...))` at app startup.
  • Telemetry is enabled by default once an integration is registered. Remove redundant `isEnabled: true`; use `isEnabled: false` to opt out per call.
  • Move `experimental_telemetry.tracer` into the `OpenTelemetry` constructor.
  • `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.body` or `response.body`, opt in with `include.requestBody` and, for `generateText`, `include.responseBody`.

Streaming, Messages, and Tools

  • `StreamTextResult.fullStream` -> `stream`.
  • `streamText` `onChunk` now receives all stream parts, including lifecycle, boundary, finish, abort, and error parts. Guard by `chunk.type` before assuming text/tool/raw content.
  • `step.response.messages` is no longer accumulated across previous steps. Use `result.responseMessages` for the full response message history, or flatten `result.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 `runtimeContext` for orchestration state, declare per-tool `contextSchema`, and pass per-tool values through `toolsContext`.
  • Move `needsApproval` from `tool()` / `dynamicTool()` into per-call or agent `toolApproval`.
  • `experimental_activeTools` -> `activeTools`.
  • `ToolCallOptions` -> `ToolExecutionOptions`.
  • `isToolOrDynamicToolUIPart` -> `isToolUIPart`.

Content Parts and Reasoning

  • Tool result `{ type: 'media' }` is removed; use `{ type: 'file-data' }`.
  • Migrate `toModelOutput` `image-*`, `file-*`, `file-id`, and `image-file-id` variants 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-file` content type in exhaustive switches, renderers, serializers, and validators.
  • When adopting top-level `reasoning`, remove overlapping provider-specific reasoning settings from `providerOptions` unless provider-specific settings intentionally take precedence.

Multi-Step Result Shape

  • `result.usage` now includes all steps; `result.totalUsage` is deprecated
Read more
@vercel
Ships withai

The AI Toolkit for TypeScript. From the creators of Next.js, the AI SDK is a free open-source library for building AI-powered applications and agents

Stars on GitHub

Momentum

stars in total
27.7k
Star history of vercel/ai on GitHub, a chart by star-history.com

Other skills on ai.

add-function-examples

add-function-examples

Guide for adding new AI function examples, for testing specific features against the actual provider APIs.

@vercel@vercelInstall Skill
add-harness-package

add-harness-package

Guide for adding new AI SDK harness packages. Use when creating a new @ai-sdk/harness-<name> package that adapts a coding-agent…

@vercel@vercelInstall Skill
add-provider-package

add-provider-package

Guide for adding first-party AI provider packages to the AI SDK. Use when creating a provider package under packages/ to…

@vercel@vercelInstall Skill
adr-skill

adr-skill

Create and maintain Architecture Decision Records (ADRs) optimized for agentic coding workflows. Use when you need to propose,…

@vercel@vercelInstall Skill
develop-ai-functions-example

develop-ai-functions-e…

Develop examples for AI SDK functions. Use when creating, running, or modifying examples under examples/ai-functions/src to…

@vercel@vercelInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about migrate-ai-sdk-v6-to-v7.

Which coding agents can use migrate-ai-sdk-v6-to-v7?
migrate-ai-sdk-v6-to-v7 installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.