block. The verdict lives in the body so your code can
read the reason and act accordingly. Non‑200 codes are reserved for
protocol failures (auth, rate limit, quota).
POST /api/runtime-security/scan/input
Scan a user prompt before forwarding it to your LLM.
Request
Response
verdict is one of allow / flag / redact / block. See
Verdicts for the full decision logic,
including when an uncorroborated high injection score or a
monitor‑mode NER finding produces flag instead of allow.
Rate limit: 20 requests / second / workspace.
POST /api/runtime-security/scan/output
Scan an LLM response before returning it to the user.
Request
Response
SameScanResponse shape as /scan/input. The output threat model is
leakage and jailbreak success indicators, distinct from the input
model. Configure separate thresholds via output_block_threshold and
output_redact_threshold in the App config.
Rate limit: 20 requests / second / workspace.
POST /api/runtime-security/scan/batch
Score up to 32 items in one call. Each item still consumes one
license call, but you save the HTTP overhead and the warm classifier
amortises across the batch.
Request
Response
len(items) license calls; if the workspace runs out of quota
mid‑batch, the whole call returns 402 before any scoring runs.
The ScanResponse schema
Every scan call returns the same shape.
extra: {"detector": "ner_gliner2", "model": "fastino/gliner2-privacy-filter-PII-multi", "action": "flag" | "redact"}.
action mirrors the App’s ner.mode and tells you whether this
particular finding contributed to redaction or was recorded in
monitor‑only mode. See NER PII
detection.
Wrapping it around your model
The minimal integration: scan input, call your model, scan output.When to prefer the Scan API over the proxy
- You don’t want the firewall in the chat request path.
- You’re scanning text that isn’t going to an LLM at all.
- You’re processing a large batch (
/scan/batchis the right tool). - You’re wiring custom middleware in a language without a maintained OpenAI / Anthropic SDK.

