The Summarizer API provides a high-level interface to call on the browser's built-in language model to condense long texts, articles, or transcripts into structured summaries, key points, or headlines.


Summarizer.availability()

Checks if the browser currently supports creating a summarizer session with the provided configuration. Returns a Promise resolving to an Availability string ('available' | 'downloadable' | 'unavailable' | 'downloading').

static availability(options?: SummarizerCreateCoreOptions): Promise<Availability>;

Parameters (SummarizerCreateCoreOptions)

NameType / ValuesDescription
type"tldr" | "teaser" |
"key-points" | "headline"
The style of the summary. Default is "key-points".
format"plain-text" | "markdown"Output format. Default is "markdown".
length"short" | "medium" | "long"The target length of the summary. Default is "short".
preference"auto" | "speed" | "capability"Balances speed vs model capability. Default is "auto". Experimental — only available in extension and experimental contexts.
expectedInputLanguagessequence<DOMString>BCP-47 language tags for the text you intend to summarize.
expectedContextLanguagessequence<DOMString>BCP-47 language tags for the context strings.
outputLanguageDOMStringThe expected language of the generated summary (BCP-47). Defaults to matching the input language.
Interactive Playground

Summarizer.create()

Creates and returns a new Summarizer instance. If the model is downloadable, calling this method initiates the network download — in that case the call must happen from a user gesture (it requires and consumes transient user activation) or it rejects with a NotAllowedError.

static create(options?: SummarizerCreateOptions): Promise<Summarizer>;

Parameters (SummarizerCreateOptions)

Inherits all properties from SummarizerCreateCoreOptions (above), plus:

NameTypeDescription
sharedContextDOMStringBackground context shared across all summarize calls made by this instance.
monitorCreateMonitorCallbackA function to track model weight downloads (emits downloadprogress events).
signalAbortSignalPass an AbortController.signal to cancel session creation and halt downloads.
Interactive Playground

summarizer.summarize()

Executes inference and returns a single Promise resolving to the complete generated summary.

summarize(input: DOMString, options?: SummarizerSummarizeOptions): Promise<DOMString>;

Options Parameter (SummarizerSummarizeOptions)

NameTypeDescription
contextDOMStringContext specific to this individual summarization request.
signalAbortSignalPass an AbortController.signal to cancel this specific operation.
Interactive Playground

summarizer.summarizeStreaming()

Identical parameters to summarize(), but returns a ReadableStream of string chunks as they are generated.

summarizeStreaming(input: DOMString, options?: SummarizerSummarizeOptions): ReadableStream;
Interactive Playground

summarizer.measureInputUsage()

Measures how much of the input quota the given input and context will consume (implementation-defined units, typically tokens). Returns a Promise resolving to a number.

measureInputUsage(input: DOMString, options?: SummarizerSummarizeOptions): Promise<double>;
Interactive Playground

summarizer.destroy()

Signals that the summarizer is no longer needed, allowing the browser to free the model resources. Any pending summarize() calls are rejected with an AbortError.

destroy(): undefined;
Interactive Playground

Properties

Read-only attributes representing the configuration of the current session.

  • readonly sharedContext: DOMString
  • readonly type: SummarizerType
  • readonly format: SummarizerFormat
  • readonly length: SummarizerLength
  • readonly preference: PerformancePreference - Experimental: extension/experimental contexts only.
  • readonly expectedInputLanguages: FrozenArray<DOMString>?
  • readonly expectedContextLanguages: FrozenArray<DOMString>?
  • readonly outputLanguage: DOMString?
  • readonly inputQuota: unrestricted double - The maximum input usage this instance accepts (implementation-defined units; may be Infinity if unrestricted).
Interactive Playground