Vercel AI SDK
The Vercel AI SDK (also called the AI SDK, or "AI SDK by Vercel") is an open-source TypeScript toolkit from Vercel for building applications and agents on top of large language models.[1][2] It gives developers one API for calling models from many providers, including OpenAI, Anthropic and Google, together with front-end hooks for chat and streaming interfaces in React, Next.js, 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 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, 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]
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 and 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 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 (embed, embedMany and a cosineSimilarity helper), client-side tool calls, and providers for Azure OpenAI, Google Vertex and Cohere, plus a community-maintained 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 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 tools with Claude 3.5 Sonnet, an experimental option for continuing responses cut off by a length limit, and a first-party xAI 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 and a first-party 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, added 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, andModelMessage, a lighter form sent to models, withconvertToModelMessagesconverting 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 asstepCountIs(5)) andprepareStep, and anAgentclass that the post said "doesn't add new capabilities" but packaged agent configuration;[9] - renamed tool
parameterstoinputSchemaandresulttooutputto align with the Model Context Protocol, and added optionaloutputSchema, 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 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 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
reasoningoption, 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
WorkflowAgentin@ai-sdk/workflowfor durable, resumable runs, layered timeouts, and aSandboxSessionabstraction for command execution across sandbox providers. - Harnesses: an experimental
HarnessAgentthat 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
generateVideofunction.
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, Together.ai, Cohere, Fireworks, DeepInfra, 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 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]
Continue reading
- VercelVercel (originally ZEIT) is an American cloud platform-as-a-service (PaaS) company headquartered in San Francisco, California, best known as the creator of Next.js and as a hosting platform for modern frontend…Mentioned 20 times above
- LangChainLangChain is an open-source software framework for applications that use large language models.Listed in See also
- v0 (Vercel)v0 is an AI application builder from Vercel that turns natural-language prompts and images into working React code, generating user interfaces styled with Tailwind CSS and the shadcn/ui component library.Listed in See also
- MastraMastra is an open-source TypeScript framework for building AI agents, workflows, and retrieval-augmented generation pipelines.Listed in See also
- LlamaIndexLlamaIndex is an open-source data framework for building large language model (LLM) applications, with a particular focus on retrieval-augmented generation (RAG) and document processing.Listed in See also
- OpenAI Agents SDKThe OpenAI Agents SDK is an open-source, lightweight framework developed by OpenAI for building multi-agent systems and agentic workflows, built around four core primitives: agents, handoffs, guardrails, and…Listed in See also
More from See also
More to read
References
- ^1 ^2 ^3 ^4 ^5npm, Inc. "ai" (package metadata and version history). npm registry, accessed 2026-11-18. registry.npmjs.org/ai
- ^1 ^2 ^3 ^4Vercel. "AI SDK by Vercel" (Introduction). AI SDK documentation, accessed 2026-11-18. ai-sdk.dev/...introduction
- ^1 ^2 ^3 ^4 ^5 ^6 ^7Jared Palmer, Shu Ding, Max Leiter. "Introducing the Vercel AI SDK". Vercel blog, June 15, 2023. vercel.com/...introducing-the-vercel-ai-sdk
- ^1 ^2 ^3 ^4Jared Palmer, Shu Ding, Max Leiter, Shadcn, Lars Grammel, Jeremy Philemon. "Introducing AI SDK 3.0 with Generative UI support". Vercel blog, March 1, 2024. vercel.com/...ai-sdk-3-generative-ui
- ^1 ^2 ^3 ^4 ^5 ^6 ^7Jared Palmer, Lars Grammel. "Vercel AI SDK 3.1: ModelFusion joins the team". Vercel blog, May 2, 2024. vercel.com/...i-sdk-3-1-modelfusion-joins-the-team
- ^1 ^2 ^3 ^4 ^5Lars Grammel, Jared Palmer, Aryaman Khandelwal. "Introducing Vercel AI SDK 3.2". Vercel blog, June 18, 2024. vercel.com/...introducing-vercel-ai-sdk-3-2
- ^1 ^2 ^3 ^4Lars Grammel, Jared Palmer, Jeremy Philemon, Nico Albanese. "AI SDK 3.4". Vercel blog, September 20, 2024. vercel.com/...ai-sdk-3-4
- ^1 ^2 ^3 ^4Lars Grammel, Jared Palmer, Nico Albanese, Walter Korman. "AI SDK 4.0". Vercel blog, November 18, 2024. vercel.com/...ai-sdk-4-0
- ^1 ^2 ^3 ^4 ^5 ^6 ^7 ^8 ^9 ^10 ^11 ^12 ^13 ^14 ^15 ^16Lars Grammel, Nico Albanese, Josh Singh. "AI SDK 5". Vercel blog, July 31, 2025. vercel.com/...ai-sdk-5
- ^1 ^2 ^3 ^4 ^5 ^6 ^7Gregor Martynus, Lars Grammel, Aayush Kapoor, Josh Singh, Nico Albanese. "AI SDK 6". Vercel blog, December 22, 2025. vercel.com/...ai-sdk-6
- ^1 ^2 ^3 ^4 ^5 ^6 ^7Gregor Martynus, Lars Grammel, Felix Arntz, Aayush Kapoor, Josh Singh. "AI SDK 7". Vercel blog, June 25, 2026. vercel.com/...ai-sdk-7
- ^1 ^2 ^3 ^4Vercel. "vercel/ai" (repository and README). GitHub, accessed 2026-11-18. github.com/...ai
- ^Guillermo Rauch. "Towards the AI Cloud: Our Series F". Vercel blog, September 30, 2025. vercel.com/...series-f
- ^npm, Inc. "Downloads for ai, last week (2026-11-11 to 2026-11-17)". npm download counts API, accessed 2026-11-18. api.npmjs.org/...ai
- ^Vercel. "AI SDK documentation" (301 redirect from sdk.vercel.ai/docs to ai-sdk.dev/docs). Accessed 2026-11-18. sdk.vercel.ai/docs
- ^Vercel. "AI SDK RSC". AI SDK documentation, accessed 2026-11-18. ai-sdk.dev/...overview
- ^1 ^2 ^3 ^4Vercel. "Providers and Models". AI SDK documentation, accessed 2026-11-18. ai-sdk.dev/...providers-and-models
- ^Lars Grammel. "modelfusion" (package metadata and README). npm registry, accessed 2026-11-18. registry.npmjs.org/modelfusion
- ^1 ^2Lars Grammel, Jared Palmer, Nico Albanese, Walter Korman. "AI SDK 4.1". Vercel blog, January 20, 2025. vercel.com/...ai-sdk-4-1
- ^1 ^2Lars Grammel, Jared Palmer, Nico Albanese. "AI SDK 4.2". Vercel blog, March 21, 2025. vercel.com/...ai-sdk-4-2
- ^Vercel. "Migrate AI SDK 4.x to 5.0". AI SDK documentation, accessed 2026-11-18. ai-sdk.dev/...migration-guide-5-0
- ^Hayden Bleasel, Ryan Haraki. "Introducing AI Elements: Prebuilt, composable AI SDK components". Vercel changelog, August 6, 2025. vercel.com/...introducing-ai-elements
- ^1 ^2Vercel. "AI SDK Core: Overview". AI SDK documentation, accessed 2026-11-18. ai-sdk.dev/...overview
- ^Temporal. "AI SDK by Vercel Integration". Temporal changelog, January 20, 2026. temporal.io/...ai-sdk-vercel-integration
- ^Aaron Brown, Gregor Martynus. "CVE-2025-48985: Input Validation Bypass on AI SDK". Vercel changelog, November 6, 2025. vercel.com/...85-input-validation-bypass-on-ai-sdk
Improve this article
Add missing citations, update stale details, or write a clearer explanation. Anyone can edit: changes go live when you publish, and every edit is checked by an editor.
2 revisions · v2 · 2,744 words · full history
Fact-checks are independent of edits: a reviewer re-verifies the article against its sources and stamps the date. How we verify
Research and drafting on this wiki are AI-assisted, under named human editorial standards. How AI is used here
Reviewer note: Independent fact-check before publication on November 18, 2026: 84 claims checked against 26 cited and independent sources; 0 material and 3 minor corrections applied before publication.
Cite this page: AI Wiki. "Vercel AI SDK." aiwiki.ai, updated 18 Nov 2026, fact-checked 18 Nov 2026. CC BY 4.0. https://aiwiki.ai/wiki/vercel_ai_sdk



