Vercel AI SDK 4.0 — Unified API Across All Major LLMs
Vercel released AI SDK 4.0 with a unified API that works identically across Claude, GPT-4o, Gemini, Mistral, and Llama. Includes streaming, tool use, and structured output.
Write your AI integration once and swap models without changing code. The useChat and useCompletion hooks work across Next.js, SvelteKit, and plain React.
Install @ai-sdk/anthropic or other provider packages alongside the core ai package. The generateText and streamText functions work identically across all providers.
AI SDK 4.0 is the most practical abstraction for indie builders who want model flexibility. Switching from Claude to GPT-4o or Gemini is a one-line change. The structured output and tool use APIs are also unified, making it easy to build provider-agnostic AI features.