Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

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.

  • Score 94
  • 11k stars
  • Apache-2.0
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

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-lm

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install litert-lm in Claude Code

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

A

No 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 →

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.

litert-lm Install

Add to stack

Loading.