Vercel AI SDK
The Vercel AI SDK is a TypeScript toolkit for building AI-powered applications with React, Next.js, Vue, Svelte, and Node.js. It provides a unified API for streaming text and generating structured objects from various AI providers, simplifying the integration of AI features into your projects.
✨ Key features
- Unified API for multiple AI providers
- Streaming text and structured object generation
- Framework-agnostic with React, Vue, Svelte, Node.js support
- TypeScript-first for type safety
- Supports tool calling and multi-step agents
- Edge runtime compatible
🎯 Use cases
- Build AI chatbots with streaming responses
- Generate structured data from natural language
- Create AI-powered content generation tools
- Implement tool-using agents for complex tasks
- Add AI features to existing web apps
📦 Installation
🧰 Requirements: Requires Node.js 18+ and an API key from an AI provider (e.g., OpenAI, Anthropic).
npm install ai
For React, also install @ai-sdk/react. For Vue, @ai-sdk/vue. For Svelte, @ai-sdk/svelte.
🚀 Usage
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
const { text } = await generateText({
model: openai('gpt-4o'),
prompt: 'Write a haiku about programming.',
});
console.log(text);
⚠️ Good to know
The SDK is in active development and may have breaking changes; it requires an API key from a supported provider.
❓ FAQ
What AI providers are supported?
The SDK supports many providers including OpenAI, Anthropic, Google, Mistral, and more, via community or official provider packages.
Can I use it with my existing React app?
Yes, the SDK provides React hooks and components for seamless integration, such as useChat and useCompletion.
Does it support streaming?
Yes, it supports streaming responses for both text and object generation, allowing real-time UI updates.
Is it only for frontend?
No, it can be used in Node.js server environments as well, making it suitable for full-stack AI applications.
📊 Repository
🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.