Enable Chrome AI (Gemini Nano) in Settings
Use Google's Gemini Nano model running directly in Chrome via the W3C Prompt API. Zero latency, completely private, and free. All inference happens on-device with no network requests. Public stable on web pages in Chrome 148+ (May 2026); available on extension stable since Chrome 138. Tool calling is exposed through the page's WebMCP registrations (navigator.modelContext) where supported.
No configuration required. This provider works out of the box.
Add provider:
npx webinfer provider add chrome-aiTest connection:
npx webinfer provider test chrome-aiBasic usage:
import { generateText } from "webinfer"
// WebInfer automatically routes to the best available provider
const result = await generateText({
prompt: "Write a haiku about programming"
})
console.log(result.text)Specify Chrome AI (Gemini Nano) explicitly:
import { generateText } from "webinfer"
const result = await generateText({
prompt: "Write a haiku about programming",
provider: "chrome-ai",
model: "gemini-nano"
})
console.log(result.text)
console.log("Provider:", result.provider)
console.log("Model:", result.model)Streaming:
import { streamText } from "webinfer"
const { textStream } = await streamText({
prompt: "Write a story about AI",
provider: "chrome-ai"
})
for await (const chunk of textStream) {
process.stdout.write(chunk)
}gemini-nanoGemini Nano
Google Gemini Nano - compact on-device model optimized for Chrome
gemini-nano