The AI SDK is a provider-agnostic TypeScript toolkit designed to help you build AI-powered applications and agents using popular UI frameworks like Next.js, React, Svelte, Vue, Angular, and runtimes like Node.js.
To learn more about how to use the AI SDK, check out our API Reference and Documentation.
You will need Node.js 22+ and npm (or another package manager) installed on your local development machine.
npm install aiIf you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:
npx skills add vercel/aiThe AI SDK provides a unified API to interact with model providers like OpenAI, Anthropic, Google, and more.
By default, the AI SDK uses the Vercel AI Gateway to give you access to all major providers out of the box. Just pass a model string for any supported model:
const result = await generateText({
model: 'anthropic/claude-opus-5.5', // or 'openai/gpt-6-astra', 'google/gemini-3.8-flash', etc.
prompt: 'Hello!',
});You can also connect to providers directly using their SDK packages:
npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/googleimport { anthropic } from '@ai-sdk/anthropic';
const result = await generateText({
model: anthropic('claude-opus-5-5'), // or openai('gpt-6-astra'), google('gemini-3.8-flash'), etc.
prompt: 'Hello!',
});import { generateText } from 'ai';
const { text } = await generateText({
model: 'openai/gpt-6-astra', // use Vercel AI Gateway
prompt: 'What is an agent?',
});import { generateText, Output } from 'ai';
import { z } from 'zod';
const { output } = await generateText({
model: 'openai/gpt-6-astra',
output: Output.object({
schema: z.object({
recipe: z.object({
name: z.string(),
ingredients: z.array(
z.object({ name: z.string(), amount: z.string() }),
),
steps: z.array(z.string())