Add Android deliberately.
Install the provider separately and add the pinned ML Kit SDK to your app. Google’s native dependencies are not bundled into the provider package.
Connect eligible Android devices to Gemini Nano through Google’s ML Kit GenAI Prompt API. Use the same provider interface, router, and React hooks as the Apple package.
v2.0.0 · Available on npm
Install the provider separately and add the pinned ML Kit SDK to your app. Google’s native dependencies are not bundled into the provider package.
Use the LLMProvider contract, context manager, router, and React hooks from on-device-llm. Choose which providers your app can use.
Read availability and capabilities at runtime. Device eligibility depends on AICore support; the Android provider does not offer structured output or tool calling.
Check the model before you ask it to work. Handle unavailable devices and generation errors in your interface.
API example. Requires the native module in a compatible app build. Add the ML Kit SDK explicitly.
Read the setup guide →import { createAndroidProvider } from '@taaltreelabs/on-device-llm-android';
const model = createAndroidProvider();
const availability = await model.availability();
if (availability.available) {
try {
const result = await model.generate({
messages: [{ role: 'user', content: 'Explain why leaves change color.' }],
});
console.log(result.text);
} catch (error) {
// Availability does not guarantee generation will succeed.
console.error('Generation failed', error);
}
} else {
console.log('Model unavailable:', availability.reason);
}
Review the documented requirements and platform support, then follow a guide for your integration.
Compatibility & limitations →