Prompt Injection Detection API
Catch prompt injections, role hijacks, and encoded jailbreaks in user inputs and RAG chunks.
Fast first filter to catch unsupported numbers, dates, and names in LLM answers vs RAG sources. Fast first-pass RAG grounding check that catches unsupported numbers, dates, percentages, and proper nouns in LLM answers against source text.
{
"ok": true,
"data": {
"grounded_score": 4,
"verdict": "partially_grounded",
"summary": {
"total_claims": 1,
"supported_claims": 0,
"partial_claims": 1,
"unsupported_claims": 0,
"missing_numbers": [
"24%"
],
"missing_entities": [
"Berlin"
]
},
"claims": [
{
"index": 0,
"text": "Acme Corp generated $4.2M in Q3 2026 (24% YoY growth) and launched in Berlin.",
"status": "partial",
"overlap_score": 0.442,
"missing_numbers": [
"24%"
],
"missing_entities": [
"Berlin"
],
"evidence": {
"source_index": 0,
"quote": "In Q3 2026, Acme Corp reported revenue of $4.2M and 18% year-over-year growth."
}
}
],
"judge": "disabled",
"ai_judge": null
},
"meta": {
"request_id": "req_hd_01",
"ms": 1
}
}
curl -X POST "https://api.tinplate.dev/v1/hallucination-diff" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TINPLATE_KEY" \
-d '{"sources":["In Q3 2026, Acme Corp reported revenue of $4.2M and 18% year-over-year growth."],"answer":"Acme Corp generated $4.2M in Q3 2026 (24% YoY growth) and launched in Berlin."}'import { TinplateClient } from "@tinplate/sdk";
const tinplate = new TinplateClient({
apiKey: process.env.TINPLATE_API_KEY!,
});
const { data, meta } = await tinplate.call("/v1/hallucination-diff", {
"sources": [
"In Q3 2026, Acme Corp reported revenue of $4.2M and 18% year-over-year growth."
],
"answer": "Acme Corp generated $4.2M in Q3 2026 (24% YoY growth) and launched in Berlin."
});
console.log(`[${meta.ms} ms]`, data);import requests
response = requests.post(
"https://api.tinplate.dev/v1/hallucination-diff",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TINPLATE_KEY",
},
json={
"sources": [
"In Q3 2026, Acme Corp reported revenue of $4.2M and 18% year-over-year growth."
],
"answer": "Acme Corp generated $4.2M in Q3 2026 (24% YoY growth) and launched in Berlin."
}
)
print(response.json())const response = await fetch("https://api.tinplate.dev/v1/hallucination-diff", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TINPLATE_KEY",
},
body: JSON.stringify({
"sources": [
"In Q3 2026, Acme Corp reported revenue of $4.2M and 18% year-over-year growth."
],
"answer": "Acme Corp generated $4.2M in Q3 2026 (24% YoY growth) and launched in Berlin."
}),
});
const result = await response.json();
console.log(result);{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "tinplate_hallucination_diff",
"arguments": {
"sources": [
"In Q3 2026, Acme Corp reported revenue of $4.2M and 18% year-over-year growth."
],
"answer": "Acme Corp generated $4.2M in Q3 2026 (24% YoY growth) and launched in Berlin."
}
}
}POST /v1/hallucination-diff)| Parameter | Type & Constraints | Description |
|---|---|---|
answer required |
stringminLen: 1, maxLen: 50000 |
Generated LLM answer to verify against source documents. |
sources required |
string[] |
Grounding source passages or RAG chunks. |
strictness optional |
"lenient" | "balanced" | "strict" |
Threshold profile for classifying claims as supported, partial, or unsupported. |
use_ai_judge optional |
boolean |
Enable optional Cloudflare Workers AI second-pass semantic grounding judge (default false). When true, up to 4,000 chars of sources and 1,500 chars of answer are sent over Cloudflare's internal binding to @cf/meta/llama-3.1-8b-instruct (adds ~150-400 ms; zero model training or retention). |
data Object Fields (200 OK)| Field | Type | Description |
|---|---|---|
grounded_score |
integer |
Field 'grounded_score' |
verdict |
"grounded" | "partially_grounded" | "contradicted" | "ungrounded" |
Field 'verdict' |
summary |
object |
Field 'summary' |
claims |
object[] |
Field 'claims' |
judge |
"disabled" | "workers_ai" | "unavailable" |
Field 'judge' |
ai_judge |
object | null |
Field 'ai_judge' |
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 |
Deterministic mode catches fabricated numbers, altered percentages/prices, wrong dates, and invented company/city/person names (100% recall on benchmark). Because it uses token and entity overlap, it cannot judge abstract reasoning, heavy paraphrase, or pure negation swaps ('is permitted' -> 'is not permitted')—it is a cheap first filter, not a truth detector.
By default use_ai_judge is false and text never leaves the Worker isolate. When use_ai_judge: true is set, an excerpt (up to 4,000 chars of sources and 1,500 chars of answer) is passed to Cloudflare Workers AI (@cf/meta/llama-3.1-8b-instruct) for a stateless semantic contradiction check with zero payload logging or model training.
Typically under 5 ms in deterministic mode (P50 0.037 ms, P99 2.363 ms on benchmark). When use_ai_judge: true is enabled, Workers AI inference adds ~150–400 ms.
In default deterministic mode (use_ai_judge: false), all token/entity diffing runs in volatile V8 memory with zero external calls or payload logging. When use_ai_judge: true is explicitly passed, up to 4,000 chars of sources and 1,500 chars of answer are sent over Cloudflare's internal binding to Cloudflare Workers AI (@cf/meta/llama-3.1-8b-instruct) for stateless inference; neither Tinplate nor Cloudflare trains models on or retains Workers AI inputs/outputs.
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.
Estimate tokens, optimize message order for prompt caching, and calculate LLM API costs.