Vercel AI SDK

Vercel AI SDK is a free, Apache 2.0 TypeScript toolkit for building streaming AI UIs and agents with React, Next.js, Vue, Svelte, and Node.js. It unifies 100+ models across providers behind a single API, ships React hooks for chat and generative UI, and requires Node.js 22+ with ESM-only imports in v7. It is not a RAG framework or a full agent orchestrator.

AI SDKTypeScriptstreaming UIReact hooksNext.jsprovider-agnosticgenerative UIagent primitivesopen sourceApache 2.0
Vercel AI SDK hero image
Overview

What is Vercel AI SDK?

Vercel AI SDK is a TypeScript-first toolkit for building AI applications, maintained by the Vercel team. Its center of gravity is the web application layer: streaming LLM responses into React, Next.js, Vue, or Svelte UIs, handling chat state, and rendering generative interfaces. The SDK is provider-agnostic — it supports roughly 38 first-party provider packages and 100+ models through the Vercel AI Gateway — but it does not replace the model provider’s API; it standardizes how an application talks to that provider.

The SDK is free and open source under Apache 2.0. It works with any hosting provider and does not require a Vercel account. The Vercel AI Gateway and the Vercel platform itself are separate commercial products that can be used alongside the SDK but are not prerequisites for it. The distinction matters for cost modeling: the SDK costs nothing, while a production application’s actual expense is the model provider’s token pricing plus whatever hosting and infrastructure the operator chooses.

Workflow

How does Vercel AI SDK work?

A server-side route (commonly a Next.js Route Handler) calls generateText or streamText with a model string or a provider SDK instance. The SDK normalizes the provider’s response into a consistent stream or object, which the UI layer consumes through hooks such as useChat or useCompletion. On the client, those hooks manage message state, streaming updates, and error handling without requiring custom SSE plumbing.

AI SDK 7 introduced a split between UIMessage (the UI’s ordered parts array) and ModelMessage (the LLM’s input), a distinction intended to make persistence and type-safe message handling cleaner. Agent development is supported through ToolLoopAgent and agent primitives — tool definitions, runtime context, and scoped tool context — but the orchestration loop remains the application’s responsibility. The SDK provides the building blocks; it does not impose a workflow engine. Structured output is handled through generateObject / streamObject with Zod schemas, and the SDK includes speech and transcription APIs, image generation, and MCP support at the boundaries of its Core and UI layers.

Use cases

Use Cases

  • Building a streaming chat interface in Next.js or React where the primary requirement is a clean integration between the model response stream and the component tree.
  • Adding a generative UI element — a tool call that renders a React component — without hand-writing the tool-call-to-UI plumbing.
  • Standardizing model access across OpenAI, Anthropic, and Google so that the provider can be swapped with a model-string change rather than a rewrite of the application’s call sites.
  • Prototyping an agent that calls tools in a loop using ToolLoopAgent, with the expectation that state persistence and complex branching will be added later or handled by a separate framework.
  • Building a structured-output feature (e.g., extracting a recipe or a form payload from a prompt) using generateObject with a Zod schema, on a runtime that meets the Node 22+/ESM requirement.
  • Deploying on Vercel and using AI Gateway for zero-markup model routing and the $5/month credit, while keeping the option to connect directly to provider SDKs later if the platform dependency becomes undesirable.
Pricing

Pricing

Pricing model: Free

Plan Price Billing Included usage Notes
AI SDK (library) Free — Apache 2.0 open-source TypeScript library. No license fee, no per-seat charge, and no hosting requirement. Works with any model provider and any hosting platform. Costs are limited to the model provider’s own API pricing and the operator’s compute/hosting. —
Vercel AI Gateway (optional paid platform service) $5 per month included credit, then pay-as-you-go Every Vercel team account receives $5/month in AI Gateway credits. The Gateway routes requests across providers and models with zero per-token markup, including on bring-your-own-key requests. Paid tier is pay-as-you-go with purchased credits. This is a separate commercial service from the open-source SDK; using the SDK does not require the Gateway. —
Vercel Platform (Hobby / Pro / Enterprise) Free / $20 / Custom Hobby free, Pro $20 per seat per month with $20 usage credit, Enterprise custom Hosting and deployment for applications built with the SDK. Hobby is restricted to personal, non-commercial use. Pro includes $20 monthly usage credit; compute and data transfer beyond the credit are usage-billed. Enterprise adds custom capacity and terms. These plans price the Vercel platform, not the SDK itself. —
Free tier: The AI SDK library itself is free and open source (Apache 2.0). A Vercel Hobby account is free but restricted to personal, non-commercial use. The Vercel AI Gateway includes $5/month in credits on every team account, separate from the SDK’s licensing. Self-hosting the SDK does not require a Vercel account at all.
Limitations

