vercel-ai-sdk

Integrate Vercel AI SDK v5 for chat streaming and tool calling.

Updated Nov 18, 2025
One-click install
npx skills add https://github.com/mcclowes/puzzles --skill vercel-ai-sdk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-ai-sdk
Source: https://github.com/mcclowes/puzzles/tree/main/.claude/skills/vercel-ai-sdk
Command: npx skills add https://github.com/mcclowes/puzzles --skill vercel-ai-sdk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides patterns for integrating Vercel AI SDK v5, covering chat generation and streaming, tool calling, embeddings, MCP integration, and model-context workflows.

Core Features & Use Cases

  • useChat & Streaming: Build interactive AI chat UIs with streaming responses.
  • Tool Calling: Define tools with the toolkit wrapper and correct schemas for safe, typed interactions.
  • Embeddings: Generate text embeddings for semantic search and retrieval-augmented generation.
  • MCP Integration: Connect to MCP servers for dynamic tool access and lifecycle management.

Quick Start

Install and configure the Vercel AI SDK v5 in your project, set up useChat for a chat UI, implement streaming routes, and add tool calls with properly typed schemas.

Frequently Asked Questions about vercel-ai-sdk

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

FAQPage Schema
How do I set up streaming responses with Vercel AI SDK v5?

Streaming responses in Vercel AI SDK v5 use toUIMessageResponse or toTextStreamResponse on server routes. Create an API route that initializes a model with provider/model-id syntax, calls generateText or streamText, and returns the stream via the appropriate response method to enable real-time UI updates.

How do I implement tool calling with Vercel AI SDK v5?

Define tools using the tool() wrapper with inputSchema and Zod for type safety. Pass tools to generateText or streamText, which executes matching tool calls and returns results. Ensure schemas validate inputs before execution for safe, typed interactions.

Can I use embeddings with Vercel AI SDK v5 for semantic search?

Yes. Access embeddings via provider.textEmbeddingModel to generate vector representations of text. Use these embeddings for semantic search and retrieval-augmented generation workflows to find contextually similar content.

What's the best way to migrate from Vercel AI SDK v4 to v5?

Update provider and model references to v5's provider/model-id syntax, replace useChat hook patterns, switch tool definitions to tool() with Zod schemas, and update streaming methods to toUIMessageResponse or toTextStreamResponse. Check your lockfile to ensure the correct package manager installs dependencies.

How do I integrate MCP servers with Vercel AI SDK v5?

Connect MCP servers to access dynamic tools and manage their lifecycle. Register MCP connections in your configuration, then reference those tools in generateText or streamText for expanded capability access.

Does Vercel AI SDK v5 work with useChat for chat interfaces?

Yes. useChat is the primary hook for building interactive AI chat UIs in v5. It handles message state, streaming integration, and tool call rendering, connecting directly to server routes that use generateText or streamText.