ml-kit-genai-prompt-api

ml-kit-genai-prompt-api is a skill for Claude Code from ArisGuimera/MobiAI-Core. It costs 57 tokens per session (972 once invoked), scanned A, a copy of ml-kit-genai-prompt-api, MIT.

An Android integration guide for ML Kit GenAI Prompt API, which sends natural-language requests to Gemini Nano on the device. It covers structured results, prompt optimization, and reuse of repeated prompt text.

In plain words
What is it for?
Use it to add local text-generation or extraction features to an Android app and optimize prompts longer than 200 words.
Why use it?
It helps an app check that the on-device model is ready, avoid inefficient repeated prompt work, and release model resources correctly.

Skill for Claude Code

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

Part of the android plugin — 35 skills shipped together

Good fit Use it to add local text-generation or extraction features to an Android app and optimize prompts longer than 200 words.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/arisguimera/mobiai-core/ml-kit-genai-prompt-api
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 ArisGuimera/MobiAI-Core --skill ml-kit-genai-prompt-api
Clone the repo
git clone --depth 1 https://github.com/ArisGuimera/MobiAI-Core

Made for: Claude Code.

Or install android, the plugin that ships this one along with the rest of its 35 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 ml-kit-genai-prompt-api

README.md
[![agentmods](https://agentmods.dev/badge/skills/arisguimera/mobiai-core/ml-kit-genai-prompt-api/github.svg)](https://agentmods.dev/skills/arisguimera/mobiai-core/ml-kit-genai-prompt-api)
Your own site
<a href="https://agentmods.dev/skills/arisguimera/mobiai-core/ml-kit-genai-prompt-api"><img src="https://agentmods.dev/badge/skills/arisguimera/mobiai-core/ml-kit-genai-prompt-api/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 ml-kit-genai-prompt-api

Your own site · 80×15
<a href="https://agentmods.dev/skills/arisguimera/mobiai-core/ml-kit-genai-prompt-api"><img src="https://agentmods.dev/badge/skills/arisguimera/mobiai-core/ml-kit-genai-prompt-api.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 972 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 100% copy Near-identical to another mod 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.00057 $0.00972
Opus 5.5 $0.00023 $0.00389
Sonnet 5.5 $0.00011 $0.00194
Haiku 4.5 $0.00006 $0.00097

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

Security

Grade A, and why

ml-kit-genai-prompt-api 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.

Origin

This is a copy

100% identical to ml-kit-genai-prompt-api — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/android/skills/google/ml-kit-genai-prompt-api/SKILL.md · 122 lines

How it starts

The opening of the file, as written. The whole thing — 122 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 integrating and optimizing the ML Kit GenAI Prompt API in Android apps.

Prerequisites

  • Android API level must be 26 or higher. If minSdk is below 26, update it to 26.
  • Add the ML Kit GenAI Prompt API dependency (com.google.mlkit:genai-prompt) to the app-level build.gradle file, with version at least 1.0.0-beta4.
  • If com.google.mlkit:genai-schema-compiler dependency is used and KSP plugin version is below 2.3.6, update it to 2.3.6.

Detailed steps

1. Prompt optimization

To optimize prompts for use with the ML Kit Prompt API, follow the prompt optimization guide.

2. Prefix caching optimization

If the prompt is more than 200 words, implement the prefix caching API.

3. Lifecycle and best practices

  • The model must be fully downloaded and available before calling the first inference. Follow the guide on implementing a generative model to check that the FeatureStatus of a model is AVAILABLE before making an inference.

  • Release ML Kit instances by calling close() when an Activity, Fragment, or ViewModel is destroyed. Example:

    // Instantiating model in activity, fragment, or ViewModel
        val generativeModel = Generation.getClient()
    
    // When activity, fragment, or ViewModel is destroyed
        generativeModel.close()
    

4. Structured output

When implementing or refactoring a prompt to use structured output, follow these rules:

  1. Check for API availability: Verify Structured Output feature is available on the device with isStructuredOutputFeatureAvailable() before using it. Refer to the Structured Output API guide for full instructions.
  2. Return type: Return the @Generable typed object from the function signature instead of a String or JSON string.

Read the full file on GitHub · 122 lines

Files

What ships with it

6 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 · 122 lines · 57 tokens per session scan A a8ff20f65d0b

Subscribe to this mod's changes

ml-kit-genai-prompt-api is a skill published in the GitHub repository ArisGuimera/MobiAI-Core (489 stars, last pushed yesterday), licensed MIT. It adds 57 tokens to every session and 972 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to ml-kit-genai-prompt-api, differing in 0 lines, and is treated as a copy.

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

axiom-ai

Use when implementing, testing, or evaluating ANY Apple Intelligence, on-device AI, or speech-to-text feature. Covers Foundation Models, @Generable, LanguageModelSession, Tool protocol, eval suites, model-as-judge scoring, SpeechTranscriber, CoreML.

CharlesWiltgen/Axiom · 57 tokens

firebase-ai

Use when setting up firebaseai, generating text/chat with Gemini, streaming AI output, building multimodal prompts, or handling AI errors.

evanca/flutter-ai-rules · 30 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+.

loulanyue/awesome-claude-notes · 38 tokens

firebase-ai-logic

Use for Firebase AI Logic and Gemini integration in Android, safe prompts, privacy boundaries, model selection, fallback behavior and not exposing private keys.

GDvega/super-android-kotlin-firebase-skill · 33 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+. Use when adding on-device LLM features with Apple FoundationModels on iOS 26+.

unrealandychan/clean-code-skill · 56 tokens