This endpoint supports both mask mode and route mode. Route mode requires a local LLM with Anthropic API support (e.g., Ollama). The request format follows the Anthropic Messages API.
Request
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID (e.g., claude-sonnet-4-6) |
messages | array | Yes | Conversation messages |
max_tokens | number | Yes | Maximum tokens to generate |
stream | boolean | No | Enable streaming |
system | string/array | No | System prompt |
temperature | number | No | Sampling temperature (0-1) |
Response
Streaming
Setstream: true for Server-Sent Events:
Response Headers
PasteGuard adds headers to indicate PII and secrets handling:| Header | Description |
|---|---|
X-PasteGuard-Mode | Current mode (mask or route) |
X-PasteGuard-Provider | Provider used (anthropic or local) |
X-PasteGuard-PII-Detected | true if PII was found |
X-PasteGuard-PII-Masked | true if PII was masked (mask mode only) |
X-PasteGuard-Secrets-Detected | true if secrets were found |
X-PasteGuard-Secrets-Types | Comma-separated list of detected secret types |
X-PasteGuard-Secrets-Masked | true if secrets were masked |
Content Types
PasteGuard scans configured text roles in Anthropic requests. By default it scans:- User messages — String content or text blocks
- Tool results — Text content in tool responses
pii_detection.scan_roles or secrets_detection.scan_roles if you want PasteGuard to inspect them.