migrate-ai-sdk-v6-to-v7

Migrates applications from Vercel AI SDK 6.x to AI SDK 7.0 using a structured checklist.

26.5k|5.1k|Updated May 23, 2023
One-click install
npx skills add https://github.com/vercel/ai --skill migrate-ai-sdk-v6-to-v7
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate-ai-sdk-v6-to-v7
Source: https://github.com/vercel/ai/tree/main/skills/migrate-ai-sdk-v6-to-v7
Command: npx skills add https://github.com/vercel/ai --skill migrate-ai-sdk-v6-to-v7

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Upgrading from AI SDK 6.x to 7.0 involves dozens of breaking changes across APIs, streaming, telemetry, tools, and result shapes, and missing any one of them causes type errors or silent behavior changes. This Skill provides a systematic migration checklist so every renamed symbol and semantic change in your codebase is found and updated.

Core Features & Use Cases

  • Guided Migration Workflow: Inspects package.json and lockfiles, upgrades AI SDK packages, enforces Node.js >=22 and ESM-only requirements, then applies targeted code changes.
  • Comprehensive Breaking-Change Coverage: Maps every v6-to-v7 rename including system to instructions, fullStream to stream, onFinish to onEnd, experimental_ prefix removals, usage token fields, and multi-step result shape changes.
  • Package-Specific Checks: Handles MCP redirect defaults, Vue Chat deprecation, Anthropic cache token fields, and Google provider renames.
  • Use Case: A team upgrading a Next.js chat application from AI SDK 6 to 7 uses this Skill to update streamText calls, migrate telemetry to @ai-sdk/otel, fix tool context handling, and validate with typecheck and tests.

Quick Start

Migrate my project from AI SDK 6 to AI SDK 7 and fix all breaking changes in my codebase.

Frequently Asked Questions about migrate-ai-sdk-v6-to-v7

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate from AI SDK 6 to AI SDK 7?

Upgrade all ai and @ai-sdk packages, ensure Node.js >=22 and ESM modules, then apply the breaking changes: rename system to instructions, fullStream to stream, onFinish to onEnd, and remove experimental_ prefixes. Run typecheck and targeted tests to catch remaining issues.

What are the breaking changes in AI SDK 7?

Key changes include system renamed to instructions, fullStream renamed to stream, lifecycle callbacks renamed (onFinish to onEnd, onStepFinish to onStepEnd), telemetry moved to @ai-sdk/otel, usage token fields restructured, and top-level result properties now aggregating all steps instead of only the final step.

Does AI SDK 7 require Node.js 22?

Yes, AI SDK 7 requires Node.js version 22 or higher. The packages are also ESM-only, so you must replace require() calls with ESM imports and set "type": "module" in package.json or use .mjs file extensions.

How do I set up OpenTelemetry in AI SDK 7?

Install the @ai-sdk/otel package and call registerTelemetry(new OpenTelemetry(...)) at application startup. Telemetry is enabled by default once registered, so remove redundant isEnabled: true flags and move any tracer configuration into the OpenTelemetry constructor.

Why is result.totalUsage deprecated in AI SDK 7?

In AI SDK 7, result.usage now includes token usage across all steps, making totalUsage redundant. If you need the previous final-step-only behavior, use result.finalStep.usage instead.

What replaced streamText result helper methods in AI SDK 7?

Result methods like toUIMessageStreamResponse are deprecated in favor of top-level stateless helpers. Use toUIMessageStream({ stream: result.stream }) combined with createUIMessageStreamResponse or pipeUIMessageStreamToResponse for response handling.