Support: support@tinplate.dev · Zero-Retention Edge Security Support Trust Center DPA GitHub Issues
AI Data Prep Live on Hub

LLM Chat Messages Policy Proxy & Sanitizer API — Multi-Turn OpenAI/Anthropic Guardrail

Sanitize entire multi-turn LLM messages[] arrays in one call before forwarding to OpenAI, Anthropic, or Gemini. Drop-in guardrail for OpenAI, Anthropic, and Gemini messages[] arrays. Scans user and tool turns for prompt injection, redacts PII and secrets with a unified cross-turn restoration map, and strips email reply noise.

Interactive Sandbox · No API Key Required 200 OK · Ready
POST /v1/llm-messages-guardinput
200 OK sample / live responsejson
{
  "ok": true,
  "data": {
    "safe": true,
    "verdict": "allow",
    "max_risk_score": 0,
    "sanitized_messages": [
      {
        "role": "system",
        "content": "You are an enterprise billing assistant."
      },
      {
        "role": "user",
        "content": "Please email the receipt to [PII_EMAIL_1]. Key: [SECRET_GITHUB_TOKEN_1]"
      }
    ],
    "restoration_map": {
      "[PII_EMAIL_1]": "alice@acme.eu",
      "[SECRET_GITHUB_TOKEN_1]": "ghp_1234567890abcdefghijklmnopqrstuvwxyz"
    },
    "summary": {
      "total_messages": 2,
      "scanned_messages": 1,
      "blocked_turns": 0,
      "total_pii_redacted": 1,
      "total_secrets_redacted": 1,
      "injection_categories": []
    },
    "turn_findings": [
      {
        "turn_index": 0,
        "role": "system",
        "verdict": "allow",
        "risk_score": 0,
        "injection_categories": [],
        "pii_redacted_count": 0,
        "secrets_redacted_count": 0,
        "pii_types": [],
        "secret_types": []
      },
      {
        "turn_index": 1,
        "role": "user",
        "verdict": "allow",
        "risk_score": 0,
        "injection_categories": [],
        "pii_redacted_count": 1,
        "secrets_redacted_count": 1,
        "pii_types": [
          "EMAIL"
        ],
        "secret_types": [
          "GITHUB_TOKEN"
        ]
      }
    ]
  },
  "meta": {
    "request_id": "req_msg_01",
    "ms": 2
  }
}
OpenAPI 3.0.3 Get All-Access Key ($29/mo) No signup. No payload storage.
Quickstart Code Examples
curl -X POST "https://api.tinplate.dev/v1/llm-messages-guard" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TINPLATE_KEY" \
  -d '{"messages":[{"role":"system","content":"You are an enterprise billing assistant."},{"role":"user","content":"Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"}],"check_prompt_injection":true,"redact_pii":true,"scan_secrets":true,"strip_email_quotes":true,"sensitivity":"medium"}'
import { TinplateClient } from "@tinplate/sdk";

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

const { data, meta } = await tinplate.call("/v1/llm-messages-guard", {
  "messages": [
    {
      "role": "system",
      "content": "You are an enterprise billing assistant."
    },
    {
      "role": "user",
      "content": "Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"
    }
  ],
  "check_prompt_injection": true,
  "redact_pii": true,
  "scan_secrets": true,
  "strip_email_quotes": true,
  "sensitivity": "medium"
});
console.log(`[${meta.ms} ms]`, data);
import requests

response = requests.post(
    "https://api.tinplate.dev/v1/llm-messages-guard",
    headers={
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_TINPLATE_KEY",
    },
    json={
  "messages": [
    {
      "role": "system",
      "content": "You are an enterprise billing assistant."
    },
    {
      "role": "user",
      "content": "Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"
    }
  ],
  "check_prompt_injection": true,
  "redact_pii": true,
  "scan_secrets": true,
  "strip_email_quotes": true,
  "sensitivity": "medium"
}
)
print(response.json())
const response = await fetch("https://api.tinplate.dev/v1/llm-messages-guard", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TINPLATE_KEY",
  },
  body: JSON.stringify({
  "messages": [
    {
      "role": "system",
      "content": "You are an enterprise billing assistant."
    },
    {
      "role": "user",
      "content": "Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"
    }
  ],
  "check_prompt_injection": true,
  "redact_pii": true,
  "scan_secrets": true,
  "strip_email_quotes": true,
  "sensitivity": "medium"
}),
});
const result = await response.json();
console.log(result);
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "tinplate_llm_messages_guard",
    "arguments": {
      "messages": [
        {
          "role": "system",
          "content": "You are an enterprise billing assistant."
        },
        {
          "role": "user",
          "content": "Please email the receipt to alice@acme.eu. Key: ghp_1234567890abcdefghijklmnopqrstuvwxyz"
        }
      ],
      "check_prompt_injection": true,
      "redact_pii": true,
      "scan_secrets": true,
      "strip_email_quotes": true,
      "sensitivity": "medium"
    }
  }
}
OpenAPI 3.0.3 Schema Contract

Request Parameters & Response Schema Reference

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

ParameterType & ConstraintsDescription
messages required object[] Array of OpenAI, Anthropic, or agent chat messages to inspect and sanitize in a single pass.
sensitivity optional "low" | "medium" | "high"
default: "medium"
Prompt-injection threshold sensitivity preset.
check_prompt_injection optional boolean
default: true
Scan user and tool turns for prompt injection and jailbreaks.
redact_pii optional boolean
default: true
Mask emails, phones, IBANs, credit cards, and national IDs across turns.
scan_secrets optional boolean
default: true
Scrub leaked API keys, tokens, PEM keys, and credentials across turns.
strip_email_quotes optional boolean
default: false
Strip quoted email reply chains and signature blocks from user turns before scanning.
locales optional string[]
default: ["GLOBAL","EU","US"]
Locale sets for PII detection.

Response data Object Fields (200 OK)

FieldTypeDescription
safe boolean Field 'safe'
verdict "allow" | "review" | "block" Field 'verdict'
max_risk_score number Field 'max_risk_score'
sanitized_messages object[] Field 'sanitized_messages'
restoration_map object Unified token-to-original map across all turns for stateless restoration after LLM completion.
summary object Field 'summary'
turn_findings object[] Field 'turn_findings'

What LLM Chat Messages Policy Proxy & Sanitizer API Detects & Validates

  • Role-aware multi-turn scanning across system, developer, user, assistant, and tool messages
  • Unified cross-turn token consistency: identical emails or secrets across Turn 1 and Turn 5 map to the same [PII_EMAIL_1] token
  • Indirect prompt-injection detection inside untrusted tool outputs and user messages
  • Optional email reply-chain and signature stripping to reduce input token waste
Honest Engineering Boundaries

Known Limitations & Test Verification

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 →

  • Evaluates text content blocks; base64 image or audio binary attachments inside multimodal content arrays are passed through untouched.
  • Tested v1.0.6 (14 November 2026).

Direct All-Access & Marketplace Plans

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).

PlanMonthly PriceIncluded RequestsRate LimitMax PayloadBest For
BASIC$0.00 / mo500 / month10 req / min64 KBEvaluation & CI smoke tests
PRO$9.99 / mo15,000 / month60 req / min128 KBSolo devs & production apps
ULTRA$29.99 / mo100,000 / month300 req / min256 KBGrowing SaaS & multi-agent pipelines
MEGA$79.99 / mo500,000 / month1,000 req / min256 KBHigh-volume enterprise workloads

Frequently Asked Questions

Why use this instead of calling Prompt Guard and PII Redactor on each message?

Calling PII Redactor per message resets token numbering on every turn. This API maintains a unified cross-turn restoration map across the entire conversation history in a single network call.

Does it modify system or developer prompts?

No—system and developer prompts are preserved verbatim so your instructions and few-shot examples are never altered.

Zero Payload Logging

Data Handling, Privacy & Proxy Disclosure

Chat arrays and reversible restoration maps are processed in memory and never logged or stored.

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.

Related Tinplate APIs

POST /v1/prompt-guard Live

Prompt Injection Detection API

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

POST /v1/pii-redactor Live

PII Redactor API

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

POST /v1/prompt-cache-budgeter AI Safety & Agents

Prompt Cache Key & Context Budgeter API

Estimate tokens, optimize message order for prompt caching, and calculate LLM API costs.