# Vercel AI SDK

> Source: https://aiwiki.ai/wiki/vercel_ai_sdk
> Updated: 2026-11-18
> Fact-checked: 2026-11-18
> Categories: AI Agents, Developer Tools, Open Source AI
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) - attribute to "AI Wiki (aiwiki.ai)"
> Cite as: AI Wiki. "Vercel AI SDK." aiwiki.ai, 18 Nov 2026. https://aiwiki.ai/wiki/vercel_ai_sdk
> From AI Wiki (https://aiwiki.ai), the free encyclopedia of artificial intelligence. Reuse freely with attribution.

The **Vercel AI SDK** (also called the **AI SDK**, or "AI SDK by Vercel") is an open-source [TypeScript](https://aiwiki.ai/wiki/typescript) toolkit from [Vercel](https://aiwiki.ai/wiki/vercel) for building applications and [agents](https://aiwiki.ai/wiki/ai_agents) on top of [large language models](https://aiwiki.ai/wiki/large_language_model).[1][2] It gives developers one API for calling models from many providers, including [OpenAI](https://aiwiki.ai/wiki/openai), [Anthropic](https://aiwiki.ai/wiki/anthropic) and Google, together with front-end hooks for chat and streaming interfaces in [React](https://aiwiki.ai/wiki/react), [Next.js](https://aiwiki.ai/wiki/nextjs), Vue, Svelte and Angular.[2][3][9] Vercel announced the library on June 15, 2023 as a streaming toolkit for React and Svelte chat apps, and through major versions up to 7 it has grown into what its documentation calls "the TypeScript toolkit designed to help developers build AI-powered applications and agents."[3][2] The code is published on npm as the package `ai` under the Apache-2.0 license, and AI SDK 7 was released on June 25, 2026.[1][12]

## Overview

The SDK's documentation divides it into a few libraries. **AI SDK Core** is a unified API for generating text, [structured output](https://aiwiki.ai/wiki/structured_output) and tool calls and for building agents; **AI SDK UI** is a set of framework-agnostic hooks for chat and generative user interfaces; and **AI SDK Harnesses**, added in version 7, runs existing agent harnesses such as [Claude Code](https://aiwiki.ai/wiki/claude_code), Codex and Pi through one `HarnessAgent` interface.[2][11] An older library, **AI SDK RSC**, streams React Server Components from the server; the documentation marks it as experimental and recommends AI SDK UI for production.[16]

The core idea is a common interface across model providers. In the documentation's words, the unified interface "allows you to switch between providers with ease while using the same API for all providers."[17] Provider support is built on a language model specification that Vercel publishes as an open-source package, which lets third parties write their own providers.[17][5]

<figure class="embedvideo">
<iframe src="https://www.youtube-nocookie.com/embed/UDm-hvwpzBI" title="Hands on with the Vercel AI SDK 3.1"></iframe>
<figcaption>"Hands on with the Vercel AI SDK 3.1", official video from Vercel, published May 21, 2024. <a href="https://www.youtube.com/watch?v=UDm-hvwpzBI">Watch on YouTube</a>.</figcaption>
</figure>

## History

### Launch (2023)

Vercel introduced the SDK in a June 15, 2023 blog post by Jared Palmer, Shu Ding and Max Leiter, describing it as an "interoperable, streaming-enabled, edge-ready software development kit for AI apps built with React and Svelte."[3] It was installed with `npm install ai` and shipped two hooks, `useChat` and `useCompletion`, which handled fetching and rendering streamed text in React and Svelte, plus server-side helpers such as `OpenAIStream` and `StreamingTextResponse` that turned a model's response into a stream.[3] Launch-day integrations covered OpenAI, [LangChain](https://aiwiki.ai/wiki/langchain) and [Hugging Face](https://aiwiki.ai/wiki/hugging_face) Inference, with Nuxt and Vue support listed as coming soon.[3] Callbacks such as `onStart`, `onToken` and `onCompletion` let an app save prompts and responses within the same request.[3]

The npm package name `ai` was older than the SDK. Versions 0.0.1 through 1.1.0 were published in 2014 by an unrelated project whose metadata points to a different GitHub repository; the next version, 2.0.0, was published on June 14, 2023, the day before the launch post.[1]

### AI SDK 3 and generative UI (2024)

AI SDK 3.0, announced on March 1, 2024, open-sourced the "Generative UI" technique behind Vercel's [v0](https://aiwiki.ai/wiki/vercel_v0) design tool.[4] It let a model's response be tied to streaming React Server Components, so that a tool call could render an interactive component (the announcement's example showed a spinner followed by a weather card) rather than plain text.[4] The main API was `render`, with lower-level `createStreamableUI` and `createStreamableValue` helpers; these relied on React Server Actions, which at the time were implemented in Next.js.[4]

Version 3.1, announced on May 2, 2024 under the title "Vercel AI SDK 3.1: ModelFusion joins the team," reorganized the library into AI SDK Core, AI SDK UI and AI SDK RSC.[5] ModelFusion was a TypeScript library for building AI applications created by Lars Grammel, who co-wrote the 3.1 post and later release announcements.[18][5] AI SDK Core introduced the functions that remain the center of the library: `generateText` and `streamText` for text, and `generateObject` and `streamObject` for typed objects defined with a Zod schema.[5] The post compared Core to an ORM for language models and launched with OpenAI, Anthropic, Google Gemini and Mistral providers.[5] In AI SDK RSC, a new `streamUI` function replaced `render`.[5]

AI SDK 3.2 (June 18, 2024) added the first multi-step agent support, through a `maxToolRoundtrips` setting on `generateText` and `streamText`, along with [embeddings](https://aiwiki.ai/wiki/embeddings) (`embed`, `embedMany` and a `cosineSimilarity` helper), client-side tool calls, and providers for Azure OpenAI, Google Vertex and [Cohere](https://aiwiki.ai/wiki/cohere), plus a community-maintained [Ollama](https://aiwiki.ai/wiki/ollama) provider.[6] AI SDK 3.4 (September 20, 2024) added experimental language model middleware, a Data Stream Protocol that let AI SDK UI work with back ends written in any language, output modes for structured generation, multi-step calls in `streamText`, more [OpenTelemetry](https://aiwiki.ai/wiki/opentelemetry) tracing attributes, and mock models for unit testing.[7]

### AI SDK 4 (2024-2025)

AI SDK 4.0 shipped on November 18, 2024.[8] It added PDF inputs for Anthropic and Google models, support for Anthropic's [computer use](https://aiwiki.ai/wiki/computer_use) tools with [Claude 3.5 Sonnet](https://aiwiki.ai/wiki/claude_3_5_sonnet), an experimental option for continuing responses cut off by a length limit, and a first-party [xAI](https://aiwiki.ai/wiki/xai) [Grok](https://aiwiki.ai/wiki/grok) provider; the release also removed deprecated APIs and came with codemods and a migration guide.[8] Other provider changes included OpenAI predicted outputs and [prompt caching](https://aiwiki.ai/wiki/prompt_caching) and a first-party [Groq](https://aiwiki.ai/wiki/groq) provider.[8]

Version 4.1 (announced January 20, 2025) introduced experimental image generation through a `generateImage` function that worked across Replicate, OpenAI, Google Vertex and Fireworks, together with a `smoothStream` transform and tool-call repair.[19] Version 4.2 (March 21, 2025) exposed the output of [reasoning models](https://aiwiki.ai/wiki/reasoning_models), added [Model Context Protocol](https://aiwiki.ai/wiki/model_context_protocol) clients over stdio or SSE, split chat messages into typed parts (text, source, reasoning, tool invocation, file), standardized URL source citations, and added support for OpenAI's Responses API.[20]

### AI SDK 5 (2025)

AI SDK 5, released on July 31, 2025, was a large redesign.[9] Its announcement said the SDK had "over 2 million weekly downloads" at the time.[9] The release:

- separated two message types: `UIMessage`, the application's source of truth meant to be persisted, and `ModelMessage`, a lighter form sent to models, with `convertToModelMessages` converting between them;[9]
- gave the chat integration typed custom data parts, typed tool parts and message metadata, brought Vue and Svelte to feature parity with React, and added Angular support;[9]
- switched server-to-client streaming to Server-Sent Events;[9]
- added agent loop controls, `stopWhen` (with conditions such as `stepCountIs(5)`) and `prepareStep`, and an `Agent` class that the post said "doesn't add new capabilities" but packaged agent configuration;[9]
- renamed tool `parameters` to `inputSchema` and `result` to `output` to align with the Model Context Protocol, and added optional `outputSchema`, dynamic tools and provider-executed tools;[9]
- added experimental speech generation and transcription APIs, and a global provider that lets a model be named by a plain string such as `'openai/gpt-4o'`, defaulting to the Vercel AI Gateway.[9]

The upgrade from 4.x broke a number of APIs. The official migration guide lists changes such as `useChat` no longer managing input state, messages moving from a single content field to a `parts` array, `maxSteps` giving way to `stopWhen`, and the `ai/react` export being removed in favor of the `@ai-sdk/react` package; it notes that the provided codemods "may not cover all of the changes you need to make."[21]

On August 6, 2025, Vercel released **AI Elements**, an open-source library of customizable React components built on shadcn/ui for interfaces made with the AI SDK, such as message threads, input boxes and reasoning panels. It is installed with a CLI (`npx ai-elements@latest`) and pairs with the `useChat` hook.[22]

### AI SDK 6 (2025)

AI SDK 6 was released on December 22, 2025, at which point Vercel said the SDK had "over 20 million monthly downloads" and named Thomson Reuters (for CoCounsel) and Clay (for Claygent) among its users.[10] Its main additions were:[10]

| Feature | Description |
|---|---|
| Agents | `Agent` became an interface; `ToolLoopAgent` is the default implementation, calling tools in a loop with a default limit of 20 steps |
| Tool execution approval | A `needsApproval` flag (or function) pauses a tool call for [human-in-the-loop](https://aiwiki.ai/wiki/human_in_the_loop) approval |
| MCP | Stable support in the `@ai-sdk/mcp` package, adding OAuth, resources, prompts and elicitation |
| Structured output | Tool-calling loops in `generateText` can end in structured output (`Output.object()`, `Output.array()` and others) |
| DevTools | A middleware plus a local viewer (`npx @ai-sdk/devtools`) for inspecting each call's input, output, token usage and timing |
| Reranking | A `rerank` function supporting Cohere, [Amazon Bedrock](https://aiwiki.ai/wiki/amazon_bedrock) and Together.ai |
| Image editing | `generateImage` became stable and accepts reference images |

The release post said most users could upgrade from version 5 with minimal changes using a codemod.[10]

### AI SDK 7 (2026)

AI SDK 7 was released on June 25, 2026, with a post describing the SDK as "the TypeScript SDK for building AI applications, features, frameworks, and agents across any model provider" and citing "over 16 million weekly downloads." The same post says eve, Vercel's open-source agent framework, is built on the SDK.[11] The release concentrated on agents in production:[11]

- **Building agents:** a provider-neutral `reasoning` option, typed per-tool context (so that a value such as an API key reaches only the tool that needs it), file and skill uploads, support for MCP Apps rendered in sandboxed iframes, and a terminal UI package, `@ai-sdk/tui`.
- **Running agents:** richer approval rules, optional HMAC-signed approvals to guard against forged approvals, a `WorkflowAgent` in `@ai-sdk/workflow` for durable, resumable runs, layered timeouts, and a `SandboxSession` abstraction for command execution across sandbox providers.
- **Harnesses:** an experimental `HarnessAgent` that runs Claude Code, Codex and Pi through one interface.
- **Observability:** telemetry registered once at startup with OpenTelemetry support, Node.js tracing channel events, per-step statistics such as time to first output, and named integrations including Datadog, Langfuse, Braintrust, Sentry and Langsmith.
- **Other media:** experimental realtime voice support for OpenAI, Google and xAI, and an experimental `generateVideo` function.

## Release timeline

| Version | Date | Highlights |
|---|---|---|
| 2.0 | 2023-06-15 | First release: `useChat`, `useCompletion`, streaming helpers, React and Svelte[3] |
| 3.0 | 2024-03-01 | Generative UI with React Server Components[4] |
| 3.1 | 2024-05-02 | AI SDK Core, UI and RSC; `generateText`, `generateObject`; `streamUI`[5] |
| 3.2 | 2024-06-18 | Multi-step tool calls, embeddings, more providers[6] |
| 3.4 | 2024-09-20 | Middleware, Data Stream Protocol, mock models[7] |
| 4.0 | 2024-11-18 | PDF input, computer use, xAI provider[8] |
| 4.1 | 2025-01-20 | Experimental image generation[19] |
| 4.2 | 2025-03-21 | Reasoning output, MCP clients, message parts[20] |
| 5.0 | 2025-07-31 | `UIMessage`/`ModelMessage`, SSE, `stopWhen`, Angular[9] |
| 6.0 | 2025-12-22 | `ToolLoopAgent`, tool approval, stable MCP, DevTools[10] |
| 7.0 | 2026-06-25 | Durable agents, harnesses, telemetry, realtime[11] |

The dates are those of Vercel's announcement posts. For each major release (2.0 to 7.0), npm publication of the x.0.0 package fell on the same day as the post or the day before.[1]

## Design

### Core functions

AI SDK Core is built around paired functions: `generateText` for non-interactive work such as automation and tool-using agents, and `streamText` for interactive uses such as chatbots.[23] Both accept an `output` setting for typed, schema-validated structured data.[23] Over the releases the same pattern was extended to embeddings (`embed`, `embedMany`), images (`generateImage`), speech and transcription, reranking (`rerank`) and, experimentally, video.[6][10][9][11]

### UI hooks and streaming

AI SDK UI centers on `useChat`, which manages chat state and streaming on the client.[9] Since version 5, the hook works with `UIMessage` objects made of typed parts, and the server streams to it over Server-Sent Events.[9] Version 3.4's Data Stream Protocol was introduced so that the UI hooks could talk to back ends not written in JavaScript.[7]

### Providers

Official provider packages are published under the `@ai-sdk/` scope (for example `@ai-sdk/openai`, `@ai-sdk/anthropic` and `@ai-sdk/google`).[12] As of November 2026 the documentation lists first-party providers for, among others, xAI Grok, OpenAI, Azure OpenAI, Anthropic, Amazon Bedrock, Google, Google Vertex, [Mistral](https://aiwiki.ai/wiki/mistral_ai), Together.ai, Cohere, Fireworks, DeepInfra, [DeepSeek](https://aiwiki.ai/wiki/deepseek), Cerebras, Groq and Perplexity.[17] An OpenAI Compatible provider covers other APIs that follow OpenAI's format, and the documentation lists dozens of community providers, including Ollama, [OpenRouter](https://aiwiki.ai/wiki/openrouter) and Cloudflare Workers AI.[17] From version 5, a model can also be named with a `provider/model` string routed through the Vercel AI Gateway by default.[9]

### Agents

Agent support grew in steps: tool round trips in 3.2, multi-step `streamText` calls in 3.4, `stopWhen` and `prepareStep` in 5.0, the `ToolLoopAgent` in 6.0, and durable `WorkflowAgent` and `HarnessAgent` in 7.0.[6][7][9][10][11] Tools are defined with an input schema and an optional `execute` function, and since version 6 a tool can require approval before it runs.[6][9][10] Third-party tools also integrate with it: on January 20, 2026, Temporal announced an AI SDK integration for its TypeScript SDK that adds long-running workflows, automatic retries and durable state.[24]

## Adoption

Vercel has reported the SDK's npm downloads in several forms. Its September 30, 2025 Series F announcement, written by Guillermo Rauch, said weekly downloads had risen from 446,012 to 3,209,817 in one year, called the SDK "by far our fastest-growing open source project ever," and wrote that it "might be one of the most consequential projects we've ever worked on."[13] The AI SDK 7 post in June 2026 cited more than 16 million weekly downloads.[11] npm's public download API recorded 47,150,887 downloads of the `ai` package in the week of November 11 to 17, 2026.[14]

As of November 2026 the GitHub repository, `vercel/ai`, had about 28,100 stars and 5,600 forks.[12] The current package requires Node.js 22 or later.[1][12] The documentation moved from sdk.vercel.ai to ai-sdk.dev, and the old address redirects to the new one.[15]

## Security

Vercel publishes security advisories for the SDK on its changelog. CVE-2025-48985, disclosed on November 6, 2025 and rated low severity, was a flaw in the prompt conversion pipeline: when a prompt mixed supported and unsupported file URLs, downloaded bytes could be matched to the wrong URL, letting an attacker get around file-type allowlists in `generateText` and `streamText`. It was fixed in version 5.0.52 and in the 6.0.0 betas.[25]

## See also

- [Vercel](https://aiwiki.ai/wiki/vercel)
- [v0](https://aiwiki.ai/wiki/vercel_v0)
- [Mastra](https://aiwiki.ai/wiki/mastra)
- [LangChain](https://aiwiki.ai/wiki/langchain)
- [LlamaIndex](https://aiwiki.ai/wiki/llamaindex)
- [OpenAI Agents SDK](https://aiwiki.ai/wiki/openai_agents_sdk)
- [Function calling](https://aiwiki.ai/wiki/function_calling)
- [Tool use](https://aiwiki.ai/wiki/tool_use)

## References

1. npm, Inc. "ai" (package metadata and version history). npm registry, accessed 2026-11-18. https://registry.npmjs.org/ai
2. Vercel. "AI SDK by Vercel" (Introduction). AI SDK documentation, accessed 2026-11-18. https://ai-sdk.dev/docs/introduction
3. Jared Palmer, Shu Ding, Max Leiter. "Introducing the Vercel AI SDK". Vercel blog, June 15, 2023. https://vercel.com/blog/introducing-the-vercel-ai-sdk
4. Jared Palmer, Shu Ding, Max Leiter, Shadcn, Lars Grammel, Jeremy Philemon. "Introducing AI SDK 3.0 with Generative UI support". Vercel blog, March 1, 2024. https://vercel.com/blog/ai-sdk-3-generative-ui
5. Jared Palmer, Lars Grammel. "Vercel AI SDK 3.1: ModelFusion joins the team". Vercel blog, May 2, 2024. https://vercel.com/blog/vercel-ai-sdk-3-1-modelfusion-joins-the-team
6. Lars Grammel, Jared Palmer, Aryaman Khandelwal. "Introducing Vercel AI SDK 3.2". Vercel blog, June 18, 2024. https://vercel.com/blog/introducing-vercel-ai-sdk-3-2
7. Lars Grammel, Jared Palmer, Jeremy Philemon, Nico Albanese. "AI SDK 3.4". Vercel blog, September 20, 2024. https://vercel.com/blog/ai-sdk-3-4
8. Lars Grammel, Jared Palmer, Nico Albanese, Walter Korman. "AI SDK 4.0". Vercel blog, November 18, 2024. https://vercel.com/blog/ai-sdk-4-0
9. Lars Grammel, Nico Albanese, Josh Singh. "AI SDK 5". Vercel blog, July 31, 2025. https://vercel.com/blog/ai-sdk-5
10. Gregor Martynus, Lars Grammel, Aayush Kapoor, Josh Singh, Nico Albanese. "AI SDK 6". Vercel blog, December 22, 2025. https://vercel.com/blog/ai-sdk-6
11. Gregor Martynus, Lars Grammel, Felix Arntz, Aayush Kapoor, Josh Singh. "AI SDK 7". Vercel blog, June 25, 2026. https://vercel.com/blog/ai-sdk-7
12. Vercel. "vercel/ai" (repository and README). GitHub, accessed 2026-11-18. https://github.com/vercel/ai
13. Guillermo Rauch. "Towards the AI Cloud: Our Series F". Vercel blog, September 30, 2025. https://vercel.com/blog/series-f
14. npm, Inc. "Downloads for ai, last week (2026-11-11 to 2026-11-17)". npm download counts API, accessed 2026-11-18. https://api.npmjs.org/downloads/point/last-week/ai
15. Vercel. "AI SDK documentation" (301 redirect from sdk.vercel.ai/docs to ai-sdk.dev/docs). Accessed 2026-11-18. https://sdk.vercel.ai/docs
16. Vercel. "AI SDK RSC". AI SDK documentation, accessed 2026-11-18. https://ai-sdk.dev/docs/ai-sdk-rsc/overview
17. Vercel. "Providers and Models". AI SDK documentation, accessed 2026-11-18. https://ai-sdk.dev/docs/foundations/providers-and-models
18. Lars Grammel. "modelfusion" (package metadata and README). npm registry, accessed 2026-11-18. https://registry.npmjs.org/modelfusion
19. Lars Grammel, Jared Palmer, Nico Albanese, Walter Korman. "AI SDK 4.1". Vercel blog, January 20, 2025. https://vercel.com/blog/ai-sdk-4-1
20. Lars Grammel, Jared Palmer, Nico Albanese. "AI SDK 4.2". Vercel blog, March 21, 2025. https://vercel.com/blog/ai-sdk-4-2
21. Vercel. "Migrate AI SDK 4.x to 5.0". AI SDK documentation, accessed 2026-11-18. https://ai-sdk.dev/docs/migration-guides/migration-guide-5-0
22. Hayden Bleasel, Ryan Haraki. "Introducing AI Elements: Prebuilt, composable AI SDK components". Vercel changelog, August 6, 2025. https://vercel.com/changelog/introducing-ai-elements
23. Vercel. "AI SDK Core: Overview". AI SDK documentation, accessed 2026-11-18. https://ai-sdk.dev/docs/ai-sdk-core/overview
24. Temporal. "AI SDK by Vercel Integration". Temporal changelog, January 20, 2026. https://temporal.io/changelog/ai-sdk-vercel-integration
25. Aaron Brown, Gregor Martynus. "CVE-2025-48985: Input Validation Bypass on AI SDK". Vercel changelog, November 6, 2025. https://vercel.com/changelog/cve-2025-48985-input-validation-bypass-on-ai-sdk

