Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Google I/O Extended Bali 2025 - Wahyu

Google I/O Extended Bali 2025 - Wahyu

Sharing about how to integrate Chrome Built-in AI latest feature for Web Developer

Avatar for Wahyu Ivan

Wahyu Ivan

August 02, 2025
Tweet

More Decks by Wahyu Ivan

Other Decks in Programming

Transcript

  1. Hello, I’m Wahyu! *not my actual title I’m a FE

    Developer A developer with 3 years of mixed professional experience, now working as a Clown* at Incentro APAC. Bali 2025
  2. Brief overview of what we gonna discuss * What is

    Chrome Built-in AI? * Requirements * Benefits of Client-side AI * Getting started with built-in AI * Downsides of Client-side AI * End
  3. Google I/O Extended 25 Proprietary & Confidential Chrome Built-in AI

    brings AI capabilities directly into the browser, allowing websites and web apps to perform tasks like translation, summarization, and writing assistance using local “expert” models, no need to host or manage AI models yourself. What is this stuff?
  4. Google I/O Extended 25 Proprietary & Confidential Client-side AI runs

    on the user’s device, offering faster, private, offline-capable experiences. It protects data, cuts server costs, and delivers premium features without backend load. What’s the benefits?
  5. Google I/O Extended 25 Proprietary & Confidential 1. Go to

    chrome://flags/#enable-experimental-web- platform-features 2. Select Enabled Enable experimental features
  6. Google I/O Extended 25 Proprietary & Confidential 1. Open tab,

    go to chrome://flags, and enable all this flags: • chrome://flags/#optimization-guide-on-device-model (The above and previous flag is usually sufficient. However, if the model availability check does not show its available, you can enable the additional flags below depending on which API is unavailable.) • chrome://flags/#prompt-api–for-gemini-nano • chrome://flags/#prompt-api-for-gemini-nano-multimodal-input • chrome://flags/#summarization-api-for-gemini-nano • chrome://flags/#writer-api-for-gemini-nano • chrome://flags/#rewriter-api-for-gemini-nano • chrome://flags/#language-detection-api • chrome://flags/#translation-api • chrome://flags/#language-detection-api • chrome://flags/#proofreader-api-for-gemini-nano (latest update) 2. Relaunch Chrome Enable all available API
  7. Google I/O Extended 25 Proprietary & Confidential 1. You can

    either using this way: a. Open DevTools and send await LanguageModel.availability(); in the console. b. If this returns “available”, then you are all set. 2. or this way: Check if the model is ready
  8. Google I/O Extended 25 Proprietary & Confidential Summarize long texts

    into shorter, key-point versions directly in the browser. Using Summarizer API
  9. const available = await Summarizer.availability(); let summarizer; if (available ===

    'unavailable') { return } if (available === 'available') { summarizer = await Summarizer.create() } else { summarizer = await Summarizer.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Use regular API for complete response const result = await summarizer.summarize( 'Text to summarize' ); Summarizer API Example Checks if Summarizer API is available. If needed, downloads the model with progress shown. Then uses summarize() to get a summary from text.
  10. const available = await Summarizer.availability(); let summarizer; if (available ===

    'unavailable') { return } if (available === 'available') { summarizer = await Summarizer.create() } else { summarizer = await Summarizer.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Use streaming API for real-time updates const stream = await summarizer.summarizeStreaming( 'Text to summarize' ); let result = '' for await (const chunk of stream) { result += chunk } Summarizer (Streaming) API Example Checks if Summarizer API is available. If needed, downloads the model with progress shown. Then uses summarizeStreaming() to get a streamed summary from text.
  11. Google I/O Extended 25 Proprietary & Confidential Generate original content

    like paragraphs or ideas based on a prompt. Using Writer API
  12. const available = await Writer.availability(); let writer; if (available ===

    'unavailable') { return } if (available === 'available') { writer = await Writer.create() } else { writer = await Writer.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Use regular API for complete response const result = await writer.write( 'Write a product description for an eco-friendly water bottle' ); Writer API Example Checks if Writer API is available. If not ready, it downloads the model with progress shown. Then, it uses write() to generate text from a prompt.
  13. const available = await Writer.availability(); let writer; if (available ===

    'unavailable') { return } if (available === 'available') { writer = await Writer.create() } else { writer = await Writer.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Use streaming API for real-time updates const stream = await writer.writeStreaming( 'Write a product description for an eco-friendly water bottle' ); let result = '' for await (const chunk of stream) { result += chunk } Writer (Streaming) API Example Checks if Writer API is available. If not ready, it downloads the model with progress shown. Then, it uses writeStreaming() to generate streamed text from a prompt.
  14. Google I/O Extended 25 Proprietary & Confidential Rewrite or improve

    existing text while keeping the original meaning. Using Rewriter API
  15. const available = await Rewriter.availability(); let rewriter; if (available ===

    'unavailable') { return } if (available === 'available') { rewriter = await Rewriter.create() } else { rewriter = await Rewriter.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Use regular API for complete response const result = await rewriter.rewrite( 'Please rewrite this sentence to be more formal.' ); Rewriter API Example Checks if Rewriter API is available. If needed, downloads the model with progress. Then uses rewrite() to improve or rephrase the text.
  16. const available = await Rewriter.availability(); let rewriter; if (available ===

    'unavailable') { return } if (available === 'available') { rewriter = await Rewriter.create() } else { rewriter = await Rewriter.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Use streaming API for real-time updates const stream = await rewriter.rewriteStreaming( 'Please rewrite this sentence to be more formal.' ); let result = '' for await (const chunk of stream) { result += chunk } Rewriter (Streaming) API Example Checks if Rewriter API is available. If needed, downloads the model with progress. Then uses rewriteStreaming() to improve or rephrase the text.
  17. Google I/O Extended 25 Proprietary & Confidential Translate text between

    languages using local models. Using Translator API
  18. const available = await Translator.availability(); let translator; if (available ===

    'unavailable') { return } if (available === 'available') { translator = await Translator.create() } else { translator = await Translator.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } const result = await translator.translate( 'Text to translate goes here...', targetLang: 'id', sourceLang: 'en' ); Translator API Example Checks if Translator API is available. If needed, downloads the model with progress. Then uses translate() to convert text from English to Indonesia.
  19. Google I/O Extended 25 Proprietary & Confidential Detect the language

    of a given piece of text automatically. Using Language Detector API
  20. const available = await LanguageDetector.availability(); let detector; if (available ===

    'unavailable') { return } if (available === 'available') { detector = await LanguageDetector.create() } else { detector = await LanguageDetector.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } const result = await detector.detect( 'Text to detect language from goes here...'); Language Detector API Example Checks if Language Detector API is available. If needed, downloads the model with progress. Then uses detect() to identify the language of the text.
  21. Google I/O Extended 25 Proprietary & Confidential Check and correct

    grammar, spelling, and punctuation errors. Using Proofreader APINew
  22. const available = await Proofreader.availability(); let proofreader; if (available ===

    'unavailable') { return } if (available === 'available') { proofreader = await Proofreader.create() } else { proofreader = await Proofreader.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) }, includeCorrectionTypes: true, includeCorrectionExplanations: true, expectedInputLanguages: ["en"] }) } // Use regular API for complete response const result = await proofreader.proofread( 'I seen him yesterday atss the stroe, and he bought twa loafs of bread.', includeCorrectionTypes: true, includeCorrectionExplanations: true, expectedInputLanguages: ["en"] ); Proofreader API Example Checks if Proofreader API is available. If needed, downloads the model with progress. Then uses proofread() to fix grammar, show error types, and give explanations for English text.
  23. Google I/O Extended 25 Proprietary & Confidential Send custom prompts

    to generate text responses with built-in AI. Using Text Prompt API
  24. const available = await LanguageModel.availability(); let model; if (available ===

    'unavailable') { return } if (available === 'available') { model = await LanguageModel.create() } else { model = await LanguageModel.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Use regular API for complete response const result = await model.prompt( 'Your prompt goes here' ); Text Prompt API Example Checks if Language Model API is available. If needed, downloads the model with progress. Then uses prompt() to generate a text response based on your input.
  25. const available = await LanguageModel.availability(); let model; if (available ===

    'unavailable') { return } if (available === 'available') { model = await LanguageModel.create() } else { model = await LanguageModel.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Use streaming API for real-time updates const stream = await model.promptStreaming( 'Your prompt goes here' ); let result = '' for await (const chunk of stream) { result += chunk } Text Prompt (Streaming) API Example Checks if Language Model API is available. If needed, downloads the model with progress. Then uses prompt() to generate a streamed text response based on your input.
  26. Google I/O Extended 25 Proprietary & Confidential Describe an image

    uploaded to your website for use in a caption or alt text. Using Multimodality Prompt API (Image)
  27. const available = await LanguageModel.availability(); let model; if (available ===

    'unavailable') { return } if (available === 'available') { model = await LanguageModel.create() } else { model = await LanguageModel.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Get image data from a file input or canvas const imageFile = document.querySelector('input[type="file"]').files[0] const imageData = await imageFile.arrayBuffer() // Create a prompt with both text and image const prompt = { text: 'What can you tell me about this image?', images: [imageData] } const result = await model.generateContent(prompt); Multimodality Prompt API (Image) Example Checks if Language Model API is available. If needed, downloads the model with progress. Then sends both text and image as a prompt using generateContent() to get a response based on the image.
  28. Google I/O Extended 25 Proprietary & Confidential Allow users to

    transcribe audio messages sent in a chat application. Using Multimodality Prompt API (Audio)
  29. const available = await LanguageModel.availability(); let model; if (available ===

    'unavailable') { return } if (available === 'available') { model = await LanguageModel.create() } else { model = await LanguageModel.create({ monitor(m) { m.addEventListener('downloadprogress', (e) => { console.log(`Downloaded ${e.loaded * 100}%`) }) } }) } // Get audio data from a file input or MediaRecorder const audioFile = document.querySelector('input[type="file"]').files[0] const audioData = await audioFile.arrayBuffer() // Create a prompt with both text and audio const prompt = { text: 'What is being said in this audio?', audio: audioData } const result = await model.generateContent(prompt); Multimodality Prompt API (Audio) Example Checks if Language Model API is available. If needed, downloads the model with progress. Then sends both text and audio using generateContent() to get a response based on the audio input.
  30. Google I/O Extended 25 Proprietary & Confidential 1. Translate user

    reviews locally before submitting or replying 2. Autocorrect and grammar check in writing apps without internet 3. Summarize articles or emails locally in a reading app 4. Identify products from images for offline catalog search 5. Run local sentiment analysis on user feedback 6. Process and respond to voice commands in offline apps 7. Auto-tag photos using on-device object detection Some use case in real world project
  31. Google I/O Extended 25 Proprietary & Confidential 1. Limited browser

    support (Chrome 128+ only) 2. Not available on all devices. Older or low-end hardware may not run models well 3. Smaller models = less powerful than cloud-based AI (because it’s Gemini Nano) 4. Large model downloads can impact mobile data and storage 5. Requires fallback logic for unsupported browsers 6. Features are still experimental. Mostly still in Canary/Dev versions for latest capabilities There’s a drawback?!