Gemini Decisions API Blocks Encoded Prompt Attacks

Gemini Decisions API screening encoded prompts before they reach an AI agent

The Gemini Decisions API can act as a fast gatekeeper against prompt injection that hides inside encoded or disguised text. A developer has put it in front of Google Cloud Model Armor on a chatbot called Chibi Dani, which answers questions about the developer’s posts, talks and projects, to catch what the filter let through.

The check returns a probability score in roughly 155 to 307 milliseconds and uses zero output tokens.

The gap in pattern-matching defenses

Many agent defenses block known phrases such as “ignore the previous instructions” or “system instructions.” Attackers get around them in two ways.

Obfuscation disguises the prompt with leetspeak, spaced-out letters, invisible spaces, lookalike characters from other alphabets or roundabout wording. Encoding rewrites it in another form, such as ROT13 or Base64.

Neither technique is bad on its own, and Base64 is everyday web plumbing. The trouble is mismatched generalization: modern models read Base64, ROT13 and leetspeak easily, while safety filters trained mostly on plain text miss the hidden meaning. A single filter can’t cover it, because obfuscation is open-ended and nobody can maintain decoders for every format, especially when attackers mix them.

Architecture diagram of Chibi Dani showing the request path from the danicat.dev blog UI through the Cloud Run Go HTTP perimeter and Genkit Go runner to the Gemini Decisions API pre-filter, Google Cloud Model Armor, Gemini 3.5 Flash Lite, an in-memory blog corpus, and Cloud Firestore and Cloud Trace
Image: danicat.dev

What got through

Chibi Dani sits behind Model Armor, which doesn’t decode Base64, hex, URL encoding or ciphertext. The pre-release v4 engine still catches some encoded prompts. It blocked a plain-text request for the bot’s system instructions in 103 ms, and the Base64 version in 178 ms.

Logs from the first days showed a user asking Chibi to reverse a linked list in Python, sending the request in Base64 and then, 16 seconds later, in ROT13. Both decode to a request to ignore the blog topic and write the function. Model Armor blocked neither, and both reached Gemini after 1,533 ms and 1,368 ms. The system prompt, the last layer of defense, steered the replies back to the developer’s published articles, yet the filter had missed them at the door.

How the Gemini Decisions API works

The API runs on gemini-decision-1, a model built for classification and scoring rather than text generation. Think of it as fast, automatic judgment instead of step-by-step reasoning. It reads an input once and scores up to 1,000 questions in parallel. Inputs can be text, images, audio, video or PDFs, up to 262,144 tokens.

It supports three question types:

  • noul: a yes-or-no question that returns a calibrated probability between 0.01 and 0.99.
  • choice: picks one label from a list.
  • score: rates an input on an ordered scale.

Calibration means a cutoff of 0.70 behaves consistently across prompts. Each question runs in isolation, so every rule must live inside its own instructions and criteria. The model is available only on the Gemini Developer API (v1beta), not Gemini Enterprise.

Two questions per call

Blocking every mention of Base64 would break a developer-focused chatbot, where users ask how it works in Go. So the middleware asks two separate yes-or-no questions in one call: whether the message contains encoded text, and whether it uses obfuscation. Each has explicit true and false criteria that exempt ordinary URLs and conceptual questions.

The scores at a 0.70 cutoff were clear. The plain-text override scored 0.01 and passed on to Model Armor, while its Base64 version scored 0.97 and the ROT13 version 0.98. Spaced letters (0.26), invisible spaces (0.10) and Cyrillic lookalikes (0.11) scored low on the encoding question, yet the obfuscation question returned 0.93 to 0.98 for them. Pairing the two catches both.

Appending ROT13 fragments to a normal Go question showed the boundary: one garbled word reads as a typo, but two encoded words together trigger the block.

Wiring it into Genkit Go

The check is a Genkit Go middleware placed after telemetry and ahead of Model Armor. A prompt at or above the cutoff stops there, so Model Armor never parses mixed ROT13 and Gemini never sees it. The same check also screens tool responses and withholds streamed chunks until the finished reply clears.

It fails closed. A missing API key stops the service from starting, and any network error, timeout or invalid score cancels the turn. Blocked turns are logged separately from Model Armor.

The trade-off and what comes next

Holding back chunks means visitors wait for the full reply instead of watching it stream. For a chatbot with short answers, that is a fair price for guaranteeing that unscreened output never leaves the server.

The pattern reaches beyond Base64 and ROT13. Generative models can handle open-ended reasoning while a decision model answers fast yes-or-no checks on prompts, tool results and replies. Teams running agents with Model Armor or similar filters can test the Gemini Decisions API as an outer gate.

Source: danicat.dev

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.