Vercel AI SDK: adding AI and agents to a web app
The Vercel AI SDK is a free, open-source TypeScript library that gives you one API for AI models from many providers. Use it to add chat, structured answers or an AI agent to a web app, from Next.js to Svelte.
Data as of October 22, 2026
Key figures
| Developer | Vercel |
|---|---|
| Type | Code |
| Languages | TypeScript |
| Open source | Yes |
| License | Apache-2.0 |
| First release | June 2023 |
| Suggested level | Intermediate |
| Use cases | chatbot, RAG, workflows |
| Self-hostable | Yes |
| Business model | Free |
| Cloud offering | No |
| Multi-agent | Yes |
| MCP support | Yes |
| Bring your own model | Yes |
| Official site | Official site · Documentation · Repository |
GitHub
| Repository | vercel/ai |
|---|---|
| GitHub stars | 27,452 |
| Forks | 5,415 |
| Latest code activity | October 22, 2026 |
| Latest release | @ai-sdk/zai@3.0.37 (October 21, 2026) |
GitHub activity checked on October 22, 2026.
A library, not a platform
The Vercel AI SDK, from the company behind Next.js, is best thought of as a toolkit. Its core idea is a unified API: the same code calls a model from OpenAI, Anthropic, Google or another provider, and switching models means changing one line. Around that core you get streaming text generation, schema-validated structured output, tool calling and UI hooks for React, Svelte, Vue and Angular.
For AI agents, the ToolLoopAgent class keeps calling tools until the task is done. The docs also cover memory, approvals before a tool runs, subagents and connecting to MCP servers to pull in external tools.
Who it is for, and how to start
The SDK targets TypeScript developers, from a freelancer adding an assistant to a client site to full product teams. It requires Node.js 22 or later. You install the ai package with npm, then pick one of two routes: go through Vercel AI Gateway with just a model name, or install a provider package (for example @ai-sdk/anthropic) and use your own API key. The ai-sdk.dev site has guides, chatbot examples and a full reference. There is also an official “skill” you can add to a coding assistant so it knows the library.
Strengths and limits
Strengths. Free and Apache 2.0, provider-agnostic, excellent streaming integration with web UIs, extensive docs, frequent releases.
Limits. The SDK does not ship a database, a dashboard or a durable workflow engine out of the box: for a complete agent application you assemble those yourself. The default behavior of routing calls through AI Gateway can catch people off guard, so check where your requests go and who bills you. And the API moves quickly between major versions, which means regular migrations.
Alternatives
Mastra shares the TypeScript-first philosophy but adds workflows, memory and evals in a fuller framework. In Python, the OpenAI Agents SDK and Pydantic AI fill a similar lightweight-toolkit niche. To estimate what model calls will cost you, try our AI agent cost calculator.
Official docs: ai-sdk.dev.
Frameworks of the same type
- Agno · multi-agent, workflows, RAG
- Haystack · RAG, chatbot, workflows
- LangChain · chatbot, RAG, workflows
- Mastra · multi-agent, workflows, RAG
- Amazon Bedrock Agents / AgentCore · multi-agent, RAG, workflows
- Atomic Agents · workflows, chatbot, automation
Frequently asked questions
Do I have to host my app on Vercel to use the AI SDK?
No. The library is Apache 2.0 licensed and runs on Node.js with the major web frameworks, whatever your hosting provider. Vercel does not lock you into its platform.
Does the AI SDK cost anything?
The library itself is free. You pay for the models: either directly to each provider with your own key, or through Vercel AI Gateway. Vercel says the gateway charges providers' list prices with no markup and offers a limited free tier.
How is Vercel AI Gateway different from the AI SDK?
It is a separate service that gives you many models behind a single key. By default, when you pass a model name as a plain string, the AI SDK routes through that gateway. You can skip it by installing each provider's own package.
Can you build real agents with the AI SDK?
Yes. The ToolLoopAgent class runs the agent loop and tool calls, with stop conditions, human approvals and subagents. For long-running, durable workflows you will still need extra pieces.
Data sources
- github.com
- ai-sdk.dev
- ai-sdk.dev
- ai-sdk.dev
- vercel.com
- GitHub — Repository metadata: GitHub
Data as of October 22, 2026
Report an error
Does a figure, a date or a fact look wrong? Tell us: every report is checked.