@adeildo/pi-providers

中文文档
6.0.0发布于 2026/11/02MITES Module构建来源已验证近 30 天下载 2836

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.

原始使用文档
文档目录6 节
  1. Your Claude plan
  2. Several accounts
  3. A warm prompt cache
  4. OpenAI-compatible endpoints
  5. Settings
  6. Learn more

@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. Turn on pi's cacheWarming setting (idle) to use it.

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

版本与发布记录

@adeildo/pi-providers 共发布 28 个版本,首次发布于 2026/09/30;过去 12 个月发布了 28 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
6.0.0latest2026/11/025 天前
5.15.02026/10/2414 天前
5.14.02026/10/2414 天前
5.13.02026/10/2315 天前
5.12.22026/10/2316 天前
5.12.12026/10/2216 天前

关于 @adeildo/pi-providers 的常见问题

@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.

如何安装 @adeildo/pi-providers?

在项目目录运行 npm install @adeildo/pi-providers,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@earendil-works/pi-ai(*)、@earendil-works/pi-tui(*)、@earendil-works/pi-coding-agent(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@adeildo/pi-providers 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adeildo__pi-providers 是否存在。

@adeildo/pi-providers 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@adeildo/pi-providers 可以商用吗?

@adeildo/pi-providers 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@adeildo/pi-providers 的下载量有多少?

根据 npm 官方下载统计,@adeildo/pi-providers 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,836 次,日均约 95 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adeildo/pi-providers 还在维护吗?

最新版本 6.0.0 发布于 2026/11/02(5 天前);至今共发布 28 个版本,其中过去 12 个月发布了 28 个;首次发布于 2026/09/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。