Skip to main content
Pi is a terminal coding agent that supports custom providers and models through ~/.pi/agent/models.json. By adding A2Agent as a custom provider, you can route Pi requests through A2Agent and select supported models from the /model picker.

Prerequisites

Setup

1

Create a custom A2Agent provider

Create or edit Pi’s custom model configuration:
Add the following configuration:
The model IDs above are examples. Model availability may change, so use the exact IDs currently shown on the A2Agent Models page.
2

Start Pi and select an A2Agent model

Start Pi from the project directory:
Inside Pi, enter:
Select:
Then choose one of the configured models.
3

Run a test request

Start a new Pi session and enter:
You can also run a one-shot request:
If Pi returns a response, the A2Agent connection is working.

Troubleshooting

Pi reached A2Agent, but the API key was rejected.
  • Confirm that the key is a valid A2Agent API key.
  • Check for accidental spaces or line breaks.
  • Do not use an OpenAI API key for A2Agent.
Confirm that the base URL is exactly:
Make sure:
  • the /v1 path is included;
  • the URL does not contain /models or /chat/completions;
  • api is set to openai-completions; and
Check the following:
  • the file is located at ~/.pi/agent/models.json;
  • the JSON syntax is valid;
  • the Provider name is a2agent;
  • at least one model is listed under models;
  • the model ID is spelled correctly.Check the current list at:A2Agent Models page
The model ID must match an available A2Agent model exactly.Check the current list at:A2Agent Models pageModel IDs and availability may change over time. Update the models array with the current ID, then reopen /model.