This extension integrates Bastio AI Security Gateway with the Pi coding agent. It routes all your Pi model requests through Bastio's protective layer, ensuring your codebase, PII, and credentials remain secure while utilizing Anthropic's Claude models.
- Seamless Integration: Use Pi exactly as you normally would, but routed securely through Bastio.
- Data Protection: Automatically redacts sensitive data before it reaches the LLM.
- Native Anthropic API: Connects via the
anthropic-messagesAPI format for optimal streaming and feature support. - High Capacity Models: Out-of-the-box support for the highest capacity Claude 3.5 Sonnet and Claude 3 Opus configurations.
- Observability: Track all of your Pi tool requests, token usage, and costs directly in the Bastio dashboard.
-
Install the Extension via Pi Run the following command in your terminal to install the extension directly from GitHub:
pi install git:github.com/bastio-ai/pi-extension
-
Configure Credentials Pi installs git packages to
~/.pi/agent/git/github.com/bastio-ai/pi-extension/. Navigate to that directory and create a.envfile with your Bastio credentials:BASTIO_API_KEY=bastio_sk_... BASTIO_PROXY_ID=...
You can find your Proxy ID and create an API Key in the Bastio Dashboard.
(Alternatively, you can just set these as environment variables in your shell profile like
~/.zshrcor~/.bashrc) -
Restart Pi Restart your Pi session to load the extension. You should see a notification that the Bastio gateway is connected:
ℹ Bastio AI Security Gateway connected -
Select the Bastio Model In Pi, open the model selector (
Ctrl+Lor/model) and choose either:Claude Sonnet 4.6 (Bastio)Claude Opus 4.6 (Bastio)
This extension utilizes Pi's custom provider API (pi.registerProvider) to intercept requests. It dynamically configures the base URL to point to Bastio's Anthropic guard endpoint (https://api.bastio.com/v1/guard/{PROXY_ID}).
Because Bastio acts as a drop-in reverse proxy, Pi's built-in Anthropic handler manages the complex message formatting, tool calling, and streaming, while Bastio transparently analyzes and protects the payload in transit.
- Error: 403 Your request was blocked.
Ensure that your
BASTIO_API_KEYis valid and that the specific model IDs inindex.tsare allowed by your Bastio proxy configuration. - Extension fails to load.
Check that the
.envfile exists and is formatted correctly. The extension will print a warning to the console if the proxy ID is missing.
MIT