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.
How to use these docs
Section titled “How to use these docs”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>/reacthooks 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.
Installation
Section titled “Installation”Install one package or the full set:
pnpm add @web-ai-sdk/prompt # one blockpnpm add @web-ai-sdk/all # all eight blocksEach 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.reactis an optional peer dependency.
The meta-package guide documents subpath and namespaced imports for @web-ai-sdk/all.
Packages
Section titled “Packages”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.
- @web-ai-sdk/allInstall all eight packages together.
- @web-ai-sdk/promptSend prompts and manage sessions, streams, and abort signals.
- @web-ai-sdk/webmcpRegister browser tools and clean them up safely.
- @web-ai-sdk/summarizerCreate summaries, key points, teasers, and headlines.
- @web-ai-sdk/translatorTranslate text between languages with reusable sessions.
- @web-ai-sdk/detectorDetect languages and receive confidence scores.
- @web-ai-sdk/writerDraft text with a configurable tone, format, and length.
- @web-ai-sdk/rewriterChange the tone or length of existing text.
- @web-ai-sdk/proofreaderCorrect grammar, spelling, and punctuation.
Why use a wrapper?
Section titled “Why use a wrapper?”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;
AbortSignalwiring.
See Why web-ai-sdk for a detailed comparison and the Architecture guide for how the packages are structured.
Next steps
Section titled “Next steps”- 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.