Vercel AI SDK
TypeScript toolkit for building AI-powered apps and agents: streaming UI, structured outputs, tool calls, multi-step agents.
Vercel AI SDK
The Vercel AI SDK is the TypeScript/JavaScript standard library for integrating LLMs into web applications and agents. It provides a unified API across 20+ model providers with first-class support for streaming React Server Components, structured output, tool use, and multi-step agentic loops.
Key Features
- Provider-agnostic — OpenAI, Anthropic, Google, Mistral, Groq, Ollama, and 15+ more via
@ai-sdk/*packages generateText/streamText— core primitives for single-turn and streaming generationgenerateObject/streamObject— Zod-schema-typed structured outputs with streaming partial updates- Tool use & agents — define tools with Zod schemas;
maxStepsenables multi-step agentic loops - React hooks —
useChat,useCompletion,useObjectfor real-time streaming UI - MCP client — built-in MCP client connects agents to any MCP server as tools
Quick Start
npm install ai @ai-sdk/openai zod
import { generateObject } from 'ai';
import { openai } from '@ai-sdk/openai';
import { z } from 'zod';
const { object } = await generateObject({
model: openai('gpt-4o-mini'),
schema: z.object({
recipe: z.object({
name: z.string(),
ingredients: z.array(z.string()),
}),
}),
prompt: 'Generate a simple pasta recipe.',
});
console.log(object.recipe);
Install via ai-supply
npx ai-supply add vercel-ai-sdk
Curated mirror of the open-source Vercel AI SDK project (Apache-2.0). Install upstream from the repository.
Compromise signals — malicious or tampered code (leaked secrets, backdoors, a dropped executable) — reduce the score, and known dependency CVEs carry a bounded penalty (they warrant review but never QUARANTINE — update the dependency to clear). Other dangerous-by-capability traits are risk surface, expected for some capabilities. Every finding is mapped to its OWASP control below.
Findings mapped to the OWASP Top 10 for LLM Applications (2025) and the OWASP Machine Learning Security Top 10. Expand any flagged control for the exact findings — compromise reduces the score; expected/risk-surface do not, except a known CVE, which carries a small bounded penalty (high/critical → Review).
The same gate an agent runs before installing (POST /api/v1/trust/vercel-ai-sdk/check). Click a policy:
Consume Vercel AI SDK programmatically. Authenticate with an API key or session — see Authorize an agent.
# Agents: CHECK BEFORE YOU INSTALL (no auth) — score, grade, level, capability manifest
curl https://ai-supply.store/api/v1/trust/vercel-ai-sdk
# Gate against your org policy (returns { pass, violations })
curl -X POST https://ai-supply.store/api/v1/trust/vercel-ai-sdk/check \
-H "Content-Type: application/json" \
-d '{"minGrade":"B","denyPermissions":["shell"],"denyUnknownEgress":true}'
# CLI
npx ai-supply add vercel-ai-sdk
# REST (install → download)
curl -X POST https://ai-supply.store/api/v1/listings/vercel-ai-sdk/install \
-H "Authorization: Bearer $AIM_KEY"
# MCP tool
install_listing({ "slug": "vercel-ai-sdk" })OpenAPI spec →Curated mirror — latest upstream source. See the repository for tagged releases.