Debuly
AI SDK logo

AI SDK

Free open-source TypeScript toolkit for building AI-powered apps and agents with one API across OpenAI, Anthropic, Google and more.

Open source

What is AI SDK?

The AI SDK is a provider-agnostic TypeScript library for building AI applications and agents, created by the team behind Next.js. You install it from npm with Node.js 22 or newer and call a small set of functions, such as generateText for text, structured output with Zod schemas, and a ToolLoopAgent class for agents that use tools. A unified provider layer lets you switch between OpenAI, Anthropic, Google and other model providers by changing a model string, and by default requests go through the Vercel AI Gateway, which offers one key for hundreds of models with no markup on token prices. UI hooks work with React, Next.js, Svelte, Vue and Angular, so you can stream chat and generative interfaces to the browser. You can also install provider packages such as @ai-sdk/openai to connect directly. The library is free and open source, and a skill is available for coding agents like Claude Code and Cursor.

Use cases

  • Build a streaming chatbot in Next.js
  • Generate structured data from an LLM
  • Create tool-using AI agents
  • Switch between model providers in code
  • Add generative UI to a React app
  • Route model calls through an AI gateway

Who it's for

  • TypeScript developers
  • Full-stack engineers
  • AI startups
  • Agent builders

Why use AI SDK

  • One code structure works across providers, so changing models means changing a string rather than rewriting calls.
  • The library is free and open source, so you only pay for the model usage you consume.
  • UI hooks for several frameworks handle streaming chat and generative interfaces.
  • The AI Gateway option gives one key for many models with no markup on token prices and spend monitoring.
  • Structured output with Zod schemas helps you get typed data back from a model.

AI SDK features

  • Unified API for text generation across model providers
  • Structured output with Zod schemas
  • ToolLoopAgent for tool-calling agents
  • UI hooks for React, Svelte, Vue and Angular
  • Vercel AI Gateway access with a single key
  • Direct provider packages such as @ai-sdk/openai and @ai-sdk/anthropic
  • Streaming responses for chat interfaces
  • Custom provider support
  • Skill for coding agents such as Claude Code and Cursor

AI SDK integrations

  • OpenAI
  • Anthropic
  • Google
  • Vercel AI Gateway
  • Next.js
  • React
  • Svelte
  • Vue
  • Angular
  • Vercel Sandbox
  • Claude Code
  • Cursor

How to get started with AI SDK

  1. Install the library with npm install ai on a machine running Node.js 22 or newer.
  2. Pass a model string such as a provider and model name, or install a provider package to connect to a provider directly.
  3. Call functions like generateText or the ToolLoopAgent class, with tools and a schema if you need structured output.
  4. Add the UI package for your framework, such as @ai-sdk/react, and stream results into your interface.

AI SDK limitations

  • Requires Node.js 22 or newer
  • Model usage is billed by the provider or gateway you choose, not by the library
  • Some providers need their own plan, for example the v0 API requires a Premium or Team plan with usage billing

AI SDK pricing

AI SDK is open source, so you can use and self-host it for free.

Prices can change and may vary by country or exclude tax. Check the official pricing page.

AI SDK alternatives

The main AI SDK alternatives listed on Debuly are LangChain, LlamaIndex, Mastra, LiteLLM, OpenAI Agents SDK and OmniRoute. The table compares pricing and platforms; order is A–Z.

AI SDK compared with its alternatives
ToolPricingStarting pricePlatforms
AI SDKOpen source—Node.js, npm, Self-hosted
LangChainFreemium$39/moWeb, API, Self-hosted
LiteLLMOpen source—Python, API, Self-hosted, CLI
LlamaIndexFreemium$50/moWeb, API, Self-hosted
MastraOpen source$250/moWeb, CLI, API, Self-hosted
OmniRouteOpen source—CLI, Web, API, Self-hosted
OpenAI Agents SDKOpen source—Python, macOS, Linux, Windows
  1. LangChain

    Open-source framework for building LLM agents, paired with LangSmith for tracing, evals and agent deployment.

  2. LiteLLM

    Open-source AI gateway and Python SDK that gives one OpenAI-format API to 100+ LLM providers, with keys, budgets and cost tracking.

  3. LlamaIndex

    Open-source framework plus the LlamaParse platform for parsing, extracting and indexing documents so LLM apps can use them.

  4. Mastra

    Open source TypeScript framework for building AI agents and workflows, plus a hosted platform for Studio, Server, memory and observability.

  5. OmniRoute

    Free open-source AI gateway that puts 352 providers behind one OpenAI-compatible endpoint with automatic fallback.

  6. OpenAI Agents SDK

    Open-source Python framework for building multi-agent workflows with tools, handoffs, guardrails, tracing, sandboxes and voice agents.

AI SDK FAQ

What is the AI SDK?

The AI SDK is a provider-agnostic TypeScript toolkit for building AI-powered applications and agents with frameworks like Next.js, React, Svelte, Vue and Angular, and runtimes like Node.js.

Is the AI SDK free and open source?

Yes. The vercel/ai repository describes it as a free open-source library. You pay only for the models you call through a provider or the AI Gateway.

How much does the AI SDK cost?

The library itself costs nothing. AI Gateway passes through provider token prices with zero markup, including when you bring your own key.

Which model providers does the AI SDK support?

It supports OpenAI, Anthropic, Google and other providers, either through the Vercel AI Gateway or through provider packages such as @ai-sdk/openai, @ai-sdk/anthropic and @ai-sdk/google.

Does the AI SDK support agents?

Yes. It includes a ToolLoopAgent class for agents that call tools, plus helpers to stream agent responses into a Next.js route and UI.

What do I need to install the AI SDK?

Node.js 22 or newer and a package manager. Install the core package with npm install ai, and add framework or provider packages as needed.

What are alternatives to the AI SDK?

Alternatives include LangChain, LlamaIndex, Mastra, OpenAI's own SDK and LiteLLM. Compare language support, provider coverage and UI integration.

Sources & verification

Facts on this page come from the official sources below, each with the date we read it. Written by Debuly; the vendor did not review this page.

SourceTypeAccessed
ai-sdk.dev/official
ai-sdk.dev/model-libraryofficial
ai-sdk.dev/repoofficial
ai-sdk.dev/providers/ai-sdk-providers/vercelofficial
ai-sdk.dev/providers/ai-sdk-providers/ai-gatewayofficial

Image credits

  • Logo: from ai-sdk.dev · fetched · Vendor trademark, used only to identify the product; removed on request
  • Cover: none collected yet, so a generated tile is shown.

Spot an error? Report an issue with this listing. We also remove a logo or image on the owner's request.