litert-lm

Builds Android apps that run open text LLMs on device using LiteRT-LM Kotlin API.

9.3k|601|Updated Mar 16, 2026
Ready to run
npx skills add https://github.com/android/skills --skill litert-lm-android
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: litert-lm
Source: https://github.com/android/skills/tree/main/device-ai/litert/litert-lm
Command: npx skills add https://github.com/android/skills --skill litert-lm-android

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Integrating on-device LLMs into Android apps requires handling model loading, background initialization, lifecycle management, and UI integration. ## Core Features & Use Cases - Runs open text LLMs on CPU or GPU with LiteRT-LM Kotlin API - Implements streamed multi-turn conversations using sendMessageAsync - Manages Engine and Conversation with single-thread executor and AndroidViewModel - Supports model placement from files or Play for On-device AI ## Quick Start Add the litertlm-android dependency to app/build.gradle.kts and initialize the Engine off the main thread using a background executor.

Frequently Asked Questions about litert-lm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate LiteRT-LM into an Android app?▼

Add the litertlm-android dependency to build.gradle.kts and initialize the Engine with a background executor before use.

What backend options does LiteRT-LM support?▼

It supports CPU and GPU backends, requiring specific native library entries in the AndroidManifest.xml for GPU.

How do I handle model initialization in an Android app?▼

Call Engine.initialize() on a background thread using a single-thread executor to avoid main thread blocking.

Can this skill be used for NPU backends?▼

No, this skill does not support NPU backends as indicated in the model file suffixes.

How to manage the lifecycle of the Engine and Conversation?▼

Use an AndroidViewModel with a single-thread executor to own the Engine and Conversation, closing them properly after use.