Vercel AI SDK
The Vercel AI SDK is an open-source TypeScript toolkit, free to use, that lets apps talk to AI models from many companies through the same code.
The Vercel AI SDK is a toolkit for building AI apps and agents in TypeScript, a programming language. You can use it from Node.js on a server, or in front-end frameworks such as Svelte, Vue, Next.js and React. The makers of Next.js publish the AI SDK as open-source code that anyone can use at no cost. It has two main parts. AI SDK Core asks models for text, structured data and tool calls. AI SDK UI gives you ready-made hooks for chat screens. A hook is a small reusable piece of front-end code.
The main problem it solves is that every AI company, or provider, has its own way of calling its models. The SDK puts one shared interface in front of many providers. Switching providers means changing the model you name, not rewriting the calls. Supported providers include OpenAI, Anthropic, Google, Mistral and Groq, and outside developers have written more.
Large language models, the AI behind chatbots, can be slow when they write long answers. Picture a homework-help chat page. On the server, the streamText function sends the reply in pieces as the model writes them. In the page, the useChat hook shows each piece as it arrives, so the student reads along instead of watching a spinner.
Tools are things the model can call to do a specific task, such as looking up the weather. Each tool comes with a schema. A schema is a description of the inputs the tool accepts. The model reads it. The SDK uses the same schema to check the model’s tool request. By default, a call gets one answer from the model. To allow more steps, you set a stop rule. With a stop rule, the SDK feeds each tool result back to the model until there are no more tool calls or the rule says stop. The ToolLoopAgent class wraps that loop for you. In the docs’ weather example, the agent’s first step is a weather lookup that returns a Fahrenheit reading.
Building an AI feature straight on one company's API leaves you with three chores.
Follow one weather question through an app built with the AI SDK.
- 1 · askIn the browser, a hook called useChat sends the message and tracks the chat's messages.
- 2 · callOn the server, a function called streamText sends the prompt, a model and a list of tools.
- 3 · loopWith a stop rule set, the SDK runs the tool and passes the result back for another generation.
- 4 · streamThe reply is sent in parts as they are ready, and useChat shows them on screen.
The model asks for a tool; the SDK is what actually runs it.
| Who | What they ask | What it works with |
|---|---|---|
| Web developer | “Can our chatbot try a different model without a rewrite?” | The shared model interface and a provider package |
| Student building a project | “How do I make a chat page that shows words as they are written?” | streamText on the server and useChat in the page |
| Support team engineer | “Can our assistant check an order before it replies?” | A tool with a schema that queries the order system |
- One interface covers many providers, so you can switch models while using the same functions.
- It streams text generation in under 10 lines of code.
- The useChat hook manages chat messages, loading and error state for you.
- It checks the model's tool requests against each tool's schema.
- Streaming is not always needed, and a smaller, faster model without it can be simpler.
- A single call makes one generation by default, so tool loops need a stop rule you set.
- It is a TypeScript toolkit, aimed at web frameworks and Node.js.
Sources used
This explainer is written in original language. The links below support its factual claims.
- docsAI SDK by Vercel, Vercel · read 28 Sept 2026
- docsProviders and Models, Vercel · read 28 Sept 2026
- docsTool Calling, Vercel · read 28 Sept 2026
- docsAI SDK UI, Vercel · read 28 Sept 2026
- docsStreaming, Vercel · read 28 Sept 2026
- docsAgents, Vercel · read 28 Sept 2026
- repovercel/ai, Vercel on GitHub · read 28 Sept 2026
- docsstreamText (API reference), Vercel · read 28 Sept 2026
- docsChatbot, Vercel · read 28 Sept 2026