Vercel AI SDK

Product · Developer tool by Vercel

The AI layer for building frameworks and agents on Vercel.

A unified TypeScript toolkit for building AI applications and agents with streaming, tool calling, and structured outputs. It allows developers to switch between 400+ models with one line of code and integrates natively with Vercel's AI infrastructure.

Price
From 0 USD
Languages
TypeScript

Category: Developer Tools

Platforms
Web, API
Programming languages
TypeScript, JavaScript, Node.js
Deployment
Cloud (Vercel), Edge Network
Language Support
TypeScript, JavaScript
Runtime Support
Node.js, Edge Runtime
Supported Frameworks
React, Next.js, Vue, Svelte
  • Unified API for 400+ AI models
  • Streaming-first TypeScript toolkit
  • Type-safe JSON with Zod schema support
  • Native integration with Vercel AI Gateway and Sandbox

Overview

Vercel AI SDK is an open-source TypeScript toolkit designed for developers to build AI-powered applications and agents. It provides a unified API that allows businesses to interact with over 400 models from providers like OpenAI, Anthropic, and Google with minimal code changes. The SDK is built for performance, supporting real-time streaming of text and generative UI across frameworks like React, Next.js, Vue, and Svelte. It integrates natively with the Vercel platform, enabling secure code execution in Sandboxes and durable execution through Vercel Workflows. By abstracting provider-specific complexities, the AI SDK simplifies the creation of structured outputs and complex tool-calling agents.

Core Development Features

  • Unified Provider API: The SDK provides a unified TypeScript API to call any large language model, allowing developers to switch providers by changing only two lines of code.
  • Structured Outputs: Developers can generate type-safe JSON data that conforms to a specific Zod schema using the generateObject and streamObject functions.
  • Tool Calling: The toolkit includes built-in support for tool calling, enabling models to interact with external systems and execute typed tools safely.
  • Streaming UI: The SDK is designed for streaming first, delivering real-time text, objects, and generative UI to the frontend without custom parsing.
  • AI SDK UI Hooks: The library includes a set of framework-agnostic hooks for quickly building chat interfaces and generative user experiences.

Platform Ecosystem Integration

  • AI Gateway Compatibility: The SDK is fully compatible with Vercel AI Gateway, allowing routing to 400+ models through a single endpoint with unified billing.
  • Sandbox Integration: Developers can run agent-generated code securely in isolated microVMs by integrating with Vercel Sandbox.
  • Durable Workflows: The SDK works with Vercel Workflows to build long-running AI agents that can suspend, resume, and survive function timeouts.
  • Vercel Connect Integration: The toolkit integrates with Vercel Connect to access over 1,000 integrations like Slack, Snowflake, and Notion using scoped tokens.

Frameworks and Templates

  • Framework Agnostic Support: The SDK supports React, Next.js, Vue, Svelte, and Node.js for building AI-native applications.
  • Starter Templates: Pre-built templates are available for common use cases including full-featured chatbots, Slackbot agents, and SQL agents.
  • AI Elements Library: The AI Elements library provides a UI component library and custom registry to accelerate the development of AI-native apps.

Use cases

  • Developers build multi-modal chat applications that stream real-time responses to users across different web frameworks.
  • Engineering teams create AI agents that use tool calling to interact with external databases and APIs securely.
  • Data teams extract structured JSON from unstructured text using Zod schemas for automated data classification.
  • Businesses deploy durable AI workflows that can survive function timeouts and resume progress automatically.

Specifications

Platforms
Web, API
Programming languages
TypeScript, JavaScript, Node.js
Integrations
OpenAI, Anthropic, Google Gemini, SpaceXAI Grok, Mistral, Meta Llama, Cohere, Vercel AI Gateway, Vercel Sandbox, Vercel Workflows, Vercel Connect
Deployment
Cloud (Vercel), Edge Network
Language Support
TypeScript, JavaScript
Runtime Support
Node.js, Edge Runtime
Supported Frameworks
React, Next.js, Vue, Svelte
Model Modalities
Text, Image, Speech, Transcription, Video
Schema Validation
Zod
Integration Count
1,000+ via Vercel Connect
Model Access
400+ via AI Gateway

How it works

  1. Install the SDK: Install the core library using npm i ai to begin building AI-powered applications.
  2. Configure Model Providers: Choose from hundreds of models from providers like OpenAI or Anthropic, or route through Vercel AI Gateway for a single endpoint.
  3. Build AI Logic: Use functions like generateText or generateObject to call models, and define tools for agents to interact with external systems.
  4. Deploy to Vercel: Deploy the application to Vercel to leverage managed infrastructure, global delivery, and observability.

Pricing

Open Source Library
Free

FAQ

What is the AI SDK?

The AI SDK is a unified TypeScript toolkit for building AI applications and agents with a single API for models, tools, structured output, and streaming.

Can I use the AI SDK without Vercel or AI Gateway?

Yes, the AI SDK is an open-source toolkit that can be used independently, though it is optimized for the Vercel platform and AI Gateway.

Which frameworks does the AI SDK support?

The AI SDK works with popular frontend frameworks including React, Next.js, Vue, and Svelte, as well as backend environments like Node.js.

How does the AI SDK handle structured data?

The SDK provides generateObject and streamObject functions that use Zod schemas to constrain model outputs to specific, type-safe JSON structures.

Read the docs

Added by AntSpace from public sources (vercel.com).

Related

More products by Vercel