# plugin_google_quota — Google Antigravity Quotas for SCORPIOX BOT `plugin_google_quota` is a **zero-dependency C99 node plugin** for [SCORPIOX BOT](https://bot.scorpiox.net). It reads the local Google Antigravity account list (`antigravity_accounts.json`) and active selection (`selected_account.txt`), queries per-model quota pools through the node's `scorpiox-google-quota` CLI, and lets you switch the active account in one click. * `--meta` -> `{"name":"google quota","desc":"Account quotas"}` * `--version` -> `plugin_google_quota 1.0.1` * Catalog slug `google-quota`, category `devtools` * Public source: * Prebuilt binaries: --- ## Why this plugin has no TLS code and no client secret Refreshing Google OAuth tokens and calling `cloudcode-pa` requires an OAuth client identity and TLS. A public, clean-room repository must not carry an OAuth client secret, so this plugin does not speak TLS at all. It drives the node's own `scorpiox-google-quota` CLI (which ships with SCORPIOX CODE) and reads the same credential files written by `scorpiox-antigravity-login`: | Path | Access | Purpose | |---|---|---| | `~/.config/google-accounts/antigravity_accounts.json` | Read-only | Account emails + `refresh_token` presence | | `~/.config/google-accounts/selected_account.txt` | Read / Write | Active account email (updated on `switch`) | **No token is ever printed, logged or returned.** When reading `antigravity_accounts.json`, only `email` and a boolean `has_refresh` flag are extracted; token strings are never copied or emitted. --- ## Requirements on the node | Platform | Needs | |---|---| | Linux / macOS / Windows | `scorpiox-google-quota` on `PATH` (ships with SCORPIOX CODE) | | Build / runtime | Zero external library dependencies (pure C99 stdlib) | --- ## Environment overrides | Variable | Effect | |---|---| | `GOOGLE_ACCOUNTS_FILE` | Path to `antigravity_accounts.json` (also accepts `ANTIGRAVITY_CREDS_PATH`) | | `GOOGLE_SELECTED_FILE` | Path to `selected_account.txt` (default: sibling of `GOOGLE_ACCOUNTS_FILE`) | | `GOOGLE_QUOTA_BIN` | Quota CLI binary (default: `scorpiox-google-quota`) | | `BOT_PASSWORD` | When set, every route except `--meta` and `--version` requires it | --- ## API All actions accept `X-Bot-Password`, `Authorization: Bearer`, or `?pwd=`. * `GET ?action=status` — fast local read of configured accounts, `selected`, paths, and `cli_present` * `GET ?action=quota` (or `?format=json`) — queries all accounts concurrently and returns Gemini/Claude pool summaries, reset times (`reset_time`, `reset_in_seconds`, `reset_in_hours`, `reset_remaining`), per-model buckets, `best_gemini`, and `best_claude` * `GET ?action=quota&account=` — queries a single account * `GET/POST ?action=switch&account=` (or JSON body `{"account":"..."}`) — validates the email against `antigravity_accounts.json` and writes `selected_account.txt` --- ## Build, test & install ```sh make # build ./plugin_google_quota make test # run offline test suite (tests/run.sh) make install # install to ~/.scorpiox/plugins/ (or /workspace/.scorpiox/plugins/) ``` Cross-compile targets: `make musl`, `make arm64`, `make win64`, `make macos`, or `powershell -ExecutionPolicy Bypass -File build.ps1` on Windows.