AI SDK
The AI SDK is the TypeScript toolkit designed to help developers build AI‑powered applications and agents with React, Next.js, Vue, Svelte, Node.js, and more.
Why use the AI SDK?
Integrating large language models (LLMs) into applications is complicated and heavily dependent on the specific model provider you use.
The AI SDK standardizes integrating artificial intelligence (AI) models across supported providers. This enables developers to focus on building great AI applications, not waste time on technical details.
For example, here’s how you can generate text with various models using the AI SDK:
import { generateText } from "ai";
import { xai } from "@ai-sdk/xai";
const { text } = await generateText({
model: xai("grok-4"),
prompt: "What is love?"
});
Love is a universal emotion that is characterized by feelings of affection, attachment, and warmth towards someone or something. It is a complex and multifaceted experience that can take many different forms, including romantic love, familial love, platonic love, and self‑love.
The SDK supports multiple providers – see the tabs above for xAI, OpenAI, Anthropic, Google, and a Custom option.
Libraries
| Library | Description |
|---|---|
| AI SDK Core | A unified API for generating text, structured objects, tool calls, and building agents with LLMs. |
| AI SDK UI | A set of framework‑agnostic hooks for quickly building chat and generative user interfaces. |
Model Providers
The AI SDK supports a wide range of model providers. Below are the providers currently available.
xAI Grok
Image Input, Image Generation, Object Generation, Tool Usage, Tool Streaming
- Only selected models in GPT‑4
- Image Input
- Image Generation
- Object Generation
- Tool Usage
- Tool Streaming
OpenAI
Image Input, Image Generation, Object Generation, Tool Usage, Tool Streaming
- Only selected models in GPT‑4
- Image Input
- Image Generation
- Object Generation
- Tool Usage
- Tool Streaming
(Other provider cards – Anthropic, Google, Custom – follow a similar badge layout and can be explored via their dedicated pages.)
Quick navigation (partial)
- AI SDK by Vercel – Overview of the SDK
- AI SDK 6 Beta – Current beta release
- Foundations – Core concepts
- Getting Started – Setup guides for various frameworks
- Agents – Build intelligent agents
- AI SDK Core – Core functionality
- AI SDK UI – UI helpers
- AI SDK RSC – Server‑Side Rendering
- Advanced – Deep dives
- Reference – API reference
- Migration Guides – Upgrade notes
- Troubleshooting – Common issues
(The sidebar contains further sub‑sections such as “Prompts”, “Tools”, “Streaming”, “Testing”, “Telemetry”, etc.)