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.
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>;| Name | Type / Values | Description |
|---|---|---|
| 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. |
| expectedInputLanguages | sequence<DOMString> | BCP-47 language tags for the text you intend to summarize. |
| expectedContextLanguages | sequence<DOMString> | BCP-47 language tags for the context strings. |
| outputLanguage | DOMString | The expected language of the generated summary (BCP-47). Defaults to matching the input language. |
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>;Inherits all properties from SummarizerCreateCoreOptions (above), plus:
| Name | Type | Description |
|---|---|---|
| sharedContext | DOMString | Background context shared across all summarize calls made by this instance. |
| monitor | CreateMonitorCallback | A function to track model weight downloads (emits downloadprogress events). |
| signal | AbortSignal | Pass an AbortController.signal to cancel session creation and halt downloads. |
Executes inference and returns a single Promise resolving to the complete generated summary.
summarize(input: DOMString, options?: SummarizerSummarizeOptions): Promise<DOMString>;| Name | Type | Description |
|---|---|---|
| context | DOMString | Context specific to this individual summarization request. |
| signal | AbortSignal | Pass an AbortController.signal to cancel this specific operation. |
Identical parameters to summarize(), but returns a ReadableStream of string chunks as they are generated.
summarizeStreaming(input: DOMString, options?: SummarizerSummarizeOptions): ReadableStream;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>; 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;Read-only attributes representing the configuration of the current session.
readonly sharedContext: DOMStringreadonly type: SummarizerTypereadonly format: SummarizerFormatreadonly length: SummarizerLengthreadonly 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).