Using Claude Code with Agent Redactor
-
Configure Agent Redactor (do this first)
Before setting up Claude Code, get the local redaction proxy running so Claude Code can connect through it. In the Profiles sidebar, select or create a profile. Set the Local URL to
http://localhost:8080/(or your preferred port), set Forward To to your real provider endpoint (e.g.https://openrouter.ai/api/), and paste your real API Key. The key is encrypted locally and never leaves your machine. Click Save All Settings and confirm the port shows as available. -
Choose your redaction rules
Decide what gets redacted before anything leaves your machine. You can enable the AI Powered Detection Model and tick the PII categories it should catch, add Regex Patterns and Keywords for deterministic matching, or use any combination of the three. The choice is yours. Regex and Keywords are also ideal for project-specific secrets the AI model might miss.
-
Point Claude Code at Agent Redactor (permanent)
Claude Code reads environment variables from its settings file. Open your user settings file at
C:\Users\<you>\.claude\settings.jsonon Windows (~/.claude/settings.jsonelsewhere) and add the followingenvblock, keeping any settings you already have:{ "env": { "ANTHROPIC_BASE_URL": "http://localhost:8080/", "ANTHROPIC_AUTH_TOKEN": "dummy-key-to-bypass-login", "ANTHROPIC_MODEL": "anthropic/claude-haiku-4.5", "ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-haiku-4.5", "ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-haiku-4.5", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-4.5", "ANTHROPIC_DEFAULT_FABLE_MODEL": "anthropic/claude-haiku-4.5", "CLAUDE_CODE_SUBAGENT_MODEL": "anthropic/claude-haiku-4.5", "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1048576", "CLAUDE_CODE_EFFORT_LEVEL": "max" } }- ANTHROPIC_BASE_URL: Must exactly match the Local URL in Agent Redactor.
- ANTHROPIC_AUTH_TOKEN: Any placeholder value works. Agent Redactor is already holding your real API key safely and injects it upstream.
- ANTHROPIC_MODEL and the model overrides: Replace
anthropic/claude-haiku-4.5with the exact model name from your upstream provider. Setting all of them ensures Claude Code, its subagents, and background tasks all use the same model.
Other entries in the file, like
themeorautoUpdatesChannel, are unrelated, so leave them as they are. -
Alternative: temporary session variables
If you'd rather not touch the settings file, for example to test the proxy once, set the variables in PowerShell instead. They only last for the current terminal session:
$env:ANTHROPIC_BASE_URL = "http://localhost:8080/"
$env:ANTHROPIC_AUTH_TOKEN = "dummy-key-to-bypass-login"
$env:ANTHROPIC_MODEL = "anthropic/claude-haiku-4.5"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "anthropic/claude-haiku-4.5"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "anthropic/claude-haiku-4.5"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "anthropic/claude-haiku-4.5"
$env:ANTHROPIC_DEFAULT_FABLE_MODEL = "anthropic/claude-haiku-4.5"
$env:CLAUDE_CODE_SUBAGENT_MODEL = "anthropic/claude-haiku-4.5"
$env:CLAUDE_CODE_AUTO_COMPACT_WINDOW = "1048576"
$env:CLAUDE_CODE_EFFORT_LEVEL = "max"
Once you close the terminal, the variables are gone and Claude Code falls back to its normal configuration.
-
Start Claude Code and work securely
Open a fresh terminal (so it picks up the new settings) and launch Claude Code:
claude
The welcome screen should show your chosen model running via API usage billing. All outgoing requests are now filtered locally through Agent Redactor before ever touching the internet. In the example below, the model can see that the name was redacted before the prompt reached it.
Claude Code running through the proxy. The model received a redacted placeholder instead of the real name.
Verifying redaction
Check the Session Redactions panel in Agent Redactor to see exactly what was intercepted.