# AI SDK — card for AI agents

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

Category: Model SDKs · npm package `ai` · latest version 7.0.159 (checked 2026-11-01)
Install: `npm install ai`
License: Apache-2.0 (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (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`.

## Agent Skills for it
- ai-sdk from midudev/autoskills: `npx skills add midudev/autoskills --skill ai-sdk`

## Docs written for agents
- [llms.txt (index of the docs)](https://ai-sdk.dev/llms.txt)

## What it is
- AI SDK is Vercel's open-source TypeScript library for building apps and agents on top of language models. The package is `ai` on npm, and it is Apache-2.0 licensed. The README calls it provider-agnostic and lists Next.js, React, Svelte, Vue, Angular and Node.js as places it runs. The repository credits it to the creators of Next.js.
- The library has two halves. AI SDK Core is, in the site's words, "a unified API for generating text, structured objects, tool calls, and building agents". You pass a model string and it goes through the Vercel AI Gateway, or you install a provider package such as `@ai-sdk/anthropic` and call the provider directly. AI SDK UI adds hooks like `useChat`. They render streamed messages as typed parts, so tool calls can get their own components.
- It is aimed at JavaScript and TypeScript developers building chat interfaces, agents and structured-data features. The README also speaks to people working with coding agents: it ships a skill you can add to your repository.

## Caveats
- 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 `useChat` from `ai/react` and uses `handleInputChange`. The current README imports it from `@ai-sdk/react` and calls `sendMessage`. Check the date on any example before copying it.
- A learning curve, by a fan's account: Zack Proser, who recommends the SDK, says it still takes time to get used to.
- Many packages, versioned separately: Framework bindings carry their own version numbers. The latest release listed is `@ai-sdk/vue@3.0.303`, a patch that updates dependencies including `ai@6.0.303`.

## Numbers (AgentGid data)
- Gid Score: 85.9 (#34 of all tools, 2 of 92 in its category)
- Used in 280 public projects set up for AI coding agents (4.5%)
- Downloads last week: 48,501,198 (as of 2026-11-24), +53.9% over 4 weeks
- GitHub stars: 28,160 (as of 2026-11-24)
- Last push: 2026-11-24

## Often used with
Zod 83.6%, Tailwind Merge 56.1%, Class Variance Authority 52.5%, clsx 56.4%, Lucide React 57.1%, React 70.4%

## Checked alternatives (same job)
- OpenAI: https://agentgid.com/tools/openai-npm/agent.md
- Anthropic SDK: https://agentgid.com/tools/anthropic-ai/agent.md
- Google Generative AI: https://agentgid.com/tools/google-genai-npm/agent.md
- Ollama JavaScript Library: https://agentgid.com/tools/ollama-npm/agent.md
- Groq SDK: https://agentgid.com/tools/groq-sdk/agent.md
- Replicate: https://agentgid.com/tools/replicate-npm/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/ai/
- Homepage: https://ai-sdk.dev/docs
- Repository: https://github.com/vercel/ai
- Source: https://github.com/vercel/ai#readme
- Source: https://github.com/vercel/ai
- Source: https://github.com/vercel/ai/releases
- Source: https://ai-sdk.dev
- Source: https://ai-sdk.dev/examples/next-app/interface

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
