litert-runtime

litert-runtime is a skill for Claude Code, Codex from google-ai-edge/litert-samples. It costs 88 tokens per session (2,421 once invoked), scanned A, original, Apache-2.0.

A guide for adding on-device machine-learning inference to an Android app with LiteRT and Kotlin. LiteRT runs a .tflite model, a packaged machine-learning model, on the phone's CPU or GPU.

In plain words
What is it for?
It helps build Android apps around vision, audio, or embedding models, or add such inference to an existing app.
Why use it?
It explains the required dependency, model placement, and inference code without relying on the developer to assemble those steps.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps build Android apps around vision, audio, or embedding models, or add such inference to an existing app.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/google-ai-edge/litert-samples/litert-runtime
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 google-ai-edge/litert-samples --skill litert-runtime
Clone the repo
git clone --depth 1 https://github.com/google-ai-edge/litert-samples

Made for: Claude Code, Codex.

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/google-ai-edge/litert-samples/litert-runtime/github.svg)](https://agentmods.dev/skills/google-ai-edge/litert-samples/litert-runtime)
Your own site
<a href="https://agentmods.dev/skills/google-ai-edge/litert-samples/litert-runtime"><img src="https://agentmods.dev/badge/skills/google-ai-edge/litert-samples/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/google-ai-edge/litert-samples/litert-runtime"><img src="https://agentmods.dev/badge/skills/google-ai-edge/litert-samples/litert-runtime.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,421 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.00088 $0.02421
Opus 5.5 $0.00035 $0.00968
Sonnet 5.5 $0.00018 $0.00484
Haiku 4.5 $0.00009 $0.00242

Measured 7d ago against content hash c172a36ce0b7, 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 7d 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.

skills/litert-runtime/SKILL.md · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 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; overview: https://ai.google.dev/edge/litert/android, sources: https://github.com/google-ai-edge/litert/blob/main/README.md) on the CPU or the GPU. The Interpreter API is not covered. For language models, use the litert-lm skill: https://github.com/google-ai-edge/litert-samples/blob/main/skills/litert-lm/SKILL.md (LiteRT-LM: https://github.com/google-ai-edge/LiteRT-LM/blob/main/README.md).

Prerequisites

  • A Kotlin Android project (Android Studio's Empty Activity template is enough). The LiteRT 2.3.0 AARs declare minSdk 24.
  • The dependencies in the app-level build.gradle.kts, 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: 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 .tflite model and its input requirements (input size, mean/std, channel order). Models with a LiteRT recipe: https://github.com/google-ai-edge/litert-samples/blob/main/models/README.md

Detailed steps

1. Set up the project and place the model

In the app-level build.gradle.kts, set minSdk = 24 in defaultConfig. Put the model at app/src/main/assets/model.tflite (AGP stores .tflite files uncompressed by default). A model too large for the APK is delivered by Play for On-device AI (beta) as an AI pack, or downloaded by the app into context.filesDir: https://developer.android.com/google/play/on-device-ai (its bundletool --local-testing installs the packs without the store). An install-time AI pack is read through the AssetManager, as that page shows. A fast-follow or on-demand pack and a downloaded file are loaded from their path with CompiledModel.create(filePath, CompiledModel.Options(accelerator), environment) in place of the asset call in step 2. The pack's directory comes from the AI Delivery library (com.google.android.play:ai-delivery): AiPackManagerFactory.getInstance(context).getPackLocation(name)?.assetsPath(), null until the pack has downloaded.

Read the full file on GitHub · 132 lines

Files

What ships with it

3 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. 7d ago Changed c172a36ce0b7
  2. 9d ago Changed · -2 lines d1582f7b9180
  3. 15d ago First seen · 134 lines · 88 tokens per session scan A cde47091a5ed

Subscribe to this mod's changes

litert-runtime is a skill published in the GitHub repository google-ai-edge/litert-samples (464 stars, last pushed yesterday), licensed Apache-2.0. It adds 88 tokens to every session and 2,421 once invoked, about $0.0004 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-02.

Related

Other skills, from other repositories

ml-kit-genai-prompt-api

Analyzes Android codebases to implement ML Kit GenAI Prompt API. Use this skill to send natural language requests on-device to Gemini Nano, use structured output with Prompt API, implement prefix caching, optimize the current prompt, or apply best practices.".

android/skills · 57 tokens

model-authoring

Empirical rules for authoring PyTorch models for on-device execution on Apple platforms, covering energy-efficient inference, scalable compute, and correctness testing. Use this skill whenever the user is writing, debugging, or reviewing PyTorch model code intended for on-device execution — even if they don't…

apple/coreai-models · 95 tokens

working-with-coreai

Use this skill whenever the user mentions coreai-torch, TorchConverter, coreai-build, AIModel, AIProgram, .aimodel, or wants to export/compile/run a PyTorch model on Apple silicon (iPhone, iPad, Mac). Also triggers for "deploy on device", "optimize for on-device performance", onboarding new models to Core AI, or…

apple/coreai-models · 91 tokens

adversarial-ml-evasion

Craft adversarial examples that cause trained ML classifiers to misclassify at inference time — image recognition, malware detectors, IDS, spam filters.

PurpleAILAB/Decepticon · 36 tokens

misinformation

Hunt LLM misinformation / overreliance (OWASP LLM09:2025) — confident-but-wrong outputs that flow into downstream automated decisions, compliance reports, customer communications, or autonomous code commits without verification.

PurpleAILAB/Decepticon · 49 tokens

vector-and-embedding-weaknesses

Hunt vector / embedding weaknesses (OWASP LLM08:2025) — adversarial inputs against the RAG / similarity layer that cause cross-tenant leak, embedding-inversion privacy loss, semantic confusion, and retriever-driven prompt injection.

PurpleAILAB/Decepticon · 59 tokens