Vercel AI SDK
An open-source TypeScript toolkit for building AI apps — unified model API, streaming, structured output, tool calling, and UI hooks.
The Vercel AI SDK is the de facto TypeScript toolkit for AI apps: one provider-agnostic API for text, structured objects, and tool calls, first-class streaming, and framework UI hooks (React, Svelte, Vue) for building chat and generative interfaces fast.
The Vercel AI SDK is an open-source TypeScript toolkit for building AI-powered applications. It gives you one provider-agnostic API for the things every LLM app needs — generating text, generating structured objects, tool calling, and streaming — plus framework hooks for wiring those into a UI. It has become the default way to build AI features in the TypeScript/JavaScript ecosystem.
It is aimed at full-stack and frontend developers who want to ship chat and generative-UI features without gluing together a provider SDK, a streaming layer, and a state library by hand. Swap models with a one-line change, and stream tokens or structured data to the browser with first-class primitives.
Highlights
- Unified model API —
generateText,streamText,generateObject, and tool calling across many providers; change models via config. - Streaming-first — stream tokens and structured output to the client with backpressure handled.
- Structured output —
generateObject/streamObjectwith schema validation (Zod and friends). - UI hooks — React, Svelte, and Vue hooks (
useChat,useCompletion) for chat and generative interfaces. - Tool calling & agents — define tools the model can call, with multi-step loops.
In an AI-assisted workflow
import { streamText } from "ai";
const result = streamText({ model: "anthropic/claude", prompt });
return result.toUIMessageStreamResponse(); // stream straight to the browserTIP
The AI SDK overlaps with both structured-output libraries and gateways: it does typed output like Instructor and provider-switching like a gateway. Pair it with OpenRouter or LiteLLM when you want centralized routing/cost control behind it.
Good to know
The Vercel AI SDK is open source (Apache-2.0) and free; you pay your model provider for tokens. It's TypeScript-first — the natural choice in JS/TS apps, less so for Python backends (where Instructor/BAML fit better). It's framework-agnostic despite the Vercel name and runs anywhere Node/edge runs.
Related
- LiteLLMCall 100+ LLM APIs with one OpenAI-format interface — as a Python library or a self-hosted gateway/proxy.
- OpenRouterA hosted unified API to hundreds of models from many providers, with one key, one bill, and automatic fallbacks.
- Structured Output vs JSON Mode vs Function Calling: Which to Use in 2026The reliable ways to get typed data out of an LLM — what JSON mode, function calling, and native structured outputs each guarantee, and when to use which.
- Calling Any Model: Unified LLM Gateways & SDKs in 2026Why teams put a unified layer in front of LLM providers — and how LiteLLM, OpenRouter, and the Vercel AI SDK compare for fallback and cost control.
- Add a Streaming LLM EndpointScaffold a token-streaming LLM endpoint — server-side streaming plus the client handler — so responses render incrementally instead of after a long wait.
- InstructorGet structured, validated output from LLMs using plain type definitions, with automatic retries on validation failure.