Using Codex with Agent Redactor
-
Configure Agent Redactor (do this first)
Before setting up Codex, get the local redaction proxy running so Codex 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/v1), 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 Codex at Agent Redactor
Codex reads its providers from a TOML config file. Open
C:\Users\<you>\.codex\config.tomlon Windows (~/.codex/config.tomlelsewhere) and create it if it does not exist yet. Add the following, keeping any settings you already have:model_provider = "agentredactor" model_reasoning_effort = "high" model = "nvidia/nemotron-3-ultra-550b-a55b:free" [model_providers.agentredactor] name = "agentredactor" base_url = "http://localhost:8080/" [model_providers.agentredactor.auth] command = "sh" args = ["-c", "echo $AGENTREDACTOR_API_KEY"]
- base_url: Must exactly match the Local URL in Agent Redactor.
- model: Replace
nvidia/nemotron-3-ultra-550b-a55b:freewith the exact model name from your upstream provider. - model_reasoning_effort: Optional. Set it to your preference or remove the line entirely.
- [model_providers.agentredactor.auth]: Tells Codex to fetch its API token by running a shell command that prints the
AGENTREDACTOR_API_KEYenvironment variable. A placeholder value is fine, because Agent Redactor is already holding your real API key safely and injects it upstream.
-
Set the placeholder API key
Codex expects a token to exist even though the proxy does not need a real one. Set the environment variable in PowerShell:
setx AGENTREDACTOR_API_KEY "placeholder"
You should see SUCCESS: Specified value was saved. The variable is stored permanently, but
setxonly applies to new terminals, so close and reopen your terminal before continuing. -
Start Codex and work securely
Launch Codex from a fresh terminal:
codex
The header should show your chosen model and reasoning effort. All outgoing requests are now filtered locally through Agent Redactor before ever touching the internet. In the example below, the model only received a redaction placeholder where the name used to be.
Codex 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.