Common Limitations

  • Node.js 22+ runtime requirement · AI SDK 7 requires Node.js 22 or later. Node.js 18 and 20 are not supported. The SDK depends on native fetch and improved AsyncLocalStorage semantics that are not backported to earlier LTS lines. Projects still on Node 20 or below must upgrade the runtime before adopting or upgrading to v7.
  • ESM-only modules · AI SDK 7 packages are ESM-only. CommonJS require() is not supported. Projects must use import syntax or .mjs files and set "type": "module" in package.json where applicable. Applications with CommonJS entry points or dependencies that only expose CJS need migration work before upgrading.
  • No built-in RAG layer · The SDK provides embed() and embedMany() primitives, but no built-in vector-store adapter layer, document ingestion pipeline, chunking strategy, or query engine. RAG support is “bring your own”: operators integrate Pinecone, Qdrant, pgvector, or another store separately. LlamaIndex.TS is purpose-built for this layer; the Vercel AI SDK is not.
  • Agent orchestration is lightweight · The SDK provides agent primitives and a ToolLoopAgent, but it is not a full agent framework. There is no built-in state machine, persistence layer, checkpointing, durable execution engine, or stopping-condition evaluator comparable to LangGraph. Teams that need multi-step branching, human-in-the-loop checkpoints, or persistent state across sessions must either build that logic themselves or combine the SDK with an orchestration layer.
  • TypeScript/JavaScript only · The SDK is TypeScript/JS only. An AI SDK for Python is in public beta, but Python, Go, Java, and other language ecosystems do not have an equivalent first-party SDK. Teams with polyglot stacks or Python-centric backend teams face a language boundary that LangChain and LlamaIndex (both Python + JS/TS) do not impose.
  • Vercel AI Gateway is optional but platform-coupled · The SDK works without Vercel and without the AI Gateway. However, the Gateway’s $5/month credit and zero-markup routing are Vercel account features. Teams that choose the Gateway for convenience are adopting a Vercel platform dependency; teams that connect directly to provider SDKs (@ai-sdk/openai, @ai-sdk/anthropic, etc.) avoid that dependency but manage provider keys and routing themselves.
  • Breaking changes across major versions · AI SDK 7 introduced two breaking requirements (Node 22 and ESM-only) on top of the v5→v6→v7 agent-model evolution. v5 split UIMessage from ModelMessage; v6 added the Agent model; v7 turned the SDK into an agent platform with tool approvals, WorkflowAgent execution, and a redesigned telemetry surface. Upgrading from earlier majors requires codemods and semantic migration, not a patch bump. Projects on v4 or earlier face a larger jump.
Features

Key Features

  • Unified generateText / streamText API across 100+ models and 16+ providers
  • Framework-agnostic UI hooks: useChat, useCompletion, useObject for React, Next.js, Vue, Svelte
  • Structured object generation with Zod schema validation
  • Tool calling with automatic execution loops and tool-based generative UI
  • ToolLoopAgent and agent primitives (runtimeContext, toolsContext, scoped tool context) in v7
Comparison

Vercel AI SDK vs. LangChain JS and LlamaIndex.TS

This comparison uses current official documentation, public pricing, and documented product positioning. The three tools solve adjacent but distinct problems: Vercel AI SDK centers on streaming UI and provider unification for TypeScript web apps; LangChain JS centers on orchestration breadth and graph-based agents; LlamaIndex.TS centers on document-first RAG. The comparison is not a quality ranking and does not claim that one tool is universally better than another.

Tool Positioning Key differences Best fit Pricing note
Vercel AI SDK Official AI SDK introduction AI SDK 7 changelog (Node 22, ESM-only, agent platform) Vercel AI Gateway pricing A TypeScript-first toolkit for streaming AI UIs and provider-unified model access, with agent primitives added in v7. Apache 2.0, free, no hosting requirement. Strongest at streaming integration with React/Next.js and generative UI. Provider-agnostic across 100+ models. Requires Node.js 22+ and ESM-only modules in v7. No built-in vector store or RAG pipeline; agent orchestration is lightweight compared with LangGraph. Optional Vercel AI Gateway adds a paid platform dependency. Teams building a TypeScript/React/Next.js web application where streaming chat, structured output, and a clean UI integration are the primary requirements, and where RAG depth or complex agent orchestration is not the central problem. The SDK is free (Apache 2.0). Vercel AI Gateway includes $5/month in credits per team account, with pay-as-you-go thereafter. The Vercel platform’s Hobby plan is free for personal, non-commercial use; Pro starts at $20/seat/month with a $20 usage credit.
LangChain JS LangChain JS overview (via comparison source) LangGraph orchestration reference A broad AI orchestration framework with LangGraph for stateful, graph-based agent workflows. MIT-licensed, free OSS. Optimized for orchestration breadth: retrievers across dozens of vector stores, document loaders, output parsers, and LangGraph for conditional edges, persistence, checkpointing, and human-in-the-loop. Runs on Node.js, Deno, and edge runtimes, with broader runtime compatibility than the Vercel AI SDK’s Node 22+/ESM-only requirement. UI integration is not a first-class concern; there are no built-in React hooks or generative UI components comparable to the Vercel SDK’s UI module. Learning curve is steeper, and the framework has a history of frequent breaking changes. Applications that need complex multi-step agent orchestration with state machines, persistence, and human-in-the-loop checkpoints, especially when Python and TypeScript interoperability or a broader integration catalog matters. LangChain JS is free and MIT-licensed. LangSmith, the observability and evaluation platform, is a separate commercial add-on with its own pricing.
LlamaIndex.TS LlamaIndex.TS RAG positioning (via comparison source) LlamaIndex.TS repository A document-first framework for RAG applications, with ingestion, chunking, indexing, and query engines as first-class concepts. MIT-licensed, free OSS. Deepest RAG support among the three: document loaders, chunking strategies, hybrid retrieval, sub-question query engines, and vector-store integrations (Pinecone, Weaviate, Chroma, pgvector, etc.). Agent support has grown, but it is less mature than LangGraph for complex branching workflows. Generative UI integration is thinner than the Vercel AI SDK’s; LlamaIndex is not designed around streaming React components. LlamaCloud is a separate paid managed service for parsing, indexing, and retrieval at scale. Document-heavy applications where retrieval quality, ingestion flexibility, and query-engine abstractions are the primary engineering problem, rather than streaming UI or provider unification. LlamaIndex.TS is free under MIT. LlamaCloud (managed parsing, indexing, and retrieval) is billed separately with its own pricing tiers.

Comparison checked against official product information on 2026-11-08. Features and pricing may change.

FAQ

Frequently Asked Questions

Is Vercel AI SDK free to use?

Yes. The SDK is an Apache 2.0 open-source library with no license fee, no per-seat charge, and no hosting requirement. The costs of using it are the model provider’s API pricing and the operator’s own compute or hosting. The Vercel AI Gateway and the Vercel platform are separate paid products that can be used alongside the SDK but are not required.

Does Vercel AI SDK require Node.js 22?

Yes, as of AI SDK 7. The SDK requires Node.js 22 or later and its packages are ESM-only; CommonJS require() is not supported. Node.js 18 and 20 are no longer supported. Projects on older runtimes must upgrade before adopting v7 or migrating from an earlier major.

Does Vercel AI SDK include a vector database or RAG pipeline?

No. The SDK provides embed() and embedMany() primitives, but it does not ship a vector-store adapter layer, document ingestion pipeline, chunking strategy, or query engine. RAG is “bring your own”: operators integrate a vector store (Pinecone, Qdrant, pgvector, etc.) and wire retrieval into their application. LlamaIndex.TS is the more direct choice when RAG is the primary requirement.

Is Vercel AI SDK an agent framework like LangGraph?

Not in the same sense. The SDK provides agent primitives (ToolLoopAgent, tool definitions, runtime context) and, in v7, durable WorkflowAgent execution and tool approvals. But it does not include a built-in state machine, persistence layer, checkpointing, or conditional-edge orchestration engine comparable to LangGraph. Teams that need complex multi-step branching, human-in-the-loop checkpoints, and durable state across sessions typically build that logic themselves or combine the SDK with an orchestration layer.

Do I have to deploy on Vercel to use the AI SDK?

No. The SDK is a library and works with any hosting provider. It does not require a Vercel account. The Vercel AI Gateway and the Vercel platform are optional; using them adds a platform dependency but is not a prerequisite for the SDK itself.

Vercel AI SDK hero image