Using OpenCode with Agent Redactor

Prerequisite: Install Agent Redactor from the Microsoft Store or via the PowerShell one-liner. You also need OpenCode installed.
  1. Create a profile and configure the API Proxy

    In the Profiles sidebar, select or create a profile. Set a Profile Name, choose a free Local URL port (e.g. 8080), enter the real Forward To endpoint for your provider (e.g. https://openrouter.ai/api/v1), and paste your real API Key. The key is encrypted locally and never leaves your machine.

    Agent Redactor API Proxy section with Profile Name OpenRouter Provider, Local URL localhost:8080, Forward To openrouter.ai/api/v1, and API Key field
    Configure the profile. Local URL is where OpenCode will connect, Forward To is the real API endpoint.
  2. Enable AI-powered detection and redaction rules

    Select the PII categories you want redacted. You can also add Regex Patterns and Keywords for project-specific secrets.

    Agent Redactor showing AI Powered Detection Model enabled with PII categories checked, Statistics panel, and Session Redactions showing detected PII
    AI detection is on with all categories selected. The Session Redactions panel shows intercepted PII (e.g. "Bob" detected as private_person).
  3. Open OpenCode

    Launch OpenCode. You'll see the main interface with the chat input and the current model selector.

    OpenCode main screen showing New session with chat input and model selector showing Big Pickle
    OpenCode main screen with the chat input and model selector.
  4. Open the model selector

    Type /model in the chat input to open the model selection dialog. You can also press Ctrl+' as a shortcut.

    OpenCode with /model typed in chat input showing model selection prompt
    Type /model to open the model selector.
  5. Click "Connect provider"

    In the model selection dialog, click the Connect provider button at the top right to add a new provider connection.

    OpenCode model selection dialog with Connect provider button at top right
    Click Connect provider to add Agent Redactor.
  6. Select "Custom OpenAI-compatible provider"

    From the provider list, scroll to the Other section and select Custom OpenAI-compatible provider. This lets you point OpenCode at any OpenAI-compatible endpoint.

    OpenCode Connect provider dialog showing provider list with Custom OpenAI-compatible provider under Other section
    Select Custom OpenAI-compatible provider from the Other section.
  7. Fill in the provider details

    Enter the following in the custom provider form:

    • Provider ID: agent-redactor
    • Display name: Agent Redactor
    • Base URL: http://localhost:8080/ (must match the port in Agent Redactor)
    • API key: Leave empty. Agent Redactor manages authentication via headers
    OpenCode custom provider form with Provider ID agent-redactor, Display name Agent Redactor, Base URL http://localhost:8080/
    Fill in the provider details. The Base URL must match your Agent Redactor proxy port.
  8. Add your model and submit

    Scroll down to the Models section. Enter the model ID (e.g. nvidia/nemotron-3-ultra-550b-a55b:free) and a display name (e.g. "Nemotron 3 Ultra"). Click Submit to save.

    OpenCode custom provider form Models section with model ID nvidia/nemotron-3-ultra-550b-a55b:free and Submit button
    Add the model and click Submit.
  9. Select your model

    Back in the /model dialog, search for "agent" and you'll see your Agent Redactor provider with the model listed underneath. Select it to route all requests through the proxy.

    OpenCode model selector searching for agent showing Agent Redactor provider with Nemotron 3 Ultra(Free)
    Search for "agent" to find your Agent Redactor provider and select the model.
  10. Start chatting

    Send a message. In this example, the user said "My name is Bob". Agent Redactor detected "Bob" as PII, redacted it before forwarding to the LLM, and restored it in the response.

    OpenCode chat showing conversation through Agent Redactor with name Bob redacted and restored in response
    "Bob" was redacted on the way out and transparently restored on the way back.

Verifying redaction

Check the Session Redactions panel in Agent Redactor to see exactly what was intercepted.

Agent Redactor Statistics showing Requests: 1, PII: 1 and Session Redactions showing PII private_person Bob
The Statistics panel shows "Requests: 1, PII: 1" and Session Redactions lists the intercepted value 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.