pi coding agent

Run the pi coding agent through Aiduct.

pi reads custom providers from ~/.pi/agent/models.json. Aiduct speaks every API pi supports, so each model can use the protocol that suits it best.

~/.PI/AGENT/MODELS.JSON
{
  "providers": {
    "aiduct": {
      "baseUrl": "https://api.aiduct.ai/v1",
      "api": "openai-completions",
      "apiKey": "$AIDUCT_API_KEY",
      "models": [{ "id": "deepseek-v4.1-flash" }, { "id": "glm-5.3" }]
    },
    "aiduct-claude": {
      "baseUrl": "https://api.aiduct.ai",
      "api": "anthropic-messages",
      "apiKey": "$AIDUCT_API_KEY",
      "models": [{ "id": "claude-sonnet-5", "input": ["text", "image"] }]
    }
  }
}

CONFIG

models.json

PROTOCOL

Messages + Chat

BILLING

Published pricing

One provider per protocol

Claude models answer natively on Anthropic Messages, keeping extended thinking and prompt caching intact. Every other catalog model works on OpenAI chat. Point each provider at the base URL its protocol expects.

Keep the key out of the file

pi expands $AIDUCT_API_KEY from the environment when it sends a request, so models.json holds no secret.

FAQ

Which base URL does each pi API use?+

openai-completions and openai-responses use https://api.aiduct.ai/v1. anthropic-messages and google-generative-ai use https://api.aiduct.ai, because their SDKs add the version path themselves.

Can pi use Gemini models through Aiduct?+

Yes. Add a provider with the google-generative-ai API and the gateway root, or reach any Gemini model through openai-completions.

Do pi's thinking levels work?+

Yes. pi's levels from off to max map onto each model's own reasoning controls, and a level a model lacks rounds up to the nearest one it has.