Published: November 11, 2024, Last updated: May 20, 2025
Explainer | Web | Extensions | Chrome Status | Intent |
---|---|---|---|---|
GitHub | View | Intent to Ship |
You can offer your users the ability to distill lengthy articles, complex documents, or even lively chat conversations into concise and insightful summaries.
The Summarizer API can be used to generate different types of summaries in varied lengths and formats, such as sentences, paragraphs, bullet point lists, and more. We believe this API is useful in the following scenarios:
- Summarizing the key points of an article or a chat conversation.
- Suggesting titles and headings for articles.
- Creating a concise and informative summary of a lengthy text.
- Generating a teaser for a book based on a book review.
Get started
The Summarizer API is available from Chrome 138 stable.
Run feature detection to see if the browser supports the Summarizer API.
if ('Summarizer' in self) {
// The Summarizer API is supported.
}
Review the hardware requirements
The Language Detector and Translator APIs work on desktop only in Chrome.
The Prompt API, Summarizer API, Writer API, and Rewriter API work in Chrome when the following conditions are met:
- Operating system: Windows 10 or 11; macOS 13+ (Ventura and onwards); or Linux. Chrome for Android, iOS, and ChromeOS are not yet supported by our APIs backed by Gemini Nano.
- Storage: At least 22 GB on the volume that contains your Chrome profile.
- GPU: Strictly more than 4 GB of VRAM.
- Network: Unlimited data or an unmetered connection.
- GPU: Strictly more than 4 GB of VRAM.
- Network: Unlimited data or an unmetered connection.
These requirements exist for you in your development process and your users who work with the features you build.
Model download
The Summarizer API uses a model trained to generate high-quality summaries. The API is built into Chrome, and Gemini Nano is the model downloaded the first time a website uses this API.
To determine if the model is ready to use, call the asynchronous
Summarizer.availability()
function. It returns a promise with the
following values.
"unavailable"
means that the implementation does not support the requested options."downloadable"
means that the implementation supports the requested options, but first, the browser has to download something, such as a model (in Chrome's case, Gemini Nano) or fine-tuning for the model."downloading"
means that the implementation supports the requested options, but it has to finish an ongoing download before it can proceed."available"
means that the implementation supports the requested options and the summarizer can proceed.
To trigger the model download and create the summarizer, call the asynchronous
Summarizer.create()
function. If the response to availability()
was
downloadable
or downloading
, it's best practice to listen for download
progress. This way, you can inform the user and indicate the download
may take time to complete before summarization can occur.
const summarizer = await Summarizer.create({
monitor(m) {
m.addEventListener('downloadprogress', (e) => {
console.log(`Downloaded ${e.loaded * 100}%`);
});
}
});
API functions
The create()
function lets you configure a new summarizer object to your
needs. It takes an optional options
object with the following parameters:
sharedContext
: Additional shared context that can help the summarizer.type
: The type of the summarization, with the allowed valueskey-points
(default),tl;dr
,teaser
, andheadline
. See the following table for details.format
: The format of the summarization, with the allowed valuesmarkdown
(default) andplain-text
.length
: The length of the summarization, with the allowed valuesshort
,medium
(default), andlong
. The meanings of these lengths vary depending on thetype
requested. For example, in Chrome's implementation, a short key-points summary consists of three bullet points, and a short summary is one sentence.
The following table demonstrates the different types of summaries and their corresponding lengths. The lengths represent the maximum possible value, as sometimes, the results can be shorter.
Type | Meaning | Length | ||||||
---|---|---|---|---|---|---|---|---|
"tl;dr" |
Summary should be short and to the point, providing a quick overview of the input, suitable for a busy reader. |
|
||||||
"teaser" |
Summary should focus on the most interesting or intriguing parts of the input, designed to draw the reader in to read more. |
|
||||||
"key-points" |
Summary should extract the most important points from the input, presented as a bulleted list. |
|
||||||
"headline" |
Summary should effectively contain the main point of the input in a single sentence, in the format of an article headline. |
|
The following example demonstrates how to initialize the summarizer.
const options = {
sharedContext: 'This is a scientific article',
type: 'key-points',
format: 'markdown',
length: 'medium',
};
const availability = await Summarizer.availability();
let summarizer;
if (availability === 'unavailable') {
// The Summarizer API isn't usable.
return;
}
if (availability === 'available') {
// The Summarizer API can be used immediately .
summarizer = await Summarizer.create(options);
} else {
// The Summarizer API can be used after the model is downloaded.
summarizer = await Summarizer.create(options);
summarizer.addEventListener('downloadprogress', (e) => {
console.log(`Downloaded ${e.loaded * 100}%`);
});
await summarizer.ready;
}
Run the summarizer
There are two ways to run the summarizer: streaming and batch (non-streaming).
Batch summarization
With batch summarization, the model processes the input as a whole and then produces the output.
To get a batch summary, call the summarize()
function. The first
argument is the text that you want to summarize. The second, optional argument
is an object with a context
field. This field lets you add background details
that might improve the summarization.
const longText = document.querySelector('article').innerHTML;
const summary = await summarizer.summarize(longText, {
context: 'This article is intended for a tech-savvy audience.',
});
Streaming summarization
Streaming summarization offers results in real-time.
The output updates continuously as the input is added and adjusted. To get a
streaming summary, call summarizeStreaming()
instead of summarize()
.
const longText = document.querySelector('article').innerHTML;
const summary = await summarizer.summarizeStreaming(longText, {
context: 'This article is intended for junior developers.',
});
Demo
You can try the Summarizer API in the Summarizer API Playground.
Standardization effort
We're working to standardize the Summarizer API, to ensure cross-browser compatibility.
Our API proposal received community support and has moved to the W3C Web Incubator Community Group for further discussion. The Chrome team requested feedback from the W3C Technical Architecture Group, and asked Mozilla and WebKit for their standards positions.
Participate in the standards effort by joining the Web Incubator Community Group.
Share feedback
We want to see what you're building with the Summarizer API. Share your websites and web applications with us on X, YouTube, and LinkedIn.
For feedback on Chrome's implementation, file a bug report or a feature request.