
AI SDK
The layer most TypeScript AI apps sit on: one call shape across twenty-odd model providers
What is AI SDK?
Four functions carry most of the work — generateText and streamText for prose, generateObject and streamObject for data shaped by a schema — and they keep the same signature whether the model behind them is OpenAI, Anthropic, Google, Bedrock or a local one. A second half supplies framework hooks so a streaming chat UI is a few lines rather than a hand-rolled parser. It is a model-access and UI layer, not an agent runtime: persistent memory, retrieval and durable orchestration are somebody else's job.
What can you do with AI SDK?
- Call any provider the same way — generateText and streamText take a model object and a prompt. Swapping OpenAI for Anthropic, Google, xAI, Azure, Bedrock, Groq, Mistral or DeepSeek changes that one object and nothing else in the call.
- Ask for data instead of prose — generateObject and streamObject take a schema and return a value that matches it, so extracting fields from a document or filling a form does not need a parser or a retry loop around malformed output.
- Give the model tools — The tool helper pairs a description with a schema and an execute function, and the SDK runs the resulting calls in a loop whose stopping condition you control rather than leaving the loop implicit.
- Stream into a UI without writing the plumbing — Framework-agnostic hooks cover React and Next.js, Vue and Nuxt, Svelte and SvelteKit, Expo and TanStack Start, handling the message list, the in-flight state and the token stream.
- Run an established agent harness through one API — A separate surface exposes existing agent harnesses behind a uniform interface, so a coding-agent style loop can be driven from the same codebase as the plain model calls.
Before you choose AI SDK
- This is the layer that talks to models, not the layer that runs agents; long-term memory, retrieval and durable multi-step execution have to come from elsewhere in the stack.
Star history
21 Aug to 28 Aug · +136
Frequently asked questions
Is AI SDK free for commercial use?
AI SDK is released under the Apache-2.0 licence — OSI-approved open source, which permits commercial use.
How can AI SDK be deployed?
AI SDK is available as Self-hosted / Runs locally.
Documentation
Reproduced from the vercel/ai README, published under UNKNOWN — read the LICENSE file. Read the original ↗
packages/ai/README.md