Skip to main content

Vercel AI SDK

TypeScript AI SDK for React and Node — streaming, tool use, and multi-provider LLM integration with 1M+ npm downloads/week

LLM FrameworksFree

The Vercel AI SDK is an open-source TypeScript toolkit for building AI-powered applications with React, Next.js, and Node.js. It provides a unified API across 20+ LLM providers (OpenAI, Anthropic, Google, Mistral, Groq, and more), React hooks for streaming chat UIs (`useChat`, `useCompletion`), server-side streaming helpers, and first-class support for tool use and structured outputs. The de-facto standard SDK for building AI features in TypeScript/React applications.

Key specs
1,000,000 npm weekly downloads source
as of 2026-03-27

What we know

PricingFreefrom our original listing, not yet re-checked

Why it matters

  • 1M+ npm downloads per week makes it the most widely used TypeScript AI SDK — extensive community resources, tutorials, and examples.
  • React hooks (useChat, useCompletion) eliminate the boilerplate of building streaming chat interfaces — 10 lines of code instead of 100.
  • Provider-agnostic unified API enables switching from GPT to Claude to Gemini without changing application logic — just swap the model string.
  • Full TypeScript types for all providers means autocomplete, type checking, and better developer experience than raw fetch calls.

Key capabilities

  • generateText/streamText: LLM text generation with streaming; works across all providers.
  • generateObject: Structured output with Zod schema validation — type-safe JSON from LLMs.
  • Tool use: Define and call tools with any supported model; automatic tool call loops.
  • useChat hook: React hook for building chat UIs; handles streaming, messages, input state.
  • useCompletion hook: React hook for text completion UIs with streaming.
  • Multi-provider: 20+ providers with a unified API interface.
  • Server Actions: Next.js 14+ Server Actions integration for streaming from React Server Components.
  • Image generation: DALL-E, Stability AI image generation via the same SDK.
  • Embeddings: Create vector embeddings for RAG.

Technical notes

  • Package: npm install ai
  • License: MIT
  • GitHub: github.com/vercel/ai
  • Stars: 28K+
  • Weekly downloads: 1M+ (npmjs.com/package/ai)
  • Providers: OpenAI, Anthropic, Google, Groq, Mistral, Together, Fireworks, 15+ more
  • Runtimes: Next.js, React, Vue, Svelte, Node.js, Deno, Bun, Edge

Usage example

// Streaming chat with React hook
import { useChat } from 'ai/react';

export function ChatComponent() {
  const { messages, input, handleInputChange, handleSubmit } = useChat();

  return (
    <div>
      {messages.map(m => <div key={m.id}>{m.content}</div>)}
      <form onSubmit={handleSubmit}>
        <input value={input} onChange={handleInputChange} />
        <button type="submit">Send</button>
      </form>
    </div>
  );
}

// Server-side streaming with tool use
import { streamText, tool } from 'ai';
import { openai } from '@ai-sdk/openai';
import { z } from 'zod';

const result = streamText({
  model: openai('gpt-4o'),
  tools: {
    getWeather: tool({
      description: 'Get the weather for a location',
      parameters: z.object({ location: z.string() }),
      execute: async ({ location }) => getWeatherData(location)
    })
  },
  prompt: 'What is the weather in Tokyo?'
});

Ideal for

  • TypeScript/React developers building AI-powered web apps who want streaming chat UIs with minimal boilerplate.
  • Next.js teams who want native Server Actions integration for streaming AI responses.
  • Teams building multi-provider AI applications who want to switch between GPT, Claude, and Gemini without code changes.

Not ideal for

  • Python developers — Vercel AI SDK is TypeScript/JavaScript only; use LangChain, LlamaIndex, or provider SDKs.
  • Complex agent pipelines with many tools and orchestration — LangChain has more agent primitives and integrations.
  • RAG applications requiring extensive retrieval tooling — LlamaIndex has more retrieval-focused features.

See also

FAQ

What is the Vercel AI SDK?

The Vercel AI SDK (package name `ai`) is a TypeScript library for building AI applications. Key components: AI SDK Core (model calls with streaming, tool use, structured output, image generation — provider-agnostic), AI SDK UI (React hooks like `useChat` and `useCompletion` for building streaming chat interfaces), AI SDK RSC (React Server Components and Server Actions integration). Works with Next.js, React, Vue, Svelte, Node.js, and Deno.

Is the Vercel AI SDK free?

The SDK itself is MIT-licensed and free. You pay for the LLM providers you connect to (OpenAI API, Anthropic API, etc.). There's no Vercel subscription required to use the SDK — it works with any deployment target (Vercel, AWS, Railway, self-hosted). The `ai` npm package is completely independent of Vercel's hosting platform.

Which AI providers does it support?

The Vercel AI SDK supports 20+ providers: OpenAI, Anthropic, Google Gemini, Meta Llama, Mistral, Groq, Together AI, Fireworks AI, Perplexity, Cohere, Replicate, AWS Bedrock, Azure OpenAI, and more. The unified `generateText`, `streamText`, and `generateObject` APIs work identically across all providers — switch providers by changing the model parameter.

How does the AI SDK compare to LangChain?

Vercel AI SDK is focused on TypeScript/JavaScript with excellent streaming and React integration — lighter, type-safe, and easier to learn. LangChain supports Python and JS with a much larger ecosystem of integrations, agents, and tools. For Next.js and React apps needing streaming chat UIs, the Vercel AI SDK is the clearer choice. For Python-first RAG pipelines with complex chains, LangChain/LlamaIndex are stronger. Many TypeScript teams use Vercel AI SDK + their own retrieval rather than LangChain JS.

Alternatives

Is your tool an alternative to Vercel AI SDK? Sponsor this spot for 30 days, marked Sponsored.

Integrations

None listed.

Built on

Good for these tasks

For the team behind Vercel AI SDK

Growth plan: from $399 a month

SEO, AI search (how ChatGPT, Perplexity and Google describe Vercel AI SDK), UX, CRO and support from one account manager, with a monthly report. Includes a Featured launch on db.fyi. Starts with a free audit.

Founding offer: $299 a month for your first 3 months, plus a free case study.

Get a free audit

Listed 2026-02-22 · updated 2026-11-12