litert-runtime

litert-runtime is a skill for Claude Code from android/skills. It costs 150 tokens per session (6,402 once invoked), scanned A, original, Apache-2.0.

Guidance for adding LiteRT, Google's on-device machine-learning runtime, to an Android app written in Kotlin. It shows how to run .tflite model files on the phone's CPU or GPU with the newer CompiledModel API.

In plain words
What is it for?
Use it to add image classification, vision, audio, or embedding models to an Android app, and to configure CPU or GPU inference.
Why use it?
It removes guesswork around Gradle dependencies, model inputs, image or audio preparation, and reusing data buffers. It also helps avoid using the older Android API that this guidance does not support.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the android-skills plugin — 42 skills shipped together

Good fit Use it to add image classification, vision, audio, or embedding models to an Android app, and to configure CPU or GPU inference.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/android/skills/litert-runtime
About the project

Android skills is a collection of modular instructions and resources that help AI agents handle specialized Android development tasks. Android developers use it to guide coding agents toward Android-specific workflows, and the catalogue lists some of its skills and plugin.

android/skills · 10,809 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add android/skills --skill litert-runtime
Clone the repo
git clone --depth 1 https://github.com/android/skills

Made for: Claude Code.

Or install android-skills, the plugin that ships this one along with the rest of its 42 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for litert-runtime

README.md
[![agentmods](https://agentmods.dev/badge/skills/android/skills/litert-runtime/github.svg)](https://agentmods.dev/skills/android/skills/litert-runtime)
Your own site
<a href="https://agentmods.dev/skills/android/skills/litert-runtime"><img src="https://agentmods.dev/badge/skills/android/skills/litert-runtime/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for litert-runtime

Your own site · 80×15
<a href="https://agentmods.dev/skills/android/skills/litert-runtime"><img src="https://agentmods.dev/badge/skills/android/skills/litert-runtime.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 150 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,402 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 17 Nov 2026
  • Snyk pass 24 Nov 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00150 $0.06402
Opus 5.5 $0.00060 $0.02561
Sonnet 5.5 $0.00030 $0.01280
Haiku 4.5 $0.00015 $0.00640

Measured 6d ago against content hash c52878f64b13, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

litert-runtime scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

device-ai/litert/litert-runtime/SKILL.md · 464 lines

How it starts

The opening of the file, as written. The whole thing — 464 lines — stays where its author put it; the contents beside it link to each section on GitHub.

This skill provides step-by-step guidance for building an Android app that runs a .tflite model with the LiteRT CompiledModel API (com.google.ai.edge.litert:litert 2.x; source repository) on the CPU or the GPU, with the runtime bundled in the APK or from Google Play services. Don't use the deprecated org.tensorflow.lite.Interpreter API. For open text language models using .litertlm files, suggest the litert-lm skill.

Prerequisites

  • A Kotlin Android project (minSdk must be 24 or higher, as declared by the LiteRT 2.3.0 AARs).
  • The runtime that Step 1 picks: the Google Play services runtime (com.google.android.gms:play-services-litert, the default; see LiteRT in Google Play services), or the bundled runtime (implementation("com.google.ai.edge.litert:litert:2.3.0") and implementation("com.google.ai.edge.litert:litert-gpu:2.3.0") from Google Maven). For the bundled runtime, from 2.3.0 the GPU accelerator is the second artifact: with litert alone the app builds, and CompiledModel.create with CompiledModel.Options(Accelerator.GPU) throws LiteRtException because the APK has no GPU accelerator library. With CompiledModel.Options(Accelerator.GPU, Accelerator.CPU) it doesn't throw: the model runs on the CPU while the app reports the GPU, and only Logcat shows it (GPU accelerator could not be loaded and registered). No manifest entry is needed: litert-api, which litert depends on, declares the OpenCL driver libraries (uses-native-library) in its own manifest.
  • A verified .tflite model and its input contract (input dimensions, mean, standard deviation, channel order, and tensor layout). For models with a verified recipe, inspect the LiteRT model recipes.

Critical mandates

  • Single-thread confinement : One single-thread executor or confined coroutine dispatcher must own the CompiledModel instance. Creation, inference, and closing must execute on that same background thread, never on the main thread.
  • Buffer lifecycle : Allocate TensorBuffer instances once using createInputBuffers and createOutputBuffers, reuse them across inferences, and close all input and output buffers before closing the CompiledModel.
  • Synchronous timing : model.run enqueues work on the GPU and returns before GPU execution completes. Always measure model.run and output buffer readback (outputs[0].readFloat) together.
  • Warm-up and exception safety : Execute one warm-up inference inside the helper constructor's init block so first-run GPU shader compilation doesn't block the first user interaction, and call close in catch before rethrowing so neither CompiledModel nor TensorBuffer handles leak if buffer allocation or warm-up throws.
  • Runtime choice : Before Step 1, you must read LiteRT in Google Play services and choose the runtime. Use the Google Play services runtime unless the app needs the NPU, custom operators, or a Support library class that this skill can't replace (such as MetadataExtractor), or also targets devices without Google Play services. Never put both runtimes in the same build variant.
  • Migration : When the app already uses org.tensorflow.lite code, you must read the "Migrating from legacy TFLite Interpreter" section in full before you edit any file. Migrated code must not import any org.tensorflow.lite class (including DataType), every legacy GPU choice (GpuDelegate, or the Support library's Model.Device.GPU) becomes CompiledModel.Options(Accelerator.GPU, Accelerator.CPU), and an NNAPI choice maps to that same GPU option.

Read the full file on GitHub · 464 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago Changed c52878f64b13
  2. 14d ago Changed · +13 lines a65695279b46
  3. 1mo ago Changed · +24 lines 4a61b022a5b9
  4. 1mo ago Changed · +57 lines 2eb7aa866712
  5. 1mo ago Changed · +23 tokens per session 525348ed6226
  6. 1mo ago Changed · +11 lines f6807c2a5c07
  7. 1mo ago First seen · 359 lines · 127 tokens per session scan A bbccfb836f66

Subscribe to this mod's changes

litert-runtime is a skill published in the GitHub repository android/skills (10,809 stars, last pushed 7d ago), licensed Apache-2.0. It adds 150 tokens to every session and 6,402 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-15.

Related

litert-runtime compared with skills from other repositories

litert-runtime next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
litert-runtimeandroid/skillsSkill11k7d agoApache-2.0A150Claude Code
litert-google-tensorgoogle/skillsSkill25ktodayApache-2.0C259Claude Code, Codex
deploy-edge-ai-modelpjt222/agent-almanacSkill462d agoMITA108Claude Code
apple-on-device-aiThe-Artificer-of-Ciphers-LLC/skills-from-the-artificerSkill73d agoMITA127Claude Code, Codex
foundation-models-on-devicex-cmd/skillSkill264mo agoApache-2.0A38Claude Code, Codex
foundation-models-on-devicemajiang213/OpenClaw-MASSkill57mo agoMITA38Claude Code, Codex
agent-platform-tuninggoogle/skillsSkill25ktodayApache-2.0A64Claude Code, Codex