Vercel AI SDK

Vercel AI SDK

Open-source TypeScript toolkit for building streaming AI chat interfaces, structured outputs, and multi-step tool-calling agents.

★ 28.4K

Switch between OpenAI, Anthropic, Gemini, and local models with one TypeScript API

Hardcoding vendor-specific streaming parsers and function-calling payloads into your web backend means rewriting half your AI layer whenever a faster or cheaper model launches. Vercel AI SDK unifies text generation, streaming UI hooks, Zod-validated structured outputs, and multi-step agent loops behind one clean TypeScript interface. Carrying 28.4K GitHub stars and 5,800 forks under the Apache-2.0 license, it works across Next.js, SvelteKit, Nuxt, Astro, Hono, and standalone Node.js servers.

Why TypeScript AI teams build on the AI SDK

  • Unified provider adapters let you swap between OpenAI, Anthropic, Google Gemini, Groq, Bedrock, and Ollama by changing a single model line.
  • `generateObject` and `streamObject` enforce strict Zod schemas at runtime so your frontend receives typed JSON instead of broken markdown blocks.
  • Built-in frontend hooks (`useChat`, `useCompletion`, `useObject`) wire up token streaming, tool-call progress states, and abort buttons in minutes.
  • First-class OpenTelemetry hooks export every generation and tool span straight into Langfuse, PostHog, or your own collector.

What to keep in mind

For long-running durable background agent workflows that sleep for hours or survive server restarts, pair the AI SDK with a workflow engine like LangGraph, Temporal, or Mastra. Install `ai` and `@ai-sdk/openai` or `@ai-sdk/google` today to stream your first typed AI response in under ten lines of code.

Ready to try Vercel AI SDK?

Experience the full capabilities on their official website.

Visit Official Website