litert-runtime

litert-runtime is a skill for Claude Code from android/skills. It costs 127 tokens per session (4,477 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 — 30 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 · 7,842 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 30 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 127 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,477 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.
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.00127 $0.04477
Opus 5.5 $0.00051 $0.01791
Sonnet 5.5 $0.00025 $0.00895
Haiku 4.5 $0.00013 $0.00448

Measured yesterday against content hash bbccfb836f66, 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 yesterday.

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.

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

How it starts

The opening of the file, as written. The whole thing — 359 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. 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 dependencies in the app-level build.gradle.kts file from Google Maven: implementation("com.google.ai.edge.litert:litert:2.3.0") and implementation("com.google.ai.edge.litert:litert-gpu:2.3.0"). From 2.3.0 the GPU accelerator is the second artifact: with litert alone the app builds, and CompiledModel.create with Accelerator.GPU throws LiteRtException because the APK has no GPU accelerator library (Logcat logs 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.

Read the full file on GitHub · 359 lines

Files

What ships with it

2 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. yesterday 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 (7,842 stars, last pushed 2d ago), licensed Apache-2.0. It adds 127 tokens to every session and 4,477 once invoked, about $0.0005 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

Other skills, from other repositories

deploy-edge-ai-model

Deploy machine learning models to edge devices using Google AI Edge Gallery, TensorFlow Lite, ONNX Runtime, and MediaPipe. Covers model quantization (INT8/INT4), on-device inference with Gemma 4 models, Android/iOS deployment via AI Edge Gallery, hardware delegate selection (GPU/NPU/DSP), and performance benchmarking…

pjt222/agent-almanac · 108 tokens

apple-on-device-ai

Integrate on-device AI using Foundation Models framework, Core ML, and open-source LLM runtimes on Apple Silicon. Covers Foundation Models (LanguageModelSession, @Generable, @Guide, SystemLanguageModel, structured output, tool calling), Core ML (coremltools, model conversion, quantization, palettization, pruning…

The-Artificer-of-Ciphers-LLC/skills-from-the-artificer · 127 tokens

foundation-models-on-device

Apple FoundationModels framework for on-device LLM — text generation, guided generation with @Generable, tool calling, and snapshot streaming in iOS 26+.

x-cmd/skill · 38 tokens

foundation-models-on-device

Apple FoundationModels framework for on-device LLM — text generation, guided generation with @Generable, tool calling, and snapshot streaming in iOS 26+.

majiang213/OpenClaw-MAS · 38 tokens

agent-platform-model-registry

Agent Platform Model Registry Management. Use when you need to upload, list, describe, update, or delete machine learning models (and their versions) in the Agent Platform Model Registry. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform models.

google/skills · 60 tokens

developer-device-platform-basics

Provides guidance and instructions on managing remote devices on Developer Device Platform (DDP). Use when reserving remote Android devices, establishing connection tunnels, checking session status, or extending/cancelling leases. Don't use for iOS or local device/hardware inquiries.

google/skills · 57 tokens