ai-sdk-5

Implement AI chat streaming with Vercel AI SDK v5 and migrate from v4.

Updated May 17, 2026
One-click install
npx skills add https://github.com/cheetah-alo/NegritaOS --skill ai-sdk-5-cheetah-alo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ai-sdk-5
Source: https://github.com/cheetah-alo/NegritaOS/tree/main/.codex/skills/ai-sdk-5
Command: npx skills add https://github.com/cheetah-alo/NegritaOS --skill ai-sdk-5-cheetah-alo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you implement AI-powered chat features reliably by mapping AI SDK v5 patterns to real application needs, including migration from AI SDK v4.

Core Features & Use Cases

  • Migration from AI SDK 4 to 5: Switches from the v4 useChat pattern to the v5 @ai-sdk/react + DefaultChatTransport approach.
  • Client-ready chat UI with streaming: Uses useChat to render message history, track loading/error states, and send new user input.
  • UIMessage parts support: Adopts the v5 message.parts model for text, images, tool calls, and tool results.
  • Server-side route streaming: Implements an API route using streamText with AI SDK models and returns a streaming response.
  • Tool/function calling with schemas: Shows how to define tools with validated parameters (e.g., via zod) and stream tool-aware responses.
  • Optional LangChain integration: Converts between UI messages and LangChain message types for streaming compatibility.

Quick Start

Use the ai-sdk-5 skill to create an AI chat endpoint and client that stream assistant responses using AI SDK v5 transport and UIMessage parts.

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 my AI chat application from AI SDK v4 to v5?

To migrate from AI SDK v4 to v5, replace the legacy useChat pattern with the new @ai-sdk/react approach and configure DefaultChatTransport for client-server communication. This updates your chat client to use the new v5 transport layer.

How does streaming work in Nextjs API routes using AI SDK v5?

Streaming in Nextjs API routes with AI SDK v5 works by implementing a server route handler using streamText with your AI model, then returning the result via toDataStreamResponse. This generates a streaming response consumed by the client.

What is the UIMessage parts model in AI SDK v5?

The UIMessage parts model in AI SDK v5 structures chat messages into distinct parts for text, images, tool calls, and tool results. This replaces flat string content, allowing granular rendering of complex multimodal interactions.

Can I use LangChain streaming with AI SDK v5 chat components?

Yes, you can use LangChain streaming with AI SDK v5 chat components by converting between UI messages and LangChain message types. This ensures streaming compatibility when integrating LangChain logic into your AI chat application.

How do I define tool calling with validated parameters in AI SDK v5?

You define tool calling with validated parameters in AI SDK v5 by specifying tools with schemas, such as using zod for validation. The streamText function then processes these definitions to stream tool-aware responses back to the client.