Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 4 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

AI SDK

Vercel's unified SDK for building AI apps with OpenAI, Anthropic, Google and more.

Model SDKsNPM

GitHubWebsiteIts AgentGid profile

1. License

License from npm.

github.com/vercel/ai

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What AI SDK does

AI SDK puts one TypeScript call, <code>generateText</code>, in front of many model providers, and by default it routes a plain model string like <code>'openai/gpt-6-astra'</code> through Vercel's AI Gateway instead of asking you to wire up each provider.

AI SDK popularity

86 / 100
Gid Score, #34 overall
48.5M
downloads a week, npm
28.2K
GitHub stars
280
agent projects use it
AI SDK: downloads per weeknpm, ai 48,501,198
AI SDK: GitHub starsvercel/ai 28,160

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How AI SDK is used

  • AI SDK is a dependency in 280 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (5.8% of the 4,867 JavaScript/TypeScript ones), #2 of 92 in model sdks.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,554; those are left out of every share on this page.
  • The most used alternative in our scan is OpenAI (286 projects).
  • Projects that use it most often also use Zod (83.6%), Tailwind Merge (56.1%), Class Variance Authority (52.5%).
  • It is more common in projects set up for Kiro (9.3%) than for GitHub Copilot (4.2%).

By coding agent

157 projects, 4.8%
145 projects, 5.9%
127 projects, 4.2%
32 projects, 6.8%
25 projects, 7.3%
25 projects, 5.3%
17 projects, 6.1%
13 projects, 9.3%

Often used with

In 83.6% of its projects
In 56.1% of its projects
In 52.5% of its projects
In 56.4% of its projects
In 57.1% of its projects
In 70.4% of its projects
In 91.1% of its projects
In 52.5% of its projects

AI SDK in practice

Strengths

A model string is enough to start

Out of the box, the SDK sends requests through the Vercel AI Gateway. A string like <code>'anthropic/claude-opus-5.5'</code> picks the provider and model, with no provider package to install first.

Direct provider packages when you want them

You can skip the gateway. Install <code>@ai-sdk/openai</code>, <code>@ai-sdk/anthropic</code> or <code>@ai-sdk/google</code> and pass <code>anthropic('claude-opus-5-5')</code> to the same <code>generateText</code> call.

Structured output from a Zod schema

<code>generateText</code> takes an <code>output: Output.object({ schema })</code> option with a Zod schema and returns a typed <code>output</code>. The README demonstrates it with a recipe object.

Tool calls arrive in the UI with a state

In the README's agent example, each tool invocation reaches the React component with a <code>state</code>. You can show a placeholder at <code>input-available</code> and the result at <code>output-available</code>.

Watch out for

Needs Node.js 22 or newer

The README sets Node.js 22+ as the requirement for local development.

The default path runs through Vercel

The README's basic examples pass a bare model string, and its own code comment notes this goes through Vercel AI Gateway. To call a provider directly, you have to install that provider's package.

Older tutorials show a different API

A 2025 post imports <code>useChat</code> from <code>ai/react</code> and uses <code>handleInputChange</code>. The current README imports it from <code>@ai-sdk/react</code> and calls <code>sendMessage</code>. Check the date on any example before copying it.

Generate a typed object with a Zod schema

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()),
      }),
    }),
  }),
  prompt: 'Generate a lasagna recipe.',
});

More about AI SDK

Agent Skills for it
  • ai-sdk: Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText,

See all

Packages around it
  • @ai-sdk/openai: OpenAI provider
  • @ai-sdk/react: React hooks (useChat)
  • @ai-sdk/google: Google provider
  • @ai-sdk/anthropic: Anthropic provider
  • @ai-sdk/openai-compatible: OpenAI-compatible provider
  • @ai-sdk/groq: Groq provider
More in Model SDKs

Alternatives

AI SDK This page

Apache-2.0Gid 8648.5M/wk

OpenAI

Official TypeScript SDK for accessing OpenAI APIs including GPT and embeddings.

Apache-2.0Gid 8162.5M/wk

Anthropic SDK

Official TypeScript SDK for calling Claude API and building agent applications.

Apache-2.0Gid 7475M/wk

Google Generative AI

Official SDK for Google Gemini API to build AI-powered applications.

Apache-2.0Gid 6934.2M/wk

Ollama JavaScript Library

Official JavaScript client library for Ollama to run and interact with local language models.

MITGid 571.3M/wk

Groq SDK

Official TypeScript SDK for calling Groq's fast language models API.

Apache-2.0Gid 471.2M/wk

Replicate

JavaScript client library for calling Replicate's AI model API.

Apache-2.0Gid 41713K/wk

Compare AI SDK with another tool

Get started

Install it.

npm install ai

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## AI SDK
- Install the core package with `npm install ai`, and check that the project runs on Node.js 22+.
- A bare model string such as `'openai/gpt-6-astra'` goes through the Vercel AI Gateway. To call a provider directly, install its package (`@ai-sdk/openai`, `@ai-sdk/anthropic`, `@ai-sdk/google`) and pass e.g. `anthropic('claude-opus-5-5')`.
- For structured data, use `generateText` with `output: Output.object({ schema })` and a Zod schema, then read `output`.
- For chat UIs, install the framework package (e.g. `@ai-sdk/react`), use `useChat`, call `sendMessage({ text })`, and render `message.parts` by `part.type`.
- Render tool parts by `invocation.state`: handle `'input-available'` and `'output-available'`.
- In Next.js routes that stream agent output, return `createAgentUIStreamResponse({ agent, messages })`. The RSC examples also set `export const maxDuration = 30` to allow streaming up to 30 seconds.
- If the repo uses Claude Code or Cursor, add the official skill with `npx skills add vercel/ai`.