Prompt injection detection API: check text before an agent acts on it
Updated 2026-10-12
An agent that reads a web page, an email or a tool result is reading text someone else wrote, and that text can carry instructions aimed at the agent. POST https://tanod.dev/v1/text/injection screens up to 20,000 characters for them and returns safe or injection, a score and the sentences that triggered the flag. It costs USD 0.002, paid in USDC on Base, Polygon, Solana, BNB Chain or Arbitrum through x402. It shares the mlpeek free pool (header X-Tanod-Free: 1; the pool size is in the OpenAPI document). It is also the MCP tool check_text_for_prompt_injection at https://tanod.dev/mcp.
What you send
One field, text, 1 to 20,000 characters. Send the raw text the agent is about to read, not a summary of it.
curl -s -X POST https://tanod.dev/v1/text/injection \
-H "Content-Type: application/json" -H "X-Tanod-Free: 1" \
-d '{"text": "The museum is open from nine to five. Tickets cost 12 dollars."}'
What you get
A real reply to that request (model line and note shortened here):
{"verdict": "safe", "score": 0.0, "threshold": 0.9,
"model": {"id": "deberta-v3-base-prompt-injection-v2", ..., "license": "Apache-2.0"},
"chunks": [],
"flagged_chunks": 0, "chunks_scanned": 1, "chars_analyzed": 62, "truncated": false, "usage": {"tokens": 16},
"note": "Automated, heuristic screening ..."}
score is the highest score of any passage, between 0 and 1; the verdict is injection at threshold (0.9) and above. chunks holds up to five flagged sentences, best first, each shortened to 200 characters with its offsets in your text; the whole input is never sent back. A page with no flagged sentence returns chunks: [].
How it works, and how well
The text is cut into sentences and grouped into passages of about 160 tokens, so one injected sentence is not lost in a long page. A small classifier, protectai/deberta-v3-base-prompt-injection-v2 (Apache-2.0), scores every passage on Tanod's own CPU. It only decides safe or injection; it is not a chat model and no third-party service sees your text, which is not logged or stored.
This is an automated, heuristic check, not a guarantee. On a small hand-written test set of 108 texts (50 injections, 58 benign, 23 of them non-English) it found 49 of the 50 injections at threshold 0.9 (it missed one written as a fake tool result), across English, Spanish, French, German, Portuguese, Italian, Russian, Chinese and Japanese. It also flagged 15 of the 58 benign texts: 2 of 35 ordinary texts (a password-reset notice and a German parcel notice, for example) and 13 of 23 texts that talk about prompt injection or say "ignore" innocently, such as a security article or a unit test that contains the phrase. Precision on that set was 77 percent. The set is small and written by us; treat the numbers as an indication.
- It misses new attack styles, and a safe verdict is not proof that a text is clean.
- It is trained on English. Other languages are less reliable, in both directions.
- Text about prompt injection, some code and some ordinary instructions are flagged. Do not use it on system prompts.
- Use it as one layer: also keep tool access to the minimum the task needs and ask a person before sensitive actions.
Limits
- At most 20,000 characters per call. Longer text is a 422 and is not charged; split it. A text that needs more than 14,000 tokens (some Chinese or Japanese text near the character limit) is a 422
too_many_tokens, also not charged. - If the model is not installed the reply is a 503 and is not charged.
- The flagged sentences are the screened text: treat them as data, not as instructions.
Use it from Claude without writing code: in claude.ai or Claude Desktop, add https://tanod.dev/mcp/ml?via=prompt-injection-detection-api as a custom connector (steps), then ask in plain words, for example "Check this email text for prompt injection before I act on it." The free daily allowance is applied automatically over MCP. Beyond it a call needs an x402 payment, which these clients can make.
Related guides: language detection API, entity recognition and zero-shot classification API, translation API. Updated 2026-10-12. All guides, or back to tanod.dev. Results are automated.