Using Codex with Agent Redactor

Prerequisite: Install Agent Redactor from the Microsoft Store or via the PowerShell one-liner. You also need Codex installed and available on your PATH.
  1. 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.

  2. 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.

  3. Point Codex at Agent Redactor

    Codex reads its providers from a TOML config file. Open C:\Users\<you>\.codex\config.toml on Windows (~/.codex/config.toml elsewhere) 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:free with 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_KEY environment variable. A placeholder value is fine, because Agent Redactor is already holding your real API key safely and injects it upstream.
  4. 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 setx only applies to new terminals, so close and reopen your terminal before continuing.

  5. 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 session where the model replies that the user's name is a redacted keyword placeholder
    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.

Agent Redactor showing Statistics panel with Requests: 3, PII: 5, Keywords: 3, and Session Redactions listing intercepted keywords including Bob
The Statistics panel shows "Requests: 3, PII: 5, Keywords: 3" and Session Redactions lists the intercepted values with timestamp and type.
Tip: Use Regex Patterns and Keywords in your profile to catch project-specific secrets the AI model might miss for example internal hostnames, proprietary IDs, or project codenames.