Prompt Injection Detection API
Catch prompt injections, role hijacks, and encoded jailbreaks in user inputs and RAG chunks.
Scan and sanitize LLM outputs for prompt leakage, Markdown beacons, XSS, and policy violations. Outbound LLM guardrail API that scans and sanitizes model responses for canary/system-prompt leaks, Markdown image exfiltration beacons, XSS, ANSI injection, and policy violations.
{
"ok": true,
"data": {
"verdict": "block",
"safe": false,
"risk_score": 100,
"sanitized_output": "Here is your summary!  [REMOVED_UNSAFE_HTML]",
"findings": [
{
"category": "canary_leak",
"severity": "critical",
"description": "Secret system-prompt canary token leaked in LLM output",
"match": "CANARY-9911",
"offset": 72
},
{
"category": "xss_executable",
"severity": "critical",
"description": "Inline HTML <script> tag in LLM output",
"match": "<script>alert(1)</script>",
"offset": 85
},
{
"category": "markdown_exfiltration",
"severity": "critical",
"description": "Markdown image tag points to an untrusted host or carries query-string exfiltration parameters",
"match": "",
"offset": 22
}
],
"metrics": {
"char_count": 110,
"estimated_tokens": 28,
"system_prompt_overlap_ratio": 0,
"repetition_ratio": 0,
"refusal_detected": false
}
},
"meta": {
"request_id": "req_out_01",
"ms": 1
}
}
curl -X POST "https://api.tinplate.dev/v1/llm-output-guard" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TINPLATE_KEY" \
-d '{"output":"Here is your summary!  <script>alert(1)</script>","canary_tokens":["CANARY-9911"],"allowed_link_domains":["tinplate.dev"]}'import { TinplateClient } from "@tinplate/sdk";
const tinplate = new TinplateClient({
apiKey: process.env.TINPLATE_API_KEY!,
});
const { data, meta } = await tinplate.call("/v1/llm-output-guard", {
"output": "Here is your summary!  <script>alert(1)</script>",
"canary_tokens": [
"CANARY-9911"
],
"allowed_link_domains": [
"tinplate.dev"
]
});
console.log(`[${meta.ms} ms]`, data);import requests
response = requests.post(
"https://api.tinplate.dev/v1/llm-output-guard",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TINPLATE_KEY",
},
json={
"output": "Here is your summary!  <script>alert(1)</script>",
"canary_tokens": [
"CANARY-9911"
],
"allowed_link_domains": [
"tinplate.dev"
]
}
)
print(response.json())const response = await fetch("https://api.tinplate.dev/v1/llm-output-guard", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TINPLATE_KEY",
},
body: JSON.stringify({
"output": "Here is your summary!  <script>alert(1)</script>",
"canary_tokens": [
"CANARY-9911"
],
"allowed_link_domains": [
"tinplate.dev"
]
}),
});
const result = await response.json();
console.log(result);{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "tinplate_llm_output_guard",
"arguments": {
"output": "Here is your summary!  <script>alert(1)</script>",
"canary_tokens": [
"CANARY-9911"
],
"allowed_link_domains": [
"tinplate.dev"
]
}
}
}POST /v1/llm-output-guard)| Parameter | Type & Constraints | Description |
|---|---|---|
output required |
stringminLen: 1, maxLen: 200000 |
Raw text or Markdown response generated by the LLM. |
system_prompt optional |
stringmaxLen: 50000 |
Optional system prompt used for the LLM call; checked for verbatim n-gram leakage in the output. |
canary_tokens optional |
string[] |
Optional secret canary strings embedded in the system prompt that must never appear in the output. |
blocked_terms optional |
string[] |
Optional brand, competitor, or policy terms that must be flagged and masked if emitted by the model. |
allowed_link_domains optional |
string[] |
Optional allowlist of domains permitted in Markdown links and images. External URLs outside this list are flagged. |
check_regulated_advice optional |
booleandefault: true |
Flag unhedged prescriptive medical, financial, or legal advice lacking a standard disclaimer. |
data Object Fields (200 OK)| Field | Type | Description |
|---|---|---|
verdict |
"allow" | "sanitize" | "block" |
Field 'verdict' |
safe |
boolean |
Field 'safe' |
risk_score |
integer |
Field 'risk_score' |
sanitized_output |
string |
Field 'sanitized_output' |
findings |
object[] |
Field 'findings' |
metrics |
object |
Field 'metrics' |
Release: v1.0.39 ·
Verified: 16 November 2026 ·
Portfolio Median: 0.318 ms in-Worker V8 compute (add 15–65 ms HTTPS RTT) ·
See Full Portfolio Benchmarks →
Direct Polar All-Access Keys unlock all 42 APIs (49 endpoints), /v1/pipeline, and /mcp on api.tinplate.dev:
Pro ($29/mo · 120 req/min · 100k/mo · 128 KB) or Team ($79/mo · 300 req/min · 500k/mo · 256 KB).
| Plan | Monthly Price | Included Requests | Rate Limit | Max Payload | Best For |
|---|---|---|---|---|---|
| BASIC | $0.00 / mo | 500 / month | 10 req / min | 64 KB | Evaluation & CI smoke tests |
| PRO | $9.99 / mo | 15,000 / month | 60 req / min | 128 KB | Solo devs & production apps |
| ULTRA | $29.99 / mo | 100,000 / month | 300 req / min | 256 KB | Growing SaaS & multi-agent pipelines |
| MEGA | $79.99 / mo | 500,000 / month | 1,000 req / min | 256 KB | High-volume enterprise workloads |
01-prompt-guard inspects untrusted user inputs and RAG chunks entering the model, whereas 31-llm-output-guard inspects and sanitizes the model's generated response before rendering it to end users.
Pass your system_prompt and/or canary_tokens; the engine checks for exact canary matches, 5-word n-gram overlap ratios, and meta-instruction leak phrases.
When verdict is 'sanitize', sanitized_output has blocked terms, ANSI escapes, and duplicate repetition loops stripped. When verdict is 'block', reject or regenerate the response.
Stateless in-memory evaluation; zero payload logging or retention.
Worker Zero-Logging Guarantee: Cloudflare Workers Observability and invocation logging are disabled (observability.enabled = false, head_sampling_rate = 0, invocation_logs = false). Requests via RapidAPI or Zyla traverse marketplace proxies; use a Direct Bearer Key for zero-intermediary routing.
Catch prompt injections, role hijacks, and encoded jailbreaks in user inputs and RAG chunks.
Mask emails, phones, IBANs, cards, and EU IDs with reversible tokens before LLM calls.
Fast first filter to catch unsupported numbers, dates, and names in LLM answers vs RAG sources.