Introduction
Veilgate is a PII & DLP redaction firewall for LLM pipelines — a hybrid regex fast-path plus TypeSafe Jev calibrated evaluation, reversible and mock-first.
Veilgate sits between your application and a cloud LLM. It strips secrets and personal data out of every outbound payload, then re-hydrates the model’s reply so the end user still sees the original values.
Per span it decides toAllowRedactRerouteBlock
import { redact, rehydrate } from "veilgate";
const r = await redact("My name is Alice Johnson.");
r.output; // "My name is [REDACTED_PII_1]." ← what the model sees
r.blocked; // false
rehydrate(r.output, r.vault); // "My name is Alice Johnson." ← restored for the userBy default this runs in mock mode — deterministic, no network, no API key — so you can try the whole thing before wiring up a Jev key.
The problem
Enterprises want frontier LLMs for support, log analysis, RAG ingestion and agents. GDPR, HIPAA, SOC 2 and IP-preservation policies make it risky to ship raw context across a vendor boundary, and existing sanitizers each fail in a characteristic way:
| Approach | Mechanic | Primary failure mode |
|---|---|---|
| Regex / static rules | Patterns + dictionaries | Misses contextual PII (“the VP of Sales who moved to Austin”); false-positives on benign IDs |
| Small local NER | spaCy / BERT-NER | Needs dedicated compute; weak on novel domain secrets and multi-sentence context |
| LLM-as-a-firewall | Prompt a model to sanitize | 1.5–5s of latency; doubles token cost; prompt-injectable |
Veilgate combines a zero-latency local regex fast-path for high-confidence secrets with Jev, a non-autoregressive calibrated model, for everything that needs semantic judgement.
What you get
- No API key to try it. Everything runs in deterministic mock mode by default.
- Fail-closed. Jev errors, missing reroute handlers and streaming bypasses all stop the request rather than leak.
- Reversible. Redactions live in an in-memory vault keyed by typed placeholders
(
[REDACTED_PII_1]) and are restored on the response. - Framework-agnostic. A core engine plus drop-in middleware for HTTP proxies, the Vercel AI SDK and LangChain, and a CLI.
Read Install & quickstart, then The pipeline to see how a payload is chunked, scored and routed.
Why Jev (System One)
Jev is TypeSafe AI’s specialized evaluation model. It emits calibrated probabilities
(P ∈ [0,1]) over many independent checks in a single parallel pass, with no
token-by-token generation.
| Parameter | Value | What it buys you |
|---|---|---|
| Latency | 70–200ms | 20+ compliance, privacy and secret checks at once, fast enough for a synchronous gateway |
| Calibration | P ∈ [0,1] | Noul / Choice / Score primitives allow asymmetric per-domain thresholds |
| Structure | No schema drift | Structured outputs can’t hallucinate malformed JSON |
| Cost | $0.042 / MTok | Input billed per MTok; evaluations carry no per-token generation cost |
The latency and throughput figures are TypeSafe’s published numbers for Jev, not benchmarks of
this library; the $0.042 / MTok price matches DEFAULT_JEV_CONFIG.
Veilgate evaluates five detectors per span:
| Detector | Primitive | Evaluates |
|---|---|---|
direct_pii |
Noul | Explicit names, addresses, IDs |
contextual_quasi_identifier |
Noul | Combined indirect identifiers |
credentials_or_secrets |
Noul | API keys, tokens, passwords |
regulated_health_or_financial |
Noul | HIPAA / PCI data |
sensitivity_severity |
Score | 0.0–1.0 structural-context severity |