EUrouter

Prompt-Injection Protection

Flag or block requests that contain known prompt-injection phrasings, before any provider sees them. What it checks, what it misses, and how to switch it on.

OpenAPI JSON

What it does

A prompt injection is text that tries to take over the model: "ignore all previous instructions", "reveal your system prompt", a fake system turn pasted into a document. It often arrives through content your application did not write, such as a web page a tool fetched or a PDF a user uploaded.

EUrouter can check the untrusted parts of every request for known injection phrasings before the request is routed to a provider. The phrasing check runs inside EUrouter, in the EU, with no model and no outside service. An optional AI check by Mistral also sends the same text to Mistral AI in the EU. EUrouter keeps no text it reads, only the result. Your request still goes everywhere it would go without the check, including a Broadcast destination you set up.


The three settings

SettingWhat happens
OffThe default. The request text is not read.
FlagThe request is served unchanged, and EUrouter records the finding. Start here.
BlockThe request is refused with a 403 before any model provider is called. Nothing is charged for the model.

Start with Flag for a while and look at what it finds before you switch to Block. Findings show in the response headers of non-streaming requests, so if your app streams, send a few representative prompts without streaming to see them. The check looks for known phrasings, so a legitimate prompt that quotes an attack (a security training text, for example) is flagged too.

To see what the check finds before you choose, paste a sample text into Test a text under Guardrails → Prompt injection. Every member can use it. Nothing you paste is stored or sent to a model.


Switch it on

For your organization

An organization owner or admin sets the rule every key must follow in the dashboard under Guardrails → Prompt injection, on the Organization tab, or with the organization policy endpoint and an organization-wide management key:

The update replaces the whole organization policy, so read the current policy first and send it back with the new field. This keeps your other rules, such as allowed providers and deny_training:

policy=$(curl -sf https://api.eurouter.ai/api/v1/settings/policy \
  -H "Authorization: Bearer $EUROUTER_MANAGEMENT_KEY" \
  | jq -e '.data.policy | objects | . + { "prompt_injection": "flag" }') \
  && curl --fail-with-body -X PUT https://api.eurouter.ai/api/v1/settings/policy \
    -H "Authorization: Bearer $EUROUTER_MANAGEMENT_KEY" \
    -H "Content-Type: application/json" \
    -d "$policy"

If the read fails, the update does not run, so a failed read never clears your other rules. If the update is refused, for example because the key cannot write policies, the command exits with an error and prints the reason. Send "block" to refuse matching requests. To remove the organization rule, send the policy back without prompt_injection.

For a workspace or a member

An owner or admin can also set a rule for one workspace or one member, on the Workspace and Member tabs. A workspace rule applies to every request made in that workspace, with any key. A member rule applies to every key the member owns and to their own requests from the dashboard. Both can only be stricter than your organization's rule: weaker choices are locked, and the API refuses them with a 400 that names the field. With an organization-wide management key, use the workspace and member guardrails endpoints, PUT /api/v1/settings/policy/workspaces/{workspaceId} and PUT /api/v1/settings/policy/members/{userId}. Members can see these rules but not change them.

A request gets the strictest rule of every level that applies to it: the organization, its workspace, its member, its key and the request itself.

For one key

A key can have its own rule, stricter than every level above it. On the API keys page, open the key's menu, choose Edit key, and in the panel that opens choose Off, Flag or Block under Prompt injection. Owners and admins can set it for every key; a member can set it for their own keys. Choices weaker than your organization's rule are locked. The Key tab under Guardrails → Prompt injection lists every key with a rule of its own and lets you set one, and the Guardrails column on the API keys page shows it too.


AI check by Mistral

The phrasing check finds only known phrasings, so role play and paraphrases mostly get through. The AI check adds a second opinion: EUrouter sends the text it checks to Mistral AI's moderation model, and a text the model marks as a jailbreak attempt counts as one more finding, under the technique ai_jailbreak. Under Flag the request is served and the finding recorded. Under Block the request is refused with the same 403 as a phrasing finding, before any model provider is called.

  • It runs only with Flag or Block. While prompt injection is off, nothing is sent to Mistral AI.
  • It reads the same text as the phrasing check: user messages, tool results and text EUrouter extracts from files. Never your system or developer prompt, and never assistant turns.
  • The text goes to Mistral AI in the EU and is not stored or used for training there. EUrouter's Mistral AI account is set to zero data retention and no training. EUrouter itself keeps only the result.
  • Long texts are checked in overlapping pieces of up to 8,000 characters, so making a text longer does not let it skip the check.
  • It reads up to 1,000,000 characters per request, the same limit as the phrasing check, shared by the messages and the files in that request. Text past the limit is not sent to Mistral AI, and the request records the reason prompt_injection.scan_limit.
  • It does not run when the phrasing check already blocked the request.

To switch it on for your organization, an owner or admin turns on AI check by Mistral under Guardrails → Prompt injection, or adds "prompt_injection_ai": true to the organization policy next to prompt_injection, the same way as in the example above. A key's own rule can also switch it on for that key, with the AI check by Mistral switch in the key's Edit key panel. A key cannot switch it off while your organization has it on: it then stays on for every key.

Price

The AI check costs EUR 0.20 per million tokens checked, paid from your credits. On a paid plan the first 10,000 checks of each calendar month (UTC) are free; after that, checks keep running and are billed. On the Free plan every check is billed from the first one. One request is one check, however many of its texts and files are sent to Mistral AI. A request the AI check blocks still pays for the check. When a check would be billed and your credit cannot cover it, the whole request is refused with the usual 402 for an insufficient balance, before anything is sent to Mistral AI.

Each request's AI check shows in the request log as its own cost line, and the Activity page shows the checks, free checks and cost of the month for owners and admins.

When the AI check cannot run

  • Mistral AI is unavailable. If Mistral AI does not answer within 1.5 seconds, answers with an error, or sends an answer EUrouter cannot read, the request is served on the result of the phrasing check, also under Block. The request log records ai_check_unavailable, and the check is not billed.
  • Your policy rules out Mistral AI. If your organization, key or request rules out the provider mistral with denied or allowed providers, or limits the countries your data may be processed in, EUrouter sends nothing to Mistral AI. Mistral AI's EU platform does not name a single country, so the same rule already applies to Mistral AI's models. The same goes for another rule its moderation endpoint does not meet, such as required certifications. The phrasing check still runs, and the request log records ai_check_not_allowed.

What is checked

The check reads the text that did not come from you:

  • User messages on chat completions, responses, completions and messages.
  • Tool results: tool and function messages on chat completions, tool_result blocks on messages, and on responses the output and error text of every tool item, including what a shell call wrote to standard output and standard error.
  • Text EUrouter extracts from files, such as a PDF it turns into text for the model. With OCR the text is checked after the OCR step, so the OCR pages already read are charged even when the request is then blocked.

Within one message, its text parts are checked together, so a phrasing split over two parts is still found.

What is not checked

  • Your system and developer prompts, and assistant turns. They are your own text.
  • Images, audio and video, including images inside tool results.
  • Files a provider reads itself, when EUrouter sends the file unchanged.
  • Token-id prompts on completions.
  • Embeddings, rerank and audio endpoints.

When a request is blocked

A blocked request gets a 403. The message names the kind of phrasing it found, never the text itself:

{
  "error": {
    "code": 403,
    "message": "Blocked by your organization's rule: the request contains a known prompt-injection phrasing (instruction_override). Remove it and send the request again.",
    "type": "permission_error",
    "param": null,
    "details": {
      "reason": "prompt_injection.blocked",
      "reasons": [
        {
          "code": "prompt_injection.blocked",
          "layer": "org",
          "detail": { "prompt_injection_count": 1, "prompt_injection_techniques": ["instruction_override"] }
        }
      ]
    }
  }
}

A streaming request is refused the same way, before the stream opens.

TechniqueWhat it catches
instruction_override"Ignore", "forget" or "disregard" your previous instructions
prompt_extractionAsking the model to reveal or print its system prompt
role_switchTelling the model it is now in developer or DAN mode, or has no rules
fake_turnChat-template markers such as <|im_start|> or [INST] that fake a system or assistant turn
ai_jailbreakA text the AI check by Mistral marks as a jailbreak attempt

The check also finds these phrasings when they are misspelled, spaced out, hidden in Markdown or HTML, or encoded as Base64 or hex.

Other responses

  • 413, with the reason prompt_injection.scan_limit in error.details: under Block, a request with more than 1,000,000 characters of text to check is refused, because it cannot be checked completely. Every message, tool result or file counts as at least 64 characters, so a request with more than 15,625 short texts is refused too. Send it in smaller parts. Under Flag the part that fits is checked, the request is served, and the reason prompt_injection.scan_limit is recorded.
  • 503: under Block, if the phrasing check itself fails, the request is not sent, so a request whose phrasing check failed never passes a block rule. Retry shortly. Under Flag the request is served. The AI check works the other way: when Mistral AI is unavailable, the request is served on the result of the phrasing check, also under Block (see When the AI check cannot run).

Where to see findings

  • Logs. The request log marks every flagged or blocked request with its reason, and you can filter by it. A request's details show the rule that applied, how many phrasings were found, the techniques and any input that could not be checked, never the text. An AI finding shows as the technique ai_jailbreak, and an AI check that did not run as ai_check_unavailable or ai_check_not_allowed among the inputs that could not be checked. The same facts are in prompt_injection of the Logs API and in the export.
  • Response headers. A non-streaming response carries x-eurouter-decision and, when something was flagged, x-eurouter-reasons: prompt_injection.flagged. Streaming responses do not carry these headers.

The count is one per kind of phrasing and way of hiding it, per message or file, not one per occurrence.


Email alerts

EUrouter emails your organization's owners and admins when it flags or blocks prompt injection:

  • A daily summary. Every morning at 08:10 Amsterdam time, for the day before (Amsterdam time), if that day had findings. It lists each API key with its number of flagged and blocked requests and the techniques found, and links to the Logs page filtered to prompt injection. A day without findings sends nothing.
  • The first block of a key on a day. The first time a key is blocked on a day (UTC), an email goes out right away. Later blocks of that key that day are only in the next summary.

The emails name the key and the techniques, never the text of a request, a matched phrasing or a file name. They cover requests under your organization's rule or a key's own rule, not a rule a single request sets for itself.

The emails are on by default. An owner or admin switches them off under Guardrails → Prompt injection, on the Organization tab, with Email owners and admins when prompt injection is found. Members see the switch but cannot change it. With the organization policy endpoint, send "prompt_injection_alerts": false to switch them off, and leave the field out to switch them back on. As with the rule, read the current policy first and send it back with the change.


Limits

This is a best-effort filter for known phrasings. It is not a general defence against prompt injection.

Measured on public datasets the phrasings were not tuned on:

DataDetected
Direct "ignore your instructions" attacks written by people48.0% (Lakera Gandalf, 506 prompts)
Mixed injection prompts in English and German14.1% (deepset, 135 prompts)
Role-play jailbreaks14.9% (jackhhao, 343 prompts)
Ordinary prompts wrongly flagged1 in 36,411

It catches about half of direct override attempts and few paraphrases. It is strongest in English. Role play, paraphrases and other languages mostly get through.


What stays your responsibility

An injection that gets past this check can only do what your application lets the model do. Keep these in your application:

  • Tool permissions. Give the model only the tools it needs, with the least access.
  • Secrets. Never put credentials or private data in a prompt the model could be talked into repeating.
  • Human approval for actions that send, pay, delete or publish.
  • Outbound network controls for tools that fetch URLs or call other services.
  • Treat model output as untrusted before you run it, render it or pass it to another system.

Was this page helpful?

Still stuck? Contact support

On this page