Hi team,
I'm developing a Chrome extension and trying to integrate with the built-in window.ai Prompt API (Gemini Nano). However, I'm consistently finding that the window.ai object is undefined, and my extension's service worker logs the error: Error: Chrome Built-in AI API (window.ai) is not available.
Here are the details of my environment and the troubleshooting steps I've already taken:
Environment:
OS: macOS
Hardware: iMac with Apple M4 Chip
Chrome Version: 143
Troubleshooting Steps:
1. Flags Enabled: I have enabled the following flags in chrome://flags:
#optimization-guide-on-device-model
#prompt-api-for-gemini-nano
2. Component Check: In chrome://components, the Optimization Guide On Device Model component is listed. However, there is no "Check for update" button available for it.
3. Waiting & Restarting: I have left the browser running for an extended period and have restarted it multiple times.
4. New Profile: I created a completely new, clean Chrome profile, enabled the same flags, and the issue persists.
5. Hardware Check: My hardware (iMac M4) meets and exceeds the documented requirements.
Given that I'm on a newer version of Chrome (143) and have followed all the setup steps, I'm trying to understand why the API is still unavailable.
Could you please provide some insight?
Is this a known issue, perhaps related to the new Apple M4 hardware?
Is access to Gemini Nano being controlled by a server-side rollout that might not have reached my account/region yet?
Are there any other diagnostic steps I can take to verify the status of the Gemini Nano model download and installation?
Any information would be greatly appreciated. please checkout screenshoot attachment.
Thank you
--
You received this message because you are subscribed to the Google Groups "Chrome Built-in AI Early Preview Program Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chrome-ai-dev-previe...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chrome-ai-dev-preview-discuss/bd0ced66-e309-428b-a095-535929ac4f34n%40chromium.org.
Hi Connie & team,
Thank you so much for the quick response and the clarification. Your advice to use the direct global APIs (like LanguageModel.create()) instead of the window.ai namespace was very helpful and pointed me in the right direction.
I have an update with some progress and a new, more specific issue.
Progress:
Based on your feedback, I have now enabled all the relevant flags (#prompt-api-for-gemini-nano, #summarization-api-for-gemini-nano, #translation-api, and #language-detection-api). After refactoring my code to use the direct global objects, the on-device `Summarizer` API is now working
successfully!
New Issue:
While Summarizer works, I'm now facing an issue with the LanguageDetector API. When I call LanguageDetector.detect(text), it appears to return an empty result, which leads my code to conclude that the language could not be detected.
The most surprising part is that this happens even for simple English text (e.g., "Hello, how are you?").
Because the language detection fails, my extension cannot proceed to use the on-device Translator and correctly falls back to the cloud API.
This leads to a more specific question:
* Is it possible for the LanguageDetector model component to fail to install or activate, even if other on-device models (like for Summarizer) are working?
* Is there any way to check the status of individual AI model components or force a re-download of all of them?
It seems the core issue is the availability of the on-device models, but it now appears to be specific to the LanguageDetector.
Thanks again for your guidance.
Best regards,