# Litert Lm

Builds an Android app that runs an open text LLM on the device, on the CPU or the GPU...

- Repository: https://github.com/android/skills (10219 stars)
- Category: AI and agents
- License: Complete terms in LICENSE.txt
- Last updated: 2026-10-29
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add android/skills --skill litert-lm -g -a claude-code -y`
Codex: `npx skills add android/skills --skill litert-lm -g -a codex -y`
Cursor: `npx skills add android/skills --skill litert-lm -g -a cursor -y`
Gemini CLI: `npx skills add android/skills --skill litert-lm -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add android/skills`

## Description

Builds an Android app that runs an open text LLM on the device, on the CPU or the GPU, with the LiteRT-LM Kotlin API (com.google.ai.edge.litertlm:litertlm-android). Use this skill when creating a chat, summarization, or extraction feature with a .litertlm model from Hugging Face litert-community (Gemma, Qwen, Llama, Phi), including the Gradle dependency, the GPU manifest entries, getting the model file onto the device, Engine initialization off the main thread, a streamed multi-turn Conversation with sendMessageAsync, and the AndroidViewModel and Compose screen. Don't use for running .tflite vision, audio, or embedding models with the CompiledModel API, for image or audio input, tool calling, or NPU backends, or for converting models.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

This skill provides step-by-step guidance for building an Android app that runs
an open text LLM through the LiteRT-LM Kotlin API
(`com.google.ai.edge.litertlm`) on the CPU or the GPU. The model is one
`.litertlm` file. Images, audio, tool calling, and NPU backends aren't covered.
For vision and audio models with `.tflite` files, suggest the `litert-runtime`
skill.

When a LiteRT-LM class or method that this skill uses doesn't compile, you must
read the [LiteRT-LM Android guide](https://ai.google.dev/edge/litert-lm/android) and the [LiteRT-LM README](https://github.com/google-ai-edge/LiteRT-LM/blob/main/README.md) before
changing the code.

## Prerequisites

- A Kotlin Android project (the Android Studio Empty Activity template is enough). The `litertlm-android` 0.18.0 AAR declares `minSdk` 24.
- The dependency in the app-level `build.gradle.kts` file from Google Maven: `implementation("com.google.ai.edge.litertlm:litertlm-android:0.18.0")`. Google Maven lists the later releases.
- For the GPU backend, two `uses-native-library` entries inside `<application>` in `AndroidManifest.xml`. Add the `INTERNET` permission if the app downloads the model.
- The model file lives on the device's file system (hundreds of MB to a few GB), never in `assets/` or in the APK.

## Critical mandates

The rest: https://github.com/android/skills/blob/HEAD/device-ai/litert/litert-lm/SKILL.md
