Introduction
The AI landscape is evolving incredibly fast, with newer models able to perform more complex tasks with ease, but these breakthroughs often come with a hefty price tag, not to mention they aren't accessible to a large audience.
This is where smaller AI models, which can run locally and are designed to operate efficiently on smaller devices, are the key to the AI future. These lightweight models are already reshaping the AI landscape by making powerful capabilities accessible directly within browsers and other edge platforms.
Google Chrome’s Built-in AI APIs, powered by Gemini Nano, bring many AI capabilities right into your browser. For many everyday use cases, such as real-time language translation, content & image generation, and summarization, this AI model is more than capable, setting a promising course for the future of AI that prioritizes accessibility, efficiency, and sustainability.
Continue reading to explore:
- How to enable these capabilities inside Chrome
- Some sample code to get started
- How this will change the landscape for AI soon
How to enable Chrome Built-in AI
If you want the complete experience, it is recommended that you use Chrome Canary. Some APIs are also available in Chrome stable (version 128 or later). There are some newer APIs that require version 131 or later.
Follow the given steps to enable Chrome's built-in API:
- Open Chrome and Enter
chrome://flags
in the address bar. - Search for Gemini and turn on Prompt API, Summarization API, Writer API & Rewriter API.
- Search for
chrome://flags/#language-detection-api
, then enable the Language translation API. - Search for
chrome://flags/#translation-api
, then enable the Translation API - You should now have different APIs enabled for Gemini Nano.
- Enable the desired APIs from the dropdown and restart your browser.
Ensuring Models Are Ready
To check if you have the AI models available, open your browser console and run the following command.
If you don't see this output, the model might not be available and will be queued for download. The following steps will force the download.
- Open
chrome://components
in the address bar - Find “Optimization Guide On Device Model.” This should show the status as Updated and a version number. If you don't see it, click the button “Check for update” to force the download and wait for some time to see something like the screenshot shown below.
3. Run the same test again, and now it should show the output “readily” in your console.
Sample code For Chrome APIs
The Chrome Built-in APIs are very straightforward and as simple as calling a function. Check out this CodePen example for a quick demo.
See the Pen Chrome AI APIs - Gemini Nano Playground by swarad07 (@swarad07) on CodePen.
Checking Model Capabilities
The following snippet will help you understand your AI model capabilities.
Initializing AI Capabilities
Use the following code snippet to initialize the AI capabilities.
Using AI APIs
Now comes the important part, where we call the API to get things done, be it generating content, summarising, translating, etc.
How this will change the landscape for AI soon
As shown in the above demo, smaller AI models running directly inside browsers can revolutionize the AI landscape. By running inside browsers, these smaller models can make AI an everyday accessible tool. By eliminating subscriptions, and cloud connectivity, these models significantly reduce latency and improve user privacy. For users, this could mean control over data and compliance with stringent privacy regulations.
By integrating AI directly into the browser, tools that previously relied on cloud-based models risk becoming obsolete. This is because you no longer need to subscribe to a separate service for summarizing text or generating content. Your browser can do the same thing seamlessly as the content shows up on the screen.
AI models running directly inside the browser have the potential to revolutionize the AI landscape. It isn’t just about size, as is the case with large LLMs. Efficiency and accessibility are equally important. Having models like Gemini Nano inside the most popular browser can mark a shift in the AI landscape in the coming years.
Interested In A Demo?
Reach out to the experts at Axelerant for a demonstration of how to make your customer’s digital experiences more intelligent, responsive, and capable.
Swarad Mokal, Technical Program Manager
Big time Manchester United fan, avid gamer, web series binge watcher, and handy auto mechanic.
Sayan Mallick, Marketing Assistant
A former professional e-sports player, passionate about anime and technology—that’s Sayan. He is an eccentric explorer who likes to read, play games, teach, and spend time with his pet dog, Buddy.
Leave us a comment