What is Model Armor? Google Cloud's guardrails for AI prompts and responses

Model Armor is the Google Cloud service that screens prompts and model responses for prompt injection, unsafe content, malicious links and sensitive data. What it checks, how templates work, what it costs, and where it fits in an AI gateway.

Model Armor is a Google Cloud service that screens the text going into and coming out of an AI model. You send it a prompt before the model sees it, or a response before the user does, and it tells you whether it found something you would not want to pass on: a prompt injection attempt, unsafe content, a malicious link or sensitive data.

It is a guardrail, in the plain sense of the word, and is sometimes described as an AI firewall or LLM firewall for Google Cloud. It does not run your model and it does not sit in the request path by itself. Something has to call it, and what that something is turns out to be the main design decision.

What Model Armor checks

A screening request runs up to four kinds of filter.

Filter What it looks for
Prompt injection and jailbreak Text that tries to override the system prompt, extract hidden instructions or talk the model out of its rules
Responsible AI (content safety) Hate speech, harassment, sexually explicit and dangerous content
Malicious URLs Links to known phishing and malware sites, in prompts or in responses
Sensitive data Personal and secret data such as card numbers, national identifiers and credentials, using Sensitive Data Protection

Each filter can be switched on or off, and the first two take a confidence level. A low threshold catches more and flags more harmless text. A high threshold is quieter and misses more. Start in the middle and move it once you have seen real traffic.

For sensitive data there is a second choice: block the request, or redact the matching text and let the rest through. Redaction needs Sensitive Data Protection templates that say what to look for and how to replace it.

How Model Armor works

Settings live in a template. A template belongs to one Google Cloud project and one region, and it holds the filter configuration. A screening request names a template and carries the text to check.

There are two calls. One screens a user prompt, the other screens a model response. Both return a result per filter, with a match state and, for the graded filters, how confident the match was. Your code, or your gateway, decides what to do with that result.

Three practical details are worth knowing before you start.

  1. Templates are regional, and so is the endpoint. Calls go to a regional address of the form modelarmor.<region>.rep.googleapis.com. Put the template in the same region as the thing that calls it.
  2. The caller needs one role. roles/modelarmor.user on the project lets a service account screen text against a template.
  3. It is not reachable through Private Google Access. If you lock a workload's outbound traffic to your VPC, the regional endpoint needs its own private endpoint and DNS zone. We found this the hard way: with egress locked down and no private endpoint, every screening call timed out.

Model Armor pricing

On 5 December 2026 Google's price list put Model Armor at $0.10 per million tokens, after a free first 2 million tokens each month. Prompt and response tokens both count, because both are screened.

A request with 1,000 prompt tokens and 300 response tokens is 1,300 tokens to screen. That works out at about $130 per million requests. For most workloads that is small next to the cost of the model, but it scales with traffic, so it is worth a line in the budget. Prices change, so check the current list.

Where to call Model Armor from

You have two options.

From the application. Call Model Armor before and after each model call. This works, but every application has to do it, do it the same way, and handle the failure case. The failure case is the one that gets forgotten: if the screening call errors or times out, does the request go ahead? If the answer is yes, your guardrail disappears exactly when something is wrong.

From an AI gateway. Put a gateway between your applications and the models and have the gateway call Model Armor on every request. Applications cannot skip it, the setting lives in one place, and you decide once what happens on failure. The right answer is to fail closed: no screening result, no model call.

The second option is why Model Armor and AI gateways tend to be discussed together. The open-source LiteLLM gateway has a Model Armor integration built in, and it works on the free edition. We covered the configuration in LiteLLM guardrails with Model Armor.

What Model Armor does not do

  • It does not catch everything. It is a detector. Some attacks will get through, and some harmless prompts will be blocked. Plan for both: keep application-level defences, and have a way to tune the threshold.
  • It does not replace access control. A screened prompt can still ask an agent to do something it should not be able to do. Give tools the least privilege they need.
  • It does not make you compliant. It is a control you can point to, not a certification.
  • It adds a call. Each screened request waits for the check, once on the way in and once on the way out.

Trying Model Armor on GCP without writing the plumbing

If you want Model Armor in front of your models without building the integration, the AI gateway for Google Cloud is a free Terraform module that deploys LiteLLM on Cloud Run with a Model Armor template already wired in: every chat request is screened on the way in and out, failures are refused, and the private endpoint is created for you when you lock down egress. It runs in your own project and needs no Agent Ping account.

What is Model Armor?
Model Armor is a Google Cloud service that screens the text going into and coming out of an AI model. You send it a prompt or a model response and it reports whether it found a prompt injection or jailbreak attempt, unsafe content, a malicious link or sensitive data, so your application or gateway can block or redact it.
Does Model Armor only work with Gemini?
No. Model Armor screens text, and it does not matter which model the text is for. You can call it in front of Gemini, a partner model on Vertex AI or a model hosted somewhere else. What matters is that something in the request path calls it, which is usually an AI gateway.
What does Model Armor cost?
When we read Google's price list on 5 December 2026, Model Armor was $0.10 per million tokens after the first 2 million tokens each month. Prompts and responses both count. At 1,300 tokens a request, that is about $130 per million requests. Check the current price before you budget.
What is a Model Armor template?
A template is a saved set of filter settings: which checks are on, how confident a detection must be before it counts, and whether sensitive data is blocked or redacted. A template lives in one region, and each screening request names the template to apply.
Does Model Armor stop every prompt injection?
No. It is a detector, and detectors miss things and occasionally flag harmless text. It reduces risk substantially compared with no screening, but an agent that can take actions still needs least-privilege tools and should treat model output as untrusted.
How do I add Model Armor to an existing application?
Either call its API from your code before and after each model call, or put an AI gateway in front of your models and have the gateway call it. The gateway route covers every application at once and means no application can skip the check.