PrivAiTe: Self-Hosted Proxy Redacts PII and Secrets in Claude Code Agent Workflows
PrivAiTe is a self-hosted redaction proxy that strips sensitive data and credentials before they reach LLM APIs. Designed for agent workflows, it scrubs PII and secrets directly out of tool-call parameters and Anthropic Messages API requests.

Impact: High
Why it matters
You can run Claude Code safely on private codebases by routing API requests through a local redaction gateway.
TL;DR
- 01Claude Code transmits full file and log content to Anthropic, including secrets in tool-call arguments.
- 02PrivAiTe runs locally as an HTTP proxy, scrubbing PII and API keys before egress.
- 03Enabling detection caching is critical to keep per-turn latency under 3 seconds.
Key facts
- Supported Protocols
- Anthropic Messages API, OpenAI Responses API, LiteLLM
- Median Latency (with cache)
- 1 - 3 seconds per request
- Uncached Peak Latency
- 42s (Claude Code), 72s (Codex)
- Planted Secret Redaction Rate
- 22-24 of 24 credentials redacted (benchmark)
Redacting Tool-Call JSON and Agent Traffic
Standard PII scrubbers scan plain chat text but fail when agents wrap credentials inside tool-call JSON structures. PrivAiTe operates as an Anthropic Messages API and OpenAI Responses API gateway, parsing incoming JSON bodies and swapping detected EMAIL_ADDRESS, PERSON, or SECRET strings for consistent placeholders before relaying requests to api.anthropic.com.
Performance and Cache Benchmarks
Because agentic CLIs send the full conversation history on every turn, re-scanning long sessions introduces severe latency. Without caching, scrubbing a large Claude Code session peak-stalled at 42 seconds per request (72 seconds on Codex). Enabling PrivAiTe's detection cache lowers median latency to 1–3 seconds per request. In benchmark testing on 24 planted repository secrets, default gateway filtering reduced leakages to provider servers from 24/24 down to 0–2 leakages.
Deployment and Configuration
Deploy PrivAiTe via Docker or Python using local spaCy and ONNX models. Set PRIVAITE_API_KEYS for client authentication, keep OPENAI_API_KEY or Anthropic credentials inside the container, and launch Claude Code pointing to http://localhost:8400.
Try it in 2 minutes
docker run -d -p 8400:8400 -e PRIVAITE_API_KEYS=my-secret -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY crp4222/privaite
ANTHROPIC_BASE_URL=http://localhost:8400 claudebash
✓ When to use
- Running Claude Code or Codex on repos containing credentials, .env files, or real customer data
- Routing OpenAI/Anthropic API calls through local privacy guardrails in enterprise settings
- Preventing inadvertent secret leaks inside agent tool-call JSON parameters
✕ When NOT to use
- Expecting 100% guaranteed redaction for complex obfuscated logs without review
- Publicly exposed ports without network restrictions, as gateway endpoints relay auth directly
What to do today
- Install PrivAiTe via Docker or Python to wrap your agent CLI workflows.
- Set ANTHROPIC_BASE_URL to point Claude Code at http://localhost:8400.
- Enable detection caching in privaite.yaml to prevent long turn processing times.
What the community says
“Actual project description: Self-hosted PII redaction proxy for LLM APIs. I can't believe people are resorting to clickbait headlines for personal projects now.”
Sources