npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

capacitor-gemini-nano

v1.0.0

Published

Capacitor plugin for on-device AI with Gemini Nano via ML Kit GenAI Prompt API

Readme

capacitor-gemini-nano

A Capacitor plugin for on-device AI using Gemini Nano via Google's ML Kit GenAI Prompt API.

Features

  • On-device AI: Run Gemini Nano locally on supported Android devices
  • No API keys required: Completely free and unlimited
  • Offline capable: Works without internet connection
  • Privacy-first: All processing stays on device

Supported Devices

Gemini Nano is available on:

  • Google Pixel 9, Pixel 9 Pro, Pixel 9 Pro XL, Pixel 9 Pro Fold
  • Samsung Galaxy S24 series (with One UI 6.1+)
  • Samsung Galaxy S25 series
  • Other devices with Android AICore support

Installation

npm install capacitor-gemini-nano
npx cap sync

Requirements

  • Capacitor 8.0+
  • Android minSdkVersion 26+
  • Device with Gemini Nano support
  • AICore app installed and updated

Usage

Check Status

import { GeminiNano } from 'capacitor-gemini-nano';

const status = await GeminiNano.checkStatus();
console.log(status);
// { status: 'available' | 'downloadable' | 'downloading' | 'unavailable', message: string }

Download Model (if needed)

// Listen for download progress
GeminiNano.addListener('onDownloadProgress', (data) => {
  console.log(`Download progress: ${data.progress}%`);
});

const result = await GeminiNano.downloadModel();
if (result.success) {
  console.log('Model downloaded!');
}

Generate Text

// Warm up the model (optional but recommended)
await GeminiNano.warmup();

// Generate response
const result = await GeminiNano.generate({
  prompt: 'What is the capital of France?',
  temperature: 0.7,
  maxOutputTokens: 256
});

if (result.success) {
  console.log(result.text);
}

Streaming Generation

GeminiNano.addListener('onToken', (data) => {
  process.stdout.write(data.token);
});

GeminiNano.addListener('onComplete', (data) => {
  console.log('\nComplete:', data.fullText);
});

GeminiNano.addListener('onError', (data) => {
  console.error('Error:', data.error);
});

await GeminiNano.generateStream({
  prompt: 'Write a short poem about coding',
  temperature: 0.8
});

API

Methods

| Method | Description | |--------|-------------| | checkStatus() | Check if Gemini Nano is available | | downloadModel() | Download the model if status is 'downloadable' | | warmup() | Pre-warm the model for faster first generation | | generate(options) | Generate text (non-streaming) | | generateStream(options) | Generate text with streaming |

GenerateOptions

| Property | Type | Default | Description | |----------|------|---------|-------------| | prompt | string | required | The input prompt | | temperature | number | 0.7 | Creativity (0.0-1.0) | | topK | number | 40 | Top-K sampling | | maxOutputTokens | number | 256 | Maximum output length |

Events

| Event | Data | Description | |-------|------|-------------| | onDownloadProgress | { progress: number } | Download progress (0-100) | | onToken | { token: string } | Streaming token | | onComplete | { fullText: string } | Streaming complete | | onError | { error: string } | Error occurred |

Limitations

  • Output tokens: ~256 tokens max per generation
  • Context window: ~3000 words input
  • Android only: iOS not supported (no Gemini Nano on iOS)
  • Device dependent: Only works on supported hardware

Troubleshooting

"Gemini Nano unavailable"

  1. Check if your device is supported
  2. Update Google Play Services
  3. Update AICore app (Settings > Apps > AICore)
  4. Change device region to US (some regions restricted)
  5. Join the Android AICore beta program

"Model needs download"

Call downloadModel() and wait for completion. This requires WiFi and can take several minutes.

License

MIT

Credits

Built with ML Kit GenAI Prompt API.