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

At a glance

How it runs
Library / SDKFramework
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
Node.js 22+npm (or another package manager)Shell / CLINetwork accessLocal filesystem
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

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.

  1. A Next.js or React team that wants to add a streaming chat interface to an existing product without building its own model plumbing.
  2. A backend developer who needs model responses that strictly match a zod schema, such as recipes, form payloads or classification records.
  3. A developer building an agent that must call external tools — running shell commands or generating images — and surface intermediate UI states.
  4. A team that wants to keep OpenAI, Anthropic and Google interchangeable behind one API instead of committing to a single vendor.
  5. 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 ai
  • npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google
  • npm install @ai-sdk/react
  • npx 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 ai

To call providers directly instead of through the Vercel AI Gateway, install their SDK packages:

npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google

For frontend hooks, install the package for your framework:

npm install @ai-sdk/react

If you use coding agents such as Claude Code or Cursor, add the AI SDK skill:

npx skills add vercel/ai

How 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)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Not found in source — apply before daily use
  • 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?

Pros
  • 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.
Limitations
  • 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?

FollowAgents source review · FARS-2.1
Major gaps
54/ 100 5-point scale 2.7 / 5
This review covers the source as of Nov 08, 2026. The project has shipped 301 stable release(s) since, which have not been re-reviewed. The score and verdict describe the reviewed version only. Recent releases ↓
Trust 10/29
Reliability 8/14
Adaptability 12/18
Convention 10/18
Effectiveness 9/13
Verifiability 5/8
Why each dimension lost points
Trust10 / 29 · 1.7/5

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.

Reliability8 / 14 · 2.9/5

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.

Adaptability12 / 18 · 3.3/5

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.

Convention10 / 18 · 2.8/5

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.

Effectiveness9 / 13 · 3.5/5

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.

Verifiability5 / 8 · 3.1/5

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.

Risks and how to mitigate them
  • 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.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision 0f3a85f92d1c New commits since this review; the score may not cover them
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/vercel-ai.svg)](https://followagents.com/en/agents/vercel-ai)
<a href="https://followagents.com/en/agents/vercel-ai"><img src="https://followagents.com/badge/vercel-ai.svg" alt="FARS review"></a>

Recent releases

Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.

  1. 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 ↗
  2. Release notes excerpt
    Patch Changes - @ai-sdk/[email protected]
    View on GitHub ↗
  3. 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?
The npm package is free and open source. Calls go through the Vercel AI Gateway by default or directly to OpenAI, Anthropic, Google and others, so you supply keys and pay providers per use; the source states no prices.
Can I avoid the Vercel AI Gateway entirely?
Yes. The README shows installing @ai-sdk/openai, @ai-sdk/anthropic or @ai-sdk/google and calling providers directly, e.g. anthropic('claude-opus-5-5').
Which frameworks and runtimes are supported?
The README names Next.js, React, Svelte, Vue, Angular and the Node.js runtime, and describes the UI hooks as framework agnostic.
Where does my data go?
Prompts are sent to whichever model provider you select, or to the Vercel AI Gateway by default. The library does not claim local inference.
What is the license?
GitHub reports the license as NOASSERTION with no standard SPDX identifier, so review the license files in the repository before commercial adoption.
Was this page helpful?
View on GitHub ↗ Install ↓

Related concepts