Skip to main content

Overview

Vercel AI SDK is a TypeScript toolkit for building AI-powered applications with React, Next.js, Vue, and Svelte. The platform works seamlessly with Vercel AI SDK using the OpenAI provider.
Perfect for building streaming chat UIs, AI-powered forms, and interactive AI experiences.

Installation

Basic Setup

Text Generation

Streaming Text

Next.js Chat Application

Route Handler (app/api/chat/route.ts)

Chat UI Component (app/page.tsx)

Environment Variables (.env.local)

Tool Calling (Function Calling)

Streaming with Tool Calls

Multi-Model Support

Switch between different AI providers seamlessly:

React Server Components

Structured Output

Generate type-safe structured data:

Error Handling

Supported Models

All available models work with Vercel AI SDK:

View All Models

Browse supported models →

Example Use Cases

Chatbot

Build a streaming chat interface with Next.js

Content Generator

Generate blog posts, summaries, and creative content

AI Forms

Create forms with AI-powered suggestions

Data Extraction

Extract structured data from unstructured text

Resources

Next Steps

OpenAI SDK

Use the official OpenAI SDK

LangChain

Build with LangChain framework