1. Project Overview
The AI SDK (vercel/ai) is a provider-agnostic TypeScript toolkit, created by Vercel and the Next.js team, for building AI-powered applications and agents โ giving developers a single unified API to generate text, structured data, and agentic workflows across dozens of model providers and UI frameworks.
2. Background & Positioning
The AI SDK was created to solve a recurring pain point in AI application development: every model provider (OpenAI, Anthropic, Google, and dozens more) ships its own SDK, request format, and streaming protocol, forcing developers to rewrite integration code every time they switch models or add a fallback provider. The AI SDK's core mission is to abstract that variance behind one consistent interface โ generateText, streamText, generateObject, and agent primitives all work the same way regardless of which model is behind them.
Compared to similar projects, the AI SDK differentiates itself by:
- Being framework-agnostic on the client (Next.js, React, Svelte, Vue, Angular) while remaining runtime-agnostic on the server (Node.js, edge runtimes, serverless functions).
- Shipping a built-in gateway (Vercel AI Gateway) that gives access to 100+ models across 16+ providers via a single model string, with no separate provider package required to get started.
- Treating agents as a first-class concept (
ToolLoopAgent) rather than a thin wrapper around chat completions, with native support for tool calling, durable long-running workflows, and sandboxed code execution. - Maintaining a strict separation between Core (server/edge logic), UI (client hooks), and RSC (streaming React Server Components), so teams can adopt only the layers they need.
3. Feature Categories
-
๐ค Model Providers (40+ packages) โ Adapters connecting the unified API to specific LLM vendors and inference platforms.
@ai-sdk/openai,@ai-sdk/anthropic,@ai-sdk/googleโ the three most widely used providers.@ai-sdk/xai,@ai-sdk/mistral,@ai-sdk/groq,@ai-sdk/cohereโ additional major hosted-model providers.@ai-sdk/amazon-bedrock,@ai-sdk/azure,@ai-sdk/google-vertexโ cloud-platform-native model access.@ai-sdk/openai-compatibleโ a generic adapter for any OpenAI-compatible inference endpoint (self-hosted or third-party).
-
๐๏ธ Speech & Audio (7 packages) โ Providers for transcription and voice generation.
@ai-sdk/deepgram,@ai-sdk/assemblyai,@ai-sdk/revai,@ai-sdk/gladiaโ speech-to-text transcription.@ai-sdk/elevenlabs,@ai-sdk/cartesia,@ai-sdk/lmnt,@ai-sdk/humeโ text-to-speech and voice synthesis.
-
๐จ Image & Video Generation (6 packages) โ Providers for visual media generation.
@ai-sdk/replicate,@ai-sdk/fal,@ai-sdk/black-forest-labsโ image generation and hosted model inference.@ai-sdk/luma,@ai-sdk/klingai,@ai-sdk/minimaxโ video and multimodal generation.
-
๐ผ๏ธ UI Framework Integrations (5 packages) โ Client-side hooks for building chat and generative interfaces.
@ai-sdk/react,@ai-sdk/vue,@ai-sdk/svelte,@ai-sdk/angularโ framework-specific chat/completion hooks.@ai-sdk/rscโ streaming React Server Components support for generative UI.
-
๐งฉ Agent Infrastructure (10+ packages) โ Building blocks for autonomous and durable agents.
ai(coreToolLoopAgent) โ the tool-calling agent loop at the heart of the SDK.@ai-sdk/mcpโ Model Context Protocol client/server support for tool interoperability.@ai-sdk/workflow,@ai-sdk/workflow-harnessโ durable, long-running agent workflows.@ai-sdk/sandbox-vercel,@ai-sdk/sandbox-just-bashโ sandboxed code execution environments for agents.@ai-sdk/harness-claude-code,@ai-sdk/harness-codex,@ai-sdk/harness-opencodeโ integrations with popular coding-agent harnesses.
-
๐ ๏ธ Developer Tooling (6 packages) โ Supporting infrastructure for building and operating AI SDK apps.
@ai-sdk/gatewayโ unified routing to the Vercel AI Gateway.@ai-sdk/otelโ OpenTelemetry instrumentation for observability.@ai-sdk/devtools,@ai-sdk/tuiโ debugging and terminal UI utilities.@ai-sdk/provider,@ai-sdk/provider-utilsโ the low-level contracts new provider packages implement against.
4. Key Highlights
- Unified model API โ Swap between OpenAI, Anthropic, Google, and 100+ other models by changing a single string, with no rewrite of application logic.
- Vercel AI Gateway by default โ Out-of-the-box access to major providers without installing separate provider SDKs, plus centralized rate limiting and fallback routing.
ToolLoopAgentprimitive โ A first-class agent abstraction with reasoning control, tool calling, and runtime context, rather than a manual chat-completion loop.- Structured output generation โ
generateObject/Output.objectproduce schema-validated JSON via Zod (or Valibot), eliminating brittle prompt-based JSON parsing. - Durable Workflows and Sandbox โ Long-running agent workflows that survive restarts, paired with sandboxed execution environments for agents that need to run code safely.
- Framework-agnostic streaming UI โ The same streaming chat/generative-UI hooks work across Next.js, React, Svelte, Vue, and Angular.
5. Use Cases by Role
- General developers โ Build chatbots, copilots, and generative UI features in Next.js/React/Vue/Svelte apps using a consistent API regardless of the underlying model.
- DevOps/SRE โ Use
@ai-sdk/otelfor observability and the Vercel AI Gateway for centralized rate limiting, fallback, and cost tracking across model providers. - Data/research scientists โ Prototype structured-data extraction and multi-step reasoning pipelines with
generateObjectandToolLoopAgentwithout hand-rolling provider-specific request formats. - Project managers โ Evaluate the project's maturity via its large contributor base, weekly download volume, and active release cadence (AI SDK 6/7) as a signal of long-term maintenance.
6. Getting Started
Find what you need โ browse the provider directory and API reference to identify the provider package or primitive (generateText, streamText, ToolLoopAgent) that matches your use case.
Install and integrate
npm install ai
npm install @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google
import { generateText } from 'ai';
const { text } = await generateText({
model: 'openai/gpt-5.4', // routed through the Vercel AI Gateway
prompt: 'What is an agent?',
});
Coding-agent users can also add the AI SDK skill directly to a repository with npx skills add vercel/ai.
Contribute โ read CONTRIBUTING.md; the project now prioritizes high-quality issues (clear reproductions, failing tests) over unsolicited large pull requests, so check the issue tracker before starting substantial work.
7. Project Structure
ai/
โโโ packages/ # All published packages (core, providers, UI, agents)
โ โโโ ai/ # Core SDK: generateText, streamText, ToolLoopAgent
โ โโโ openai/ anthropic/ google/ ... # Model provider adapters
โ โโโ react/ vue/ svelte/ angular/ rsc/ # UI framework integrations
โ โโโ mcp/ workflow/ sandbox-vercel/ # Agent infrastructure
โ โโโ provider/ provider-utils/ # Contracts for building new providers
โโโ apps/
โ โโโ docs/ # ai-sdk.dev documentation site
โโโ content/ # Documentation source content
โโโ examples/ # Runnable example applications
โโโ skills/ # Coding-agent skill definitions
โโโ tools/ # Internal build/dev utilities
โโโ CONTRIBUTING.md
Each folder under packages/ is an independently versioned npm package; provider packages implement the shared contract defined in packages/provider so they plug into the same generateText/streamText API.
8. Related Ecosystem
- Next.js โ the framework the AI SDK is built alongside and most commonly deployed with.
- Vercel AI Gateway โ the default routing layer giving access to 100+ models without per-provider setup.
- Vercel Sandbox โ the secure execution environment used by
@ai-sdk/sandbox-vercelfor agent code execution. - Zod / Valibot โ schema validation libraries used for structured output generation.
- Model Context Protocol (MCP) โ the open protocol
@ai-sdk/mcpimplements for tool interoperability across agent ecosystems. - LangChain / LlamaIndex โ supported as optional orchestration layers via dedicated adapter packages.
9. License
The project is distributed under the Apache License 2.0.
- โ Free to use, modify, and distribute, including in commercial and closed-source products.
- โ Includes an explicit patent grant from contributors.
- โ Comes with no warranty; contributors are not liable for damages arising from its use.
- โน๏ธ Modified files must carry a notice stating changes were made, and the license/copyright notice must be preserved in distributions.
10. FAQ
Q: Do I need a separate API key for every model provider?
A: No โ by default the AI SDK routes requests through the Vercel AI Gateway using a single model string (e.g. 'anthropic/claude-opus-4.6'), though you can also install a specific provider package like @ai-sdk/anthropic to connect directly.
Q: Can I get structured, schema-validated output instead of raw text?
A: Yes โ use generateText with Output.object (or generateObject) and a Zod schema to get typed, validated JSON back from the model.
Q: Which frontend frameworks does the AI SDK support?
A: Next.js, React, Svelte, Vue, and Angular all have dedicated UI hook packages, and the core streaming primitives are framework-agnostic.
Q: How do I build an agent that can run code or use tools?
A: Use ToolLoopAgent from the core ai package, defining tools directly or via @ai-sdk/mcp for Model Context Protocol tool servers; pair it with @ai-sdk/sandbox-vercel for sandboxed code execution.
Q: What's the best way to contribute?
A: Check CONTRIBUTING.md first โ the maintainers currently prioritize clear bug reports, minimal reproductions, and failing tests over unsolicited full-implementation pull requests.
11. Quick Links
- Repository: https://github.com/vercel/ai
- Official docs: https://ai-sdk.dev/docs
- Contributing guide: https://github.com/vercel/ai/blob/main/CONTRIBUTING.md
- Community: https://vercel.community
12. Summary
The AI SDK gives TypeScript developers one consistent way to call any major LLM, generate structured data, and build tool-using agents โ backed by a large provider ecosystem, native framework integrations, and Vercel's gateway/sandbox infrastructure. It is best suited for teams building production AI features who want to avoid vendor lock-in, swap models with a one-line change, and scale from a simple chatbot to durable, sandboxed agent workflows without switching toolkits.