AI SDK

Provider-agnostic TypeScript toolkit for building AI apps and agents with any LLM.

Library
npm
v7.0.68
26,280stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
92/100Excellent
Development Activity100
Maintenance100
Community76
Maturity52
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
91/100Excellent
Architecture92
Code Quality90
Innovation90
Learning Curve90

The AI SDK is Vercel’s open-source TypeScript toolkit for building AI-powered applications and agents. It provides a single, unified API for text generation, structured output, image/speech/video generation, embeddings, and reranking across dozens of model providers (OpenAI, Anthropic, Google, xAI, and more), so switching providers or models is a one-line change rather than a rewrite.

Beyond the core generation functions, the SDK ships framework-agnostic UI hooks (@ai-sdk/react, @ai-sdk/vue, @ai-sdk/svelte, @ai-sdk/angular) for building chat and generative interfaces, a ToolLoopAgent abstraction for building tool-using agents, and first-class support for streaming, tool calling, and the Model Context Protocol (MCP). It is maintained by the Next.js/Vercel team and used across a large ecosystem of provider and framework integration packages published under the @ai-sdk/* namespace.

What You Get

  • Unified generateText/streamText/generateObject APIs that work identically across OpenAI, Anthropic, Google, xAI, Groq, Mistral, and dozens of other providers
  • A ToolLoopAgent class for building tool-calling agents with structured tool definitions, approval flows, and streaming UI message output
  • Framework-agnostic UI hooks (@ai-sdk/react, @ai-sdk/vue, @ai-sdk/svelte, @ai-sdk/angular) for wiring chat and generative UI into any frontend
  • Built-in Model Context Protocol (MCP) client support for connecting agents to external tool servers
  • First-class Zod/Valibot schema integration for structured output and typed tool inputs/outputs
  • Access to the Vercel AI Gateway by default, or direct provider SDKs installed independently (@ai-sdk/openai, @ai-sdk/anthropic, etc.)

Common Use Cases

  • Building a chatbot or conversational UI with streaming responses in a Next.js, React, Vue, or Svelte app
  • Generating structured JSON output (e.g. extracting data, generating recipes/forms) validated against a Zod schema
  • Building tool-using agents that call external APIs, run code in a sandbox, or query internal systems
  • Swapping between LLM providers (OpenAI, Anthropic, Google) without rewriting application logic
  • Adding AI image, speech, or video generation to a product using a consistent API across providers

Under The Hood

Architecture: The repo is a pnpm/Turborepo monorepo with the ai core package (packages/ai/src) built around directory-scoped modules — generate-text, generate-object, generate-image, generate-speech, generate-video, embed, rerank, agent, middleware, registry, ui, ui-message-stream, realtime, and telemetry. Every generation function resolves a caller-supplied model string or instance through model/resolve-model.ts into a versioned LanguageModelV3/V4 (or embedding/image/speech/video equivalent) contract defined in the separate @ai-sdk/provider package, then normalizes provider-specific quirks via adapter functions like as-language-model-v4.ts. This adapter-and-versioned-contract layering is what lets generateText({ model: 'openai/gpt-5.4' }) and generateText({ model: anthropic('claude-opus-4-6') }) share identical downstream logic. The agent/tool-loop-agent.ts module builds a stateful tool-calling loop on top of generate-text, and ui-message-stream bridges that loop to framework hooks (@ai-sdk/react’s useChat) over a typed streaming protocol.

Tech Stack: Pure TypeScript (81% of the codebase) built with tsup, type-checked via tsc --build project references, and tested with Vitest across separate Node and edge-runtime configs (vitest.node.config.js / vitest.edge.config.js) to guarantee edge-runtime compatibility. The workspace uses pnpm workspaces plus Turborepo for task orchestration across ~80 packages, Changesets for versioned releases, and oxlint/ultracite for linting. Zod (with Valibot as an alternative) is a peer dependency used throughout for schema validation of structured output and tool I/O.

Code Quality: The ai package alone has 127 *.test.ts/*.test-d.ts files (colocated with source, including type-level tests via test-d.ts and snapshot tests), covering tool execution, streaming, schema resolution, and error paths explicitly — errors are modeled as typed classes under src/error/ rather than thrown generically. Naming is consistent (generate-*, stream-*, as-*-model-v*) and modules are small and single-purpose, which keeps the large surface area navigable despite the monorepo’s size.

API Design: The public API is deliberately minimal at the entry point — a handful of verbs (generateText, streamText, generateObject, embed, tool) cover the majority of use cases, with provider selection reduced to a model string or a one-line import { anthropic } from '@ai-sdk/anthropic'. Getting started requires only npm install ai plus one provider package; the README’s own quickstart is under 10 lines of code. Consistent naming conventions across sibling functions (generateImage/generateSpeech/generateVideo mirroring generateText) minimize the learning curve for anyone who has used one function in the family.

Used by 101 apps in this directory

TypeScript
99%
Other

Activepieces

Automation · AI Assistants

23,887

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
65
Dependency
Built with
TypeScript99%
Updated today
Python
99%
MIT

Agent Lightning

AI Development

17,500

A Microsoft-built training framework that optimizes AI agents with reinforcement learning, automatic prompt optimization, or supervised fine-tuning — with near-zero code changes to your existing agent, in any framework.

View details
84
Repo Health
68
Technical
69
Dependency
Built with
Python99%
Updated today
TypeScript
59%
Other

agenta

Developer Tools · Devops · AI Development

4,489

The open-source LLMOps platform unifying prompt engineering, evaluation, and observability for teams building reliable LLM applications.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
TypeScript59%
Python39%
Updated today
TypeScript
100%
Apache 2.0

agentic-inbox

AI Agents · Productivity

6,880

A self-hosted email client with an AI agent that reads your inbox, drafts replies automatically, and exposes full email operations over MCP — running entirely on Cloudflare Workers.

View details
32
Repo Health
74
Technical
77
Dependency
Built with
TypeScript100%
Updated 3 months ago
TypeScript
84%
MIT

Amical

Note Taking · AI Assistants

1,495

Local-first AI dictation that understands your active app — private, offline, and built for speed.

View details
79
Repo Health
82
Technical
67
Dependency
Built with
TypeScript84%
Updated 3 weeks ago
TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
Updated today
Python
68%
Other

AutoGPT

Automation · Productivity · AI Assistants

186,687

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
67
Dependency
Built with
Python68%
TypeScript31%
Updated today
TypeScript
92%
GPL 3.0

Blinko

Knowledge Management · Note Taking

10,880

A self-hosted, AI-powered card note-taking tool that lets you capture fleeting thoughts instantly and retrieve them with natural language search.

View details
83
Repo Health
69
Technical
65
Dependency
Built with
TypeScript92%
Updated 2 weeks ago
TypeScript
49%
AGPL 3.0

BrowserOS

Browser · AI Assistants

13,248

The open-source agentic Chromium browser with native AI agents, MCP server, and visual workflow automation — your data never leaves your machine.

View details
87
Repo Health
82
Technical
69
Dependency
Built with
TypeScript49%
Rust22%
Python16%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search