Skip to content

bastio-ai/pi-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bastio AI Security Gateway Extension for Pi

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.

Features

  • 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-messages API 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.

Installation & Setup

  1. 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
  2. Configure Credentials Pi installs git packages to ~/.pi/agent/git/github.com/bastio-ai/pi-extension/. Navigate to that directory and create a .env file 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 ~/.zshrc or ~/.bashrc)

  3. 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
    
  4. Select the Bastio Model In Pi, open the model selector (Ctrl+L or /model) and choose either:

    • Claude Sonnet 4.6 (Bastio)
    • Claude Opus 4.6 (Bastio)

How it Works

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.

Troubleshooting

  • Error: 403 Your request was blocked. Ensure that your BASTIO_API_KEY is valid and that the specific model IDs in index.ts are allowed by your Bastio proxy configuration.
  • Extension fails to load. Check that the .env file exists and is formatted correctly. The extension will print a warning to the console if the proxy ID is missing.

License

MIT

About

Bastio AI Security Gateway extension for the Pi coding agent

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors