pi-gemini-oauth-apikey
Multi-account Google Gemini (Cloud Code Assist OAuth) rotation pool for pi — register N accounts, auto-rotate on 429. Depends on @qraxiss/pi-gemini-auth for the OAuth/provider implementation.
Package details
Install pi-gemini-oauth-apikey from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-gemini-oauth-apikey- Package
pi-gemini-oauth-apikey- Version
0.1.0- Published
- Jun 27, 2026
- Downloads
- 215/mo · 20/wk
- Author
- vforvaick
- License
- MIT
- Types
- extension
- Size
- 15.1 KB
- Dependencies
- 1 dependency · 0 peers
Pi manifest JSON
{
"extensions": [
"./src/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-gemini-oauth-apikey
Multi-account Google Cloud Code Assist (Gemini CLI) OAuth rotation pool for
pi. Register N Google accounts as separate providers and
auto-rotate on 429/RESOURCE_EXHAUSTED — get ~N × 1500 RPD of free Gemini quota.
Complements pi-key-pool (which rotates
API keys): this package rotates OAuth accounts (Code Assist tier,
~6× the per-account RPD, separate quota bucket).
What it does
- Registers
gemini-pool-1…gemini-pool-Nas OAuth providers - Each is independently loggable via
/login - On a 429/rate-limit error, marks the current account exhausted, switches to the next available one, and replays your last message automatically
- Time-based cooldown recovery (quota 60s, capacity 30s, network skipped)
Why
pi-multi-pass supports multi-account OAuth rotation but its Gemini login
(loginGeminiCli) was removed from upstream pi, so /subs login google-gemini-cli-N
throws is not a function. This package reuses
@qraxiss/pi-gemini-auth (which
restored that OAuth flow as a standalone package) for the login/provider
implementation, and adds the rotation layer on top. No pi-core patching.
Install
pi install npm:pi-gemini-oauth-apikey
Then restart pi. (You can now uninstall @qraxiss/pi-gemini-auth as an active
extension — this package depends on it as a library instead.)
Configure
Optional. Edit ~/.pi/agent/gemini-pool.json (defaults to 4 slots if absent):
{
"accounts": [
{ "id": "1", "label": "Work Pro" },
{ "id": "2", "label": "Personal Pro" },
{ "id": "3", "label": "Side Pro" },
{ "id": "4", "label": "Backup Pro" }
],
"cooldown": { "quota": 60000, "capacity": 30000, "network": 0 }
}
Login each account
/login → pick "Gemini Pool 1" → browser OAuth (account 1)
/login → pick "Gemini Pool 2" → account 2
... (repeat per account)
/model gemini-pool-1/gemini-2.5-flash
That's it. When gemini-pool-1 hits a 429, the turn transparently retries on
gemini-pool-2, and so on. When all are exhausted you get a warning and a
cooldown timer.
How it works
before_agent_start → remember last user prompt
agent_end → if stopReason=="error" && isRateLimit(msg):
markExhausted(current); pickNext() → setModel + sendUserMessage
failover.ts is a pure, unit-tested state machine (round-robin + cooldown +
auth-gated availability). Provider/OAuth/streaming come from qraxiss.
Tests
node --test --experimental-strip-types test/*.test.ts
Stdlib only (node:test) — no test dependencies.
License
MIT