litert-lm
Skill by android
Guides an AI assistant through building an Android app that runs an open text LLM on the device, on the CPU or GPU, using the LiteRT-LM Kotlin API. Aimed at developers adding chat, summarization, or extraction features with a .litertlm model.
Install litert-lm
Built from the published package, never by AI.
git clone --depth 1 https://github.com/android/skills /tmp/skills && mkdir -p ~/.claude/skills && cp -r /tmp/skills/device-ai/litert/litert-lm ~/.claude/skills/litert-lmRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/android/skills /tmp/skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/skills/device-ai/litert/litert-lm ~/.gemini/antigravity-cli/skills/litert-lmAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The litert-lm skill guides an AI assistant through building an Android app that runs an open text LLM on the device, on the CPU or the GPU. It uses the LiteRT-LM Kotlin API (com.google.ai.edge.litertlm) and a single .litertlm model file, such as Gemma, Qwen, Llama, or Phi models from the Hugging Face litert-community. The steps cover the Gradle dependency, the GPU manifest entries, getting the model file onto the device, and initializing the Engine off the main thread.
It also covers a streamed multi-turn Conversation using sendMessageAsync, plus an AndroidViewModel and a Compose screen. The skill is for developers building a chat, summarization, or extraction feature. It states that image and audio input, tool calling, NPU backends, and model conversion are not covered. For vision and audio models in .tflite files, it points to the litert-runtime skill.
Written from the project's SKILL.md and checked against it.
What it can do
- Gradle setupAdds the litertlm-android dependency and sets minSdk for the app.
- GPU manifest entriesAdds the native library entries needed for the GPU backend in AndroidManifest.xml.
- Model file placementExplains how to get a .litertlm model file onto the device with adb or an in-app download.
- Engine initializationCreates the engine with EngineConfig and initializes it on a background thread.
- Streamed conversationRuns a multi-turn Conversation that streams replies with sendMessageAsync.
- ViewModel and Compose screenProvides an AndroidViewModel and a Compose screen for the chat interface.
What you need
- A Kotlin Android project
- Android minSdk 24 or higher
- Google Maven access for the litertlm-android dependency
- Enough device storage for a model file of hundreds of MB to a few GB
- INTERNET permission if the app downloads the model
Try asking
- Build an Android chat screen that runs a Gemma model on the device
- Add the LiteRT-LM dependency and GPU manifest entries to my app
- Set up a streamed multi-turn conversation with sendMessageAsync in my ViewModel
Good to know
- Does not cover image or audio input
- Does not cover tool calling or NPU backends
- Does not cover converting models
- Hilt projects may need a Dagger or Kotlin metadata version change to build
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: device-ai/litert/litert-lm/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md18 KB -
references/android/google/play/on-device-ai.md37 KB -
references/get-a-model.md2 KB
Alternatives to litert-lm
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
litert-lm: common questions
Which models does the litert-lm skill support?
The skill uses .litertlm files from the Hugging Face litert-community, such as Gemma, Qwen, Llama, and Phi. It names litert-community/gemma-4-E2B-it-litert-lm and litert-community/Qwen3-0.6B as starting points.
Can this skill run vision or audio models?
No. The skill excludes .tflite vision, audio, and embedding models that use the CompiledModel API. It points to the litert-runtime skill for those models.
Why should the engine be initialized off the main thread?
The source says Engine initialization loads the weights and blocks for seconds, so it must run on a background thread.
How do I install litert-lm?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is litert-lm free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is litert-lm safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to litert-lm?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
