Skip to content

Introduction

web-ai-sdk provides one TypeScript package for each supported browser AI capability: Prompt, Writer, Rewriter, Proofreader, Translator, Summarizer, Language Detector, and WebMCP. The packages have no runtime dependencies.

The SDK does not replace the browser APIs. It manages session reuse, streaming, abort signals, cleanup, and unavailable states. It does not compose capabilities or walk the DOM — application code owns tasks such as article extraction and detect-then-summarize flows.

The sidebar on the left is organized into three sections:

  • Start: shared concepts, browser support, production guidance, architecture, and the public MCP server.
  • Guides — one guide per capability, covering the vanilla API surface, streaming, and lifecycle patterns. Start with the guide for the capability you need; they do not depend on each other.
  • React Hooks — the @web-ai-sdk/<pkg>/react hooks that wrap each vanilla API for React applications.

If you are new, read Browser support first to confirm the capability you want is available where you ship, then jump to that capability’s guide.

Install one package or the full set:

Terminal window
pnpm add @web-ai-sdk/prompt # one block
pnpm add @web-ai-sdk/all # all eight blocks

Each package ships two entry points:

  • Vanilla (@web-ai-sdk/<pkg>): TypeScript and DOM APIs with no framework dependency.
  • React (@web-ai-sdk/<pkg>/react): hooks over the vanilla API. react is an optional peer dependency.

The meta-package guide documents subpath and namespaced imports for @web-ai-sdk/all.

Each package owns one browser capability. Only Prompt uses the general LanguageModel API; the other capabilities have different inputs and results, and WebMCP exposes page tools instead of generating text. UI, polyfills, DOM traversal, and cross-capability workflows remain outside the core wrappers.

You can use the browser APIs directly. The SDK handles lifecycle code that applications often repeat:

  • feature detection and unavailable states;
  • session reuse and cleanup;
  • delta and cumulative stream normalization;
  • AbortSignal wiring.

See Why web-ai-sdk for a detailed comparison and the Architecture guide for how the packages are structured.

  • Browser support — availability matrix per API and browser.
  • Prompt guide — the most general capability, a good first read.
  • Production checklist — user intent, input selection, safe rendering, progress, reversible edits, and cache freshness before you ship.
  • MCP server: connect an agent to canonical project documentation.