Route mode sends requests containing PII to a local LLM. Requests without PII go to OpenAI or Anthropic.
How It Works
Request with PII
Routed to Local LLM (Ollama, vLLM, llama.cpp, etc.)PII stays on your network.
Request without PII
Routed to OpenAI or AnthropicFull performance.
When to Use
- Have local GPU resources
- Need complete data isolation for sensitive requests
- Must prevent any PII from leaving your network
Configuration
mode: route
providers:
openai:
base_url: https://api.openai.com/v1
local:
type: ollama
base_url: http://localhost:11434
model: llama3.2
In route mode:
- No PII detected → Request goes to OpenAI or Anthropic
- PII detected → Request goes to local LLM
For Anthropic requests, the local LLM must support the Anthropic Messages API (e.g., Ollama with Anthropic API compatibility).
Local LLM Setup
Ollama
local:
type: ollama
base_url: http://localhost:11434
model: llama3.2
vLLM
local:
type: openai
base_url: http://localhost:8000/v1
model: meta-llama/Llama-2-7b-chat-hf
llama.cpp
local:
type: openai
base_url: http://localhost:8080/v1
model: local
LocalAI
local:
type: openai
base_url: http://localhost:8080/v1
model: your-model-name
api_key: ${LOCAL_API_KEY} # if required
Route mode sets these headers on responses:
When a request is routed to local:
X-PasteGuard-Mode: route
X-PasteGuard-Provider: local
X-PasteGuard-PII-Detected: true
X-PasteGuard-Language: en
When routed to OpenAI or Anthropic:
X-PasteGuard-Mode: route
X-PasteGuard-Provider: openai
X-PasteGuard-PII-Detected: false
X-PasteGuard-Language: en
If the detected language wasn’t configured and fell back to fallback_language:
X-PasteGuard-Language-Fallback: true