pi-cliproxyapi-quota

Pi extension: view subscription quota for every OAuth provider CLIProxyAPI holds (Claude, Antigravity/Gemini, Codex, Kimi, xAI) inside pi, plus a /think command and thinking-level footer.

Packages

Package details

extension

Install pi-cliproxyapi-quota from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-cliproxyapi-quota
Package
pi-cliproxyapi-quota
Version
0.2.6
Published
Sep 4, 2026
Downloads
1,335/mo · 187/wk
Author
huimingsong
License
MIT
Types
extension
Size
32.9 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-cliproxyapi-quota

npm version license

English | 中文

A pi extension for users who route their AI subscriptions into pi through CLIProxyAPI / EasyCLIProxyAPI.

It adds two things pi doesn't surface for reverse‑proxied models:

  1. Quota — see subscription limits for every OAuth provider the proxy holds without leaving pi.
  2. Thinking level — a /think command and a footer indicator for the active reasoning effort.

Supported providers: Claude, Antigravity / Gemini Code Assist, and Kimi (verified), plus Codex and xAI / Grok (best‑effort, shown as (unverified) until confirmed against a real account — see Scope).

Features

Trigger What it does
/quota For each credential the proxy holds, show every quota window: used %, remaining %, reset countdown.
Ctrl+Shift+Q Same as /quota, but works while the model is streaming (it's a shortcut, not a queued command).
footer Quota[claude] 5h 64% left · 7d 95% left Remaining % for the provider of the current model (follows model switches; falls back to the first credential). Auto‑refreshed at the start/end of each turn (throttled to 60s).
/think [level] Show or set thinking level (off/minimal/low/medium/high/xhigh/max), clamped to the model.
footer 🧠 high Always‑visible current thinking level (native Shift+Tab also cycles it).

The quota data path mirrors the EasyCLIProxyAPI control panel exactly: the proxy management API POST /v0/management/api-call proxies each provider's own usage endpoint (e.g. Anthropic /api/oauth/usage, Google retrieveUserQuotaSummary) using the stored OAuth credential. These endpoints report utilization; they do not consume quota. Disabled credentials are skipped.

Install

pi install npm:pi-cliproxyapi-quota
# or from git:
pi install git:github.com/songhuiming2007-coder/pi-cliproxyapi-quota

Or load a local checkout by adding its path to ~/.pi/agent/settings.json:

{ "extensions": ["/absolute/path/to/pi-cliproxyapi-quota/index.ts"] }

Reload pi (/reload) after installing.

Configuration

No secrets are stored in this package. At runtime it resolves:

Base URL (proxy): CLIPROXYAPI_BASE_URL~/.pi/agent/cliproxyapi.json baseUrlhttp://127.0.0.1:8317

Management key (required for /quota), in order:

  1. env CLIPROXYAPI_MANAGEMENT_KEY
  2. ~/.pi/agent/cliproxyapi-quota.json{ "managementKey": "..." }
  3. EasyCLIProxyAPI GUI config.toml (management-secret-key), auto‑located per‑OS:
    • macOS: ~/Library/Application Support/com.cpa.gui/config.toml
    • Linux: $XDG_CONFIG_HOME/com.cpa.gui/config.toml
    • Windows: %APPDATA%\com.cpa.gui\config.toml

If you don’t run the GUI, set CLIPROXYAPI_MANAGEMENT_KEY (must match your proxy's remote-management.secret-key) or the JSON override.

Scope & limitations

  • Verified (tested against live accounts): claude, antigravity / gemini.
  • Unverified (ported from the EasyCLIProxyAPI panel, endpoints + parsers wired but not yet tested against a real account): codex, xai / grok. These are labelled (unverified) in the output. If one is wrong for your account, please open an issue with the raw response — easy to fix.
  • Reads a local management key to call the localhost management API; nothing is sent anywhere except your own proxy and each provider's usage endpoint (through that proxy). Disabled credentials are skipped.

License

MIT


中文说明

适用于通过 CLIProxyAPI / EasyCLIProxyAPI 把各 AI 订阅接入 pi 的用户。它补上了 pi 对反向代理模型不暴露的两件事:

  1. 额度 — 在 pi 里直接看代理持有的每个 OAuth 提供方的订阅限额。
  2. 思考强度/think 命令 + footer 常驻显示当前推理档位。

支持的提供方:ClaudeAntigravity / Gemini Code AssistKimi(已验证),以及 CodexxAI / Grok(尽力支持,在真实账号上校准前显示为 (unverified))。

功能

触发 作用
/quota 对代理持有的每个凭证,显示其所有配额窗口:已用 %、剩余 %、重置倒计时。
Ctrl+Shift+Q /quota,但模型正在输出时也能按(快捷键,不会被排队)。
footer Quota[claude] 5h 64% left · 7d 95% left 显示当前模型对应服务的剩余 %(随模型切换,取不到时回退到第一个凭证);每轮开始/结束自动刷新(60s 节流)。
/think [level] 查看/设置思考强度(off/minimal/low/medium/high/xhigh/max,受模型能力限制)。
footer 🧠 high 常驻显示当前思考强度(原生 Shift+Tab 也能循环切换)。

取数链路与 EasyCLIProxyAPI 控制面板完全一致:代理管理 API POST /v0/management/api-call 用存储的 OAuth 凭证代理请求各提供方自己的用量端点(如 Anthropic /api/oauth/usage、 Google retrieveUserQuotaSummary)。这些端点只报告用量,不消耗额度;禁用的凭证会跳过。

安装

pi install npm:pi-cliproxyapi-quota
# 或从 git:
pi install git:github.com/songhuiming2007-coder/pi-cliproxyapi-quota

或把本地目录的路径加到 ~/.pi/agent/settings.json

{ "extensions": ["/absolute/path/to/pi-cliproxyapi-quota/index.ts"] }

安装后 /reload 重载 pi。

配置

本包不存储任何密钥,运行时解析:

Base URL(代理):CLIPROXYAPI_BASE_URL~/.pi/agent/cliproxyapi.jsonbaseUrlhttp://127.0.0.1:8317

管理密钥/quota 必需),按顺序:

  1. 环境变量 CLIPROXYAPI_MANAGEMENT_KEY
  2. ~/.pi/agent/cliproxyapi-quota.json{ "managementKey": "..." }
  3. EasyCLIProxyAPI GUI 的 config.tomlmanagement-secret-key),按系统自动定位:
    • macOS:~/Library/Application Support/com.cpa.gui/config.toml
    • Linux:$XDG_CONFIG_HOME/com.cpa.gui/config.toml
    • Windows:%APPDATA%\com.cpa.gui\config.toml

不用 GUI 的话,设置 CLIPROXYAPI_MANAGEMENT_KEY(需与代理的 remote-management.secret-key 一致)或用上述 JSON 覆盖。

范围与限制

  • 已验证(在真实账号上实测):claudeantigravity / gemini
  • 未验证(按 EasyCLIProxyAPI 面板移植,端点与解析已接但未在真实账号上跑过):codexxai / grok,输出里标 (unverified)。若某家在你账号上不对,请带原始返回开 issue,很容易修。
  • 仅读取本地管理密钥去调本机管理 API;除了你自己的代理和(经代理的)各提供方用量端点,不向任何地方发送数据;禁用的凭证会跳过。

许可证

MIT