Vercel AI SDK
frameworkThe Vercel AI SDK is the standard TypeScript/JavaScript library for building AI-powered web applications — handling streaming, tool use, multi-step agents, and React Server Components integration out of the box.
Buy vs Build
Purely buy (in the sense that you use Vercel's open-source library) — but it's free and open-source; there's no pricing. Pairs well with Vercel's hosting platform but works on any Node.js or edge runtime.
Why It's in Trial
The Vercel AI SDK has become the de facto standard for web developers building AI features into Next.js applications. It removes significant boilerplate:
Without the SDK:
// 40+ lines of streaming, error handling, message formatting boilerplate
const response = await fetch('/api/chat', { ... })
const reader = response.body?.getReader()
while (true) {
const { done, value } = await reader.read()
// manual chunk parsing, state management...
}
With the SDK:
import { useChat } from 'ai/react'
const { messages, input, handleInputChange, handleSubmit } = useChat()
// That's it. Streaming, state, and error handling included.
Key Features
useChatanduseCompletionhooks: React hooks for streaming chat and text generation — handle streaming, message state, and optimistic updatesstreamText/generateText: Server-side primitives for streaming responses with any supported model- Tool use: Define tools as TypeScript functions; the SDK handles the tool-call loop (model calls tool → tool runs → result fed back to model → repeat)
- Multi-step agents: Run agent loops that call tools, reason, and continue until the task is complete
- Model-agnostic: Works with OpenAI, Anthropic, Google, Mistral, Cohere, AWS Bedrock, Azure, and local models via Ollama — switching providers is one line
- Structured output: Generate type-safe structured data with Zod schema validation
August 2026: Harness Interoperability
Vercel released @ai-sdk/harness-acp 1.0.0, a meta-adapter that connects the AI SDK harness APIs to any Agent Client Protocol-compatible harness. This is a small package release, not evidence that ACP is universally implemented, but it makes the SDK a concrete interoperability layer rather than only a provider abstraction: a TypeScript application can target one harness interface and reach multiple ACP-speaking coding agents. (@ai-sdk/harness-acp 1.0.0)
The contemporaneous ai 7.0.58 patch also makes ToolLoopAgent honor timeouts configured in agent settings. That is operationally important for bounded execution because a timeout policy now survives the abstraction instead of being silently ignored. (ai 7.0.58)
@ai-sdk/harness-acp 1.0.2 adds per-harness MCP server configuration and an optional mintBridgeToken(sandboxId) hook. Those are small APIs with important trust consequences: applications can scope tools and bridge credentials to one harness/sandbox instead of relying on a shared global configuration. Treat token minting as a privileged control-plane operation and test that a resumed or replaced sandbox cannot reuse another sandbox's bridge token. Vercel's implementation guide also makes the abstraction boundary explicit: map executable provenance, forwarded environment variables, authentication, and permission modes in createACP, and prefer a direct adapter where ACP does not expose the runtime's full behavior. (@ai-sdk/harness-acp 1.0.2, ACP harness guide)
The next harness patch adds request transformations to the network-sandbox abstraction and uses them for credential brokering, while the MCP client derives OAuth scopes from WWW-Authenticate challenges or Protected Resource Metadata. Open Responses history replay now preserves output ordering, annotations, reasoning state, and reasoning-part identities instead of silently flattening or dropping provider-defined behavior. These are narrow packages but one shared practice: authorization and replay semantics must survive the adapter layer, not merely exist in the underlying runtime. (harness 1.0.72, MCP 2.0.32, Open Responses 2.0.28)
Model-Agnostic Design
import { generateText } from 'ai'
import { anthropic } from '@ai-sdk/anthropic'
import { openai } from '@ai-sdk/openai'
// Swap providers by changing one line
const { text } = await generateText({
model: anthropic('claude-sonnet-4-6'), // or openai('gpt-4o')
prompt: 'Summarise this PR description',
})
Who Uses It
Companies building AI-powered products on the web — from Vercel's own v0 to startups building chat interfaces, code generation tools, and document processing pipelines. It's widely used at companies where the frontend team is TypeScript-first.
Key Characteristics
| Property | Value |
|---|---|
| Language | TypeScript / JavaScript |
| License | Apache 2.0 |
| Underlying model | OpenAI, Anthropic, Google, Mistral, AWS, Azure, Ollama |
| Framework support | Next.js, SvelteKit, Nuxt, Express, Hono, and more |
| Provider | Vercel (open source) |
| Website | sdk.vercel.ai |
| GitHub | vercel/ai |