Skip to Content
Agent ClientsCoding agents

Connect Pi to Agent Authority

Send Pi's model calls through the LLM gateway for coding agent governance, so each one is checked and recorded

When you finish, every model call Pi makes goes through the LLM gateway, where your model access rules decide it and Agent Trail records it. Pi, the minimal open-source coding agent for the terminal, has no MCP support, so it can't reach the tools behind your MCP gateway.

The steps appear in the console only when the llm_gateway feature flag is on. If you don't see the LLM Gateway page, ask your SecureAuth contact to enable it for your organization.

Pi connect steps in the console, with the models.json snippet
With the LLM gateway on, the Pi steps show the gateway's OpenAI-compatible base URL.

Setup

  1. Add the gateway as a model provider. Add the following to ~/.pi/agent/models.json, with the OpenAI-compatible base URL from Enforcement Points › LLM Gateway and a model your gateway serves:

    {
      "providers": {
        "secureauth": {
          "baseUrl": "https://your-gateway-url/gateway/llm/openai/v1",
          "api": "openai-completions",
          "apiKey": "SECUREAUTH_AGENT_TOKEN",
          "headers": { "User-Agent": "pi" },
          "models": [{ "id": "gpt-4.1-mini" }]
        }
      }
    }

    Pi reads apiKey as the name of an environment variable. The User-Agent header lets the gateway recognize Pi, which otherwise sends the OpenAI SDK's own.

  2. Start Pi. Export an agent token as SECUREAUTH_AGENT_TOKEN, then run:

    pi --provider secureauth --model gpt-4.1-mini
  3. Start using. The agent is registered on its first model call, and appears on the Agents list as Pi.

Next steps

Pi's model calls now go through the secureauth provider in ~/.pi/agent/models.json. Next, decide which models it may use.

On this page