ai-sdk-5

Migrate Vercel AI SDK chat integrations from v4 to v5.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/sebasmzg/sebas.dot --skill ai-sdk-5-sebasmzg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk-5
Source: https://github.com/sebasmzg/sebas.dot/tree/main/.config/opencode/skill/ai-sdk-5
Command: npx skills add https://github.com/sebasmzg/sebas.dot --skill ai-sdk-5-sebasmzg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill documents how to migrate chat and completion integrations from Vercel AI SDK v4 to SDK v5, resolving breaking API changes such as the shift to transport-based clients and the new UIMessage parts format.

Core Features & Use Cases

  • Transport-based client migration: Replace legacy useChat/api patterns with DefaultChatTransport and DefaultCompletionTransport to standardize client-server communication.
  • UIMessage parts handling: Convert single-string message.content usage into the new message.parts array and provide strategies to extract and render text, images, and tool results.
  • Server streaming and LangChain support: Implement streamText handlers, convert streaming model outputs to UI message streams, and integrate LangChain model streams and tool calls.
  • Use case: Update a Next.js app that streams assistant responses and calls tools so the client uses transport objects, the server returns toDataStreamResponse, and messages render parts correctly.

Quick Start

Migrate your chat feature by replacing direct api use with a transport-based call such as using DefaultChatTransport for the client and adapting message.content access to iterate message.parts to extract text.

Frequently Asked Questions about ai-sdk-5

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

FAQPage Schema
How do I migrate chat apps to Vercel AI SDK 5 from v4?

To migrate chat apps to Vercel AI SDK 5, replace legacy useChat API patterns with transport-based clients like DefaultChatTransport and adapt message handling to the new UIMessage parts array format.

Why did my useChat hook break after updating to AI SDK v5?

Your useChat hook broke because AI SDK v5 introduced transport-based clients, replacing direct API configurations and shifting single-string message content into a structured UIMessage parts array.

How do I handle UIMessage parts when rendering chat responses?

Handling UIMessage parts requires iterating through the message.parts array to extract and render text, images, and tool results, replacing the old single-string message.content property access pattern.

Can I use LangChain streaming models with Vercel AI SDK 5?

Yes, Vercel AI SDK 5 supports LangChain integration by converting streaming model outputs to UI message streams and adapting tool parameter schemas within your streamText server-side route handlers.

What is the best way to convert streaming responses to data streams in Next.js?

The best way to convert streaming responses is implementing streamText handlers that return toDataStreamResponse, ensuring the server correctly formats the output for the transport-based client.

Does Vercel AI SDK 5 migration require changes to tool parameter schemas?

Yes, migrating to Vercel AI SDK 5 requires updating tool parameter schemas and implementing basic error handling for chat flows to ensure compatibility with the new streaming tool integrations.