Gemini Nano 4 Is in Preview. Your Prompt Budget Still Has to Fit.

Google's on-device model for Android is free to call and runs without a network round trip. The limits are in the docs: input must be under 4,000 tokens, and Google asks developers to avoid output over about 4,000 tokens. Nano 4 is now in developer preview, and it does not remove either limit. If your feature sends a long document or a long chat history, the limit arrives before your users notice a slow screen.
This article covers what Google's documentation says, what changed at I/O 2026, and how to budget a prompt before you call it.
How to read it: the Prompt API limits come from Google's page "Get started with Prompt API" (developers.google.com/ml-kit/genai/prompt/android/get-started), read on October 19, 2026. The I/O 2026 changes come from Google's post "Top AI on Android updates for building intelligent experiences" (May 26, 2026). The budget example uses sizes I assumed, and the code is a sketch I have not compiled or run on a device.
The numbers Google gives
- Input. "Input must be under 4000 tokens (or approximately 3000 English words)."
- Output. The page gives no hard number. It says: "Use cases that require long output (more than 4K tokens) should be avoided."
- Output cap you set.
maxOutputTokens"defines the maximum number of tokens that can be generated in the response." The page gives no default or range. - Counting. The page points to a
countTokensreference for measuring input.
The page does not say what a token is for this model, or what happens when input reaches the limit. Measure your own strings instead of relying on a characters-per-token rule.
What the device needs
- Android API level 26 or higher.
- Not an unlocked bootloader. The page says the API "is not supported on devices with an unlocked bootloader."
- AICore. Gemini Nano runs in Android's AICore system service, which also manages downloads and updates. The Prompt API page lists model states that your app must handle: AVAILABLE, DOWNLOADABLE, DOWNLOADING and UNAVAILABLE. A model that is not ready yet is a normal state.
- Per-app quota. "AICore enforces an inference quota per app." The page gives no numbers, so you cannot plan for a specific request count.
What changed at I/O 2026
Google's I/O post adds three things, and each has a status you should check before you build on it:
- Gemini Nano 4 is in developer preview. Google says developers "can already preview and prototype" with Nano 4 through the AICore developer preview. It is "launching in flagship devices later this year." The post names no devices and no date.
- Prefix caching. The post says it "reduces inference time by storing and reusing the intermediate LLM state of processing a shared and recurring part of the prompt." The Prompt API docs list prefix caching as Experimental. It helps most when many requests share a long system prompt.
- Structured Output. Google calls it "upcoming," with no date. The Prompt API docs label "Generate structured output" as Alpha.
The same post names Firebase AI Logic's hybrid inference as a way to route between on-device and cloud models. Its modes include PREFER_ON_DEVICE and ONLY_ON_DEVICE. The post does not say whether the modes are stable.
The docs also mark "Prompt," "Set system instructions" and "Use thinking mode" as Beta. Build your launch plan around the parts that are stable, and check the labels before each release.
A budget for a prompt
These sizes are my assumptions, chosen to show the shape, not measurements:
- System instructions: 300 tokens.
- A user message with a pasted article: 2,400 tokens.
- Room for the reply: 800 tokens, set with
maxOutputTokens.
That leaves about 500 tokens of margin under the 4,000-token input limit. A second turn with a long history can exceed it. The planning rule is simple: count the prompt before the call. If it does not fit, shorten the input, summarize older turns, or split the task.
// Sketch, not compiled. Check the current ML Kit Prompt API reference for exact names.
val inputTokens = /* count with the countTokens reference */
if (inputTokens >= 4000) {
// trim the oldest turns, summarize the document, or split the task
}
A fallback when the model is not there
A feature that depends on the model must still work when the model is unavailable, unsupported or still downloading. Google's options are:
- Show a plain state. Tell the user the feature is preparing, and keep the rest of the app usable.
- Route to cloud. Firebase AI Logic's hybrid inference can send requests to a cloud Gemini model when Nano is unavailable. Check the current mode names and status in its docs before you ship.
- Turn the feature off. For a feature that needs on-device data, that may be the right answer.
Pick one before launch, not after the first crash report.
What I would do
This section is my opinion, not Google's.
- Count before you call. Do not learn the input was too long from an error.
- Keep history short. Summarize older turns rather than sending the whole conversation.
- Set
maxOutputTokens. Keep replies inside the output budget the page recommends. - Handle the model states. A DOWNLOADABLE or DOWNLOADING model is normal, not a crash.
- Measure prefix caching yourself. It is Experimental, and Google gives no number for the gain.
- Test on a range of devices. Quota, availability and warmup vary, and Google gives no figures for them.
What I could not verify
- Exact token counts. I did not run
countTokenson real strings, so I cannot say how many tokens a given paragraph is. - Output behavior past the limit. The page advises against long output but gives no hard number and no error behavior.
- Quota numbers. The page says there is a per-app quota and gives no figures.
- Nano 4 devices. Two sources I checked list different phones, and neither list is on a Google page I could read. I have not named any device.
- Prefix caching gains and Structured Output dates. Google gives no numbers or dates.
Sources, accessed October 19, 2026: Google for Developers, "Get started with Prompt API" (ML Kit GenAI), developers.google.com/ml-kit/genai/prompt/android/get-started; Google for Developers Android Blog, "Top AI on Android updates for building intelligent experiences" (May 26, 2026), developer.android.com/blog/posts/top-ai-on-android-updates-for-building-intelligent-experiences-from-google-i-o-26; Android Developers, "Gemini Nano" AICore overview (last updated October 8, 2026), developer.android.com/ml/aicore.
If your Android feature needs a 10-page document in one prompt, what does it do on a device where Gemini Nano is still downloading?
Work with me: I take 1:1 calls on mobile architecture reviews, mobile and AI questions, and startup tech consults. Book a slot on Topmate: topmate.io/sairamkotha
Comments
Join the discussionNo comments yet. Be the first to comment.




