AI SDK
A provider-agnostic TypeScript toolkit from the Next.js team for building AI applications and agents with one unified API.
- Source repo
- vercel/ai
- Stars
- ★ 28k
- Last updated
- today @ai-sdk/[email protected]
- FARS reviewed
- Nov 08, 2026 +301 new
- License
- NOASSERTION
- Primary language
- TypeScript
- FA score
- 54/100 · Major gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformOpenAI API · Claude API
- Cost
- Free software; you pay for model usage
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- A Next.js or React team that wants to add a streaming chat interface to an existing product without building its own model plumbing.
- Not a fit if
- Projects on non-JavaScript/TypeScript stacks
- Users wanting a finished chat product rather than an SDK to integrate
- Website
- ai-sdk.dev ↗ set on GitHub
- Maintenance
- Commits in the last 30 dayslast commit 2026-12-04latest release @ai-sdk/[email protected] (2026-12-03)+17.3 ★/day over 7 days
- Source review
- 54/100 · Major gaps 1 safety controls not found
What does this agent do, and when should you use it?
The AI SDK is a provider-agnostic TypeScript toolkit for building AI-powered applications and agents, usable with UI frameworks such as Next.js, React, Svelte, Vue, and Angular as well as runtimes like Node.js. It exposes a unified API over model providers — OpenAI, Anthropic, Google and more — defaulting to the Vercel AI Gateway, while also allowing direct connection through per-provider packages such as @ai-sdk/openai. Core pieces include generateText for text generation, Output.object for zod-schema structured output, ToolLoopAgent for tool-loop agents, and the AI SDK UI module with hooks like useChat plus helpers such as createAgentUIStreamResponse and InferAgentUIMessage. It ships as an npm package that requires Node.js 22+ and is meant to be imported into your own code and applications rather than run as a standalone product.
generateText resolves a model string such as 'anthropic/claude-opus-5.5' or a provider handle such as anthropic('claude-opus-5-5'), sends the prompt and returns a { text } result. Passing Output.object with a zod schema constrains the response into a typed object, as in the recipe example with nested ingredients and steps arrays. ToolLoopAgent takes a model, a system prompt and a tools map, and drives the model through a tool loop; the documented example wires openai.tools.localShell to run commands in a Vercel Sandbox and return stdout. For UIs, the framework-agnostic useChat hook tracks messages and status, while createAgentUIStreamResponse streams an agent's UI messages from a route handler, and InferAgentUIMessage / UIToolInvocation type the message parts and tool-invocation components rendered in the client.
- A Next.js or React team that wants to add a streaming chat interface to an existing product without building its own model plumbing.
- A backend developer who needs model responses that strictly match a zod schema, such as recipes, form payloads or classification records.
- A developer building an agent that must call external tools — running shell commands or generating images — and surface intermediate UI states.
- A team that wants to keep OpenAI, Anthropic and Google interchangeable behind one API instead of committing to a single vendor.
- A Svelte or Vue developer who needs a framework-agnostic chat state hook for generative UI.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
npm install ainpm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/googlenpm install @ai-sdk/reactnpx skills add vercel/ai
- Config files
req.json- Runtime
- Node.js 22+
How do you install or deploy this agent?
Node.js 22+ and npm (or another package manager) are required locally.
Install the core package:
npm install aiTo call providers directly instead of through the Vercel AI Gateway, install their SDK packages:
npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/googleFor frontend hooks, install the package for your framework:
npm install @ai-sdk/reactIf you use coding agents such as Claude Code or Cursor, add the AI SDK skill:
npx skills add vercel/aiHow do you use this agent?
Minimal call using the default Vercel AI Gateway:
import { generateText } from 'ai';
const { text } = await generateText({
model: 'openai/gpt-6-astra', // use Vercel AI Gateway
prompt: 'What is an agent?',
});Or connect directly with a provider package:
import { 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!',
});Define a tool-using agent and expose it from a Next.js App Router route:
import { imageGenerationAgent } from '@/agent/image-generation-agent';
import { createAgentUIStreamResponse } from 'ai';
export async function POST(req: Request) {
const { messages } = await req.json();
return createAgentUIStreamResponse({
agent: imageGenerationAgent,
messages,
});
}Consume messages and tool parts in the client with useChat:
'use client';
import { useChat } from '@ai-sdk/react';
export default function Page() {
const { messages, status, sendMessage } =
useChat<ImageGenerationAgentMessage>();
// render messages and tool parts
}The source does not document how to configure each provider's API keys or its billing details; check the individual provider documentation before wiring it up.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.
What are this agent's strengths and limitations?
- One provider abstraction: the same generateText call works through the Vercel AI Gateway, @ai-sdk/openai, @ai-sdk/anthropic or @ai-sdk/google by changing the model identifier.
- Tight frontend integration: framework-agnostic useChat plus documented Next.js App Router streaming via createAgentUIStreamResponse and typed tool-invocation components.
- Structured output is first-class — Output.object accepts a zod schema directly, removing hand-written JSON parsing and validation.
- Clear agent abstraction: ToolLoopAgent ties tool definitions, the tool loop and UI message types (InferAgentUIMessage, UIToolInvocation) into one path.
- Maintained by the Vercel and Next.js teams, with official templates and a dedicated documentation site at ai-sdk.dev.
- The out-of-box path defaults to the Vercel AI Gateway for access to all providers, which teams should evaluate before adopting.
- Requires Node.js 22 or newer, so older Node environments need an upgrade first.
- The repository license is reported as NOASSERTION; confirm the actual terms before commercial use.
- Example model identifiers (e.g. gpt-6-astra, claude-opus-5-5) track provider changes and must be kept current against the docs.
- The source documents no offline mode; model calls depend on network access and external APIs.
How does this agent compare with similar options?
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| AI SDK This agent | 54 · Major gaps | Library / SDKFree + model costs | ★ 28k | today | TypeScript | OpenAI API · Claude API |
| Open Generative UI | 74 · Some gaps | CLIFree + model costs | ★ 4.3k | 1mo ago | TypeScript | Claude API |
| Strands Agents | 60 · Some gaps | Library / SDKFree + model costs | ★ 9.4k | today | TypeScript | OpenAI API · Claude API |
| Pi Agent Harness | 65 · Some gaps | CLIFree + model costs | ★ 126k | today | TypeScript | OpenAI API · Claude API |
How does FollowAgents rate this agent?
Why each dimension lost points
This is an SDK for integrating models and tools into applications. Its public APIs, provider adapters, and tool-approval exports show some attention to permission control. The supplied excerpts do not show least-privilege enforcement in execution paths, per-action user confirmation, data-flow disclosure, sensitive-data handling, dependency vulnerability management, or recovery from external actions, so those criteria are deducted. The LICENSE states Apache-2.0, and AGENTS.md identifies Vercel and the repository, but publisher identity remains unverified.
The package structure, Node/pnpm requirements, build and test commands, and consistent core exports provide some evidence of internal consistency and failure diagnosis. An error pattern is also documented. Dependency availability and actual failure behavior cannot be fully established from these excerpts, so scores remain limited.
The materials cover TypeScript/JavaScript, multiple model providers, framework integrations, function types, and example directories, and state Node and pnpm requirements. Tool-approval APIs and provider/harness layers indicate some capability boundaries; the sample does not describe every scenario, trigger condition, or environment limitation, which warrants deductions.
AGENTS.md describes the monorepo structure, directory roles, installation, development commands, naming, and changeset release workflow; the root LICENSE is explicit. The sample does not provide a complete user FAQ or limitations list. Version and change information and maintenance responsibility are only partly visible, and maintainer accountability and update commitments are not clear.
The SDK exports text generation, streaming, structured output, embeddings, image, speech, video, and tool interfaces; examples demonstrate reusable API patterns. A unified provider interface has clear practical value, but the excerpts provide no measured evidence of cost, benefit, or real-world effectiveness.
The package manifest, source exports, examples, workflow, and guidance corroborate repository structure, commands, and interfaces. Most project instructions can be tied to specific files or code. This static sample does not include the full repository or validate runtime behavior, so it cannot establish every claim.
- Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
- Tool and model calls may involve external services and user data; review permissions, data transfers, and confirmation controls in the specific provider and application integration before production use.
- The supplied AGENTS.md and skill files are primarily repository development guidance and do not by themselves prove runtime safeguards or execution outcomes.
Recent releases
Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.
-
Release notes excerpt
Patch Changes - 2404f77: Correct xAI model capability metadata using the provider audit: describe opt-in reasoning on fast non-reasoning models, unverified log probabilities, image resolution/aspect-ratio and quality restrictions, output-format limitations, and word-level transcription timings.View on GitHub ↗ -
Release notes excerpt
Patch Changes - Updated dependencies [0a479ef] - Updated dependencies [38fc845] - [email protected]View on GitHub ↗
FAQ
Is there a cost beyond the library itself?
Can I avoid the Vercel AI Gateway entirely?
Which frameworks and runtimes are supported?
Where does my data go?
What is the license?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.