← Catalog

@adeildo/pi-providers

Provider features for Pi. Bills Anthropic OAuth requests to the Claude Pro or Max plan, keeps several accounts per provider, keeps the prompt cache warm while you are away, and adds OpenAI-compatible endpoints from /login.

Extension

Install

Install with PiG

pig install npm:@adeildo/pi-providers

Install with Pi

pi install npm:@adeildo/pi-providers
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 7.1.0 (README.md). PiG does not review it.

@adeildo/pi-providers

npm pi SDK

Get more out of the plans and accounts you already have: bill pi to your Claude plan, keep several accounts per provider, keep the prompt cache warm while you are away, and add any OpenAI-compatible endpoint.

pi install npm:@adeildo/pi-providers

Your Claude plan

With a Claude Pro or Max plan connected through /login anthropic, pi's requests count as extra usage, billed by the token. With this package, they come out of the plan instead, the way Claude Code's requests do.

[!WARNING] This works by presenting pi to Anthropic as Claude Code, and using a subscription outside Claude Code may break Anthropic's terms. It is on as soon as you install the package. To turn it off, switch the subscription feature off in pi config. Requests that use an API key go out unchanged.

Once the plan pays, pi's warning about extra usage is wrong. Turn it off in ~/.pi/agent/settings.json:

{ "warnings": { "anthropicExtraUsage": false } }

Several accounts

Keep more than one account per provider, such as a work one and a personal one.

WhereWhat you do
/accountsList the accounts of the current provider, with what each plan has left
EnterUse the account under the cursor
a, r, dAdd, rename or remove an account
Alt+ASwitch the account of this session

When an account hits its limit, pi can ask you, switch to the next account on its own, or stop. accounts.onLimit decides, and it asks by default. A switch only happens before anything was shown, so you never see the same answer twice.

A warm prompt cache

Anthropic keeps a prompt in cache for 5 minutes. While the agent waits for you, pi can send the last request again before then, so your next message reads the prompt from the cache instead of paying to write it again. On Opus 5.5, a refresh costs 5% of the input price, and a miss costs 125%.

By default, this package learns how long you usually take to answer, and refreshes only while that pays for itself. That keeps Opus 5.5 warm for about 23 minutes. It needs pi's cacheWarming setting on idle, which is pi's default.

OpenAI-compatible endpoints

Add DeepInfra, a vLLM box, an Ollama server or any endpoint that speaks OpenAI's chat completions. In /login, pick Sign in with an API key, then OpenAI-compatible endpoint, and give it a name, a base URL and a key. Its chat models then show up in /model.

Settings

These are in ~/.pi/agent/extensions/pi-harness/settings.json, and on the Providers tab of Alt+S.

KeyDefaultWhat it does
accounts.onLimit"ask"What a quota or rate limit does when you have another account: ask, switch or stop
accounts.onAuthFailure"ask"What a refused credential does: ask (sign in again or switch), switch or stop
cache.strategy"learned"How refreshes are decided: learned, pi, minutes or off
cache.upTo20How many minutes minutes keeps refreshing after the last request

Learn more

  • How it works: what Anthropic checks before it bills the plan, accounts in detail, how the cache refresh is decided, and how endpoints are read.
  • Quota: where the numbers about what your plan has left come from.

The Claude plan billing comes from pi-claude-max, and several accounts per provider follow pi-multiprovider. Both are MIT.

adeildo.dev
pi-harness is made by adeildo.dev