pi-antigravity-rotator
Multi-account rotation proxy for Google Antigravity with per-model routing, real-time quota tracking, and infringement detection
Package details
Install pi-antigravity-rotator from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-antigravity-rotator- Package
pi-antigravity-rotator- Version
2.6.1- Published
- Aug 1, 2026
- Downloads
- 2,176/mo · 608/wk
- Author
- tuxevil
- License
- MIT
- Types
- package
- Size
- 1.1 MB
- Dependencies
- 2 dependencies · 0 peers
Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README

Pi Antigravity Rotator
Production-ready OpenAI-compatible gateway for Google Antigravity.
Multi-account load balancing, per-model quota routing, account health scoring, access control with Virtual Keys, and cost auditing — via a single local endpoint that any agent can use. Even with a single account.
⚠️ WARNING: Using this proxy may put connected Google accounts at risk of Terms of Service enforcement, including restriction, suspension, or permanent bans. Use at your own risk.
[!CAUTION] This is an unofficial tool and is not endorsed by Google. Routing traffic through this proxy may violate Google's Terms of Service or trigger automated abuse or policy enforcement systems.
By using this proxy, you acknowledge:
- Your account may be restricted, suspended, shadow-banned, or permanently banned
- Multi-account rotation and proxying can increase account risk compared to normal interactive usage
- You assume all responsibility for the accounts and traffic routed through this tool
Recommendation: Do not use your primary Google account. Prefer disposable or lower-risk accounts, and keep account exposure conservative.
v2.6 Highlights
- Lossless Prompt Compression: Optional Lite and RTK compression modes preserve code-critical content while reducing prompt size. Enable
compressionModeinaccounts.jsonor override a request withX-Rotator-Compression: lite,rtk, orrtk+lite. - Operational Observability:
X-Rotator-*response headers expose routing, latency, token, cost, health, idempotency, and compression metrics without changing response bodies. - Reliable Request Handling: Configurable pre-flush stream recovery, duplicate-request idempotency, asynchronous persistence, and an active-account benchmark improve production operations.
- Dashboard Workspaces: Refined Accounts, Virtual Keys, Spend Logs, telemetry, and notification experiences with responsive layouts, filtering, and consistent PII masking.
- Security Hardening: Refresh tokens now use salted
scryptplus AES-256-GCM for new encrypted records, legacy encrypted tokens remain readable, and public error responses no longer expose internal details.
v2.5 Highlights
- Automated GHCR Multi-arch Builds: Official Docker images (
linux/amd64,linux/arm64) automatically built and published to GitHub Container Registry. - Pre-built Docker Deployment: Updated
docker-compose.ymlto pull pre-built GHCR images directly out-of-the-box.
v2.4 Highlights
- Virtual Keys & Scoped Access Control: Generate scoped API keys (
rk-...) with per-key model authorization rules and user tracking. - Spend Logging & Audit Inspector: PostgreSQL audit trail of all requests, token metrics, TTFB/Total duration, Base64 media sanitization, 6-decimal USD cost breakdown, and Request/Response payload viewer.
- Multi-page Web Dashboard: Unified header navigation connecting Accounts, Virtual Keys, and Spend Logs, featuring customizable column visibility, search/filtering, and instant PII masking.
- PostgreSQL Persistence Backend: Enable
PI_ROTATOR_DATABASE_URLfor high-concurrency key validation, persistent spend logging, and retention policies.
Compression and token encryption
Compression is disabled by default. To enable a default mode, add this field to accounts.json:
{
"compressionMode": "lite"
}
For a single request, send X-Rotator-Compression: lite, rtk, or rtk+lite. The response reports the selected mode and savings through X-Rotator-Compression-* headers.
To encrypt refresh tokens at rest, set a secret before starting the rotator. A 64-character hexadecimal key is recommended:
export PI_ROTATOR_ENCRYPTION_KEY="$(openssl rand -hex 32)"
pi-antigravity-rotator start
Existing enc:v1 records remain decryptable during migration; newly written records use enc:v2.
Features
- OpenAI-compatible gateway — Drop-in replacement endpoint (
/v1/chat/completions,/v1/responses,/v1/messages) for any agent or tool - Multi-account load balancing — Distributes traffic across a pool of Google accounts with per-model independent routing
- Smart rotation & health scoring — Four routing policies (
timer-first,tier-first,quota-first,hybrid) with composite health scores per account - Real-time quota monitoring — Polls Google's quota API every 5 minutes with per-model, per-account tracking
- Infringement & abuse detection — Flags accounts on enforcement signals and triggers protective pause to preserve the rest of the pool
- Virtual Keys & access control — Issue scoped
rk-...keys for teams, agents, or CI pipelines with per-key model restrictions - Spend logging & audit inspector — Full request/response audit trail with 6-decimal USD cost estimates (requires PostgreSQL)
- Web dashboard — Real-time routing state, quota bars, latency tracking (p50/p95), savings chart, activity heatmap, and routing inspector
- State persistence — Survives restarts; routing assignments, cooldowns, and flags saved to disk or PostgreSQL
- Tool/function calling — Fully supported in OpenAI and Anthropic formats, including multi-turn and parallel tool calls
- Reasoning/thinking visibility — Interleaved thinking blocks exposed as
reasoning_content/thinking_deltain real time
Quick Start
Requirements: Node.js 22+ for npm/source installs. Docker image uses Node 22.
Option A: npm
npm install -g pi-antigravity-rotator
pi-antigravity-rotator login
pi-antigravity-rotator start
Option B: Docker
mkdir -p docker-data
docker compose up -d
Option C: Source
git clone https://github.com/tuxevil/pi-antigravity-rotator.git
cd pi-antigravity-rotator
npm install && npm run login && npm start
Dashboard opens at http://localhost:51200/dashboard
Full deployment guide → · Adding accounts →
Connect Your Agent
Point any OpenAI-compatible agent to http://localhost:51200/v1 with API key antigravity (or a Virtual Key):
| Agent | Guide |
|---|---|
| Pi | docs/integrations/pi.md |
| OpenCode | docs/integrations/opencode.md |
| Hermes | docs/integrations/hermes.md |
| OpenClaw | docs/integrations/openclaw.md |
| Cursor | docs/integrations/cursor.md |
| Claude Code | docs/integrations/claude-code.md |
| Codex (OpenAI CLI) | docs/integrations/codex.md |
| Cline | docs/integrations/cline.md |
| Roo Code | docs/integrations/roo-code.md |
| Continue | docs/integrations/continue.md |
| Aider | docs/integrations/aider.md |
| Open WebUI | docs/integrations/open-webui.md |
Architecture
graph LR
A[Your Agent] -->|OpenAI / Anthropic API| B["pi-antigravity-rotator<br/>localhost:51200"]
B -->|Smart Routing| C[Google Account 1]
B -->|Smart Routing| D[Google Account 2]
B -->|Smart Routing| E[Google Account N]
C --> F[Google Antigravity]
D --> F
E --> F
Each model routes to its own best available account independently. Multiple agents using different models never interfere with each other's rotation.
Dashboard
After starting the proxy, open http://localhost:51200/dashboard.
The dashboard shows:
- Routing state — real-time status, uptime, requests, protective pause timers
- Account cards — quota bars, per-model timers, health scores, flagged alerts
- Token usage & savings — interactive chart with time ranges and CSV/JSON export
- Latency (p50/p95) — per-model TTFB and total duration
- Activity heatmap — 60-day GitHub-style request intensity grid
- Quota forecast — tier-weighted depletion predictions
- Routing inspector — on-demand modal with candidate scores, health-score breakdown, and rejection reasons

Virtual Keys & Spend Logging
With PostgreSQL, the gateway adds enterprise-grade access control and cost auditing.
# Set up PostgreSQL (or paste the prompt in docs/integrations/setup-postgresql.md into your AI agent)
export PI_ROTATOR_DATABASE_URL="postgres://user:pass@localhost:5432/rotatordb"
# Generate a scoped key
pi-antigravity-rotator keys generate --alias "cursor-agent" --models "gemini-3.6-flash-high"
# → rk-a1b2c3d4...
Virtual Keys guide → · Setting up PostgreSQL →
Documentation
| Topic | Link |
|---|---|
| How It Works | docs/how-it-works.md |
| Configuration | docs/configuration.md |
| Virtual Keys & Spend Logging | docs/virtual-keys.md |
| API Reference | docs/api-reference.md |
| Compatibility Adapters | docs/compatibility.md |
| Deployment | docs/deployment.md |
| Adding Accounts | docs/adding-accounts.md |
| Troubleshooting | docs/troubleshooting.md |
| Telemetry | docs/telemetry.md |
| PostgreSQL Setup | docs/integrations/setup-postgresql.md |
Star History
Support
If this tool has saved you API costs, consider supporting its development!
To donate an authorized Google account for testing, see CONTRIBUTING.md.
Contributors
Thanks to these amazing people who have contributed to the project:
- @Codder-hermes — Fixed Claude Code tool-schema requests by stripping the unsupported JSON Schema
propertyNameskeyword for Gemini and Claude-via-Gemini routes, with regression coverage for both compatibility paths. (PR #19) - @CyR1en (Ethan Bacurio) — Added the Gemini 3.6 Flash model family, shared quota-pool routing, pricing, dashboard support, and regression coverage. (PR #18)
- @josenicomaia (José Nicodemos Maia Neto) — Modularized the compatibility layer architecture, added multimodal tool response support, and fixed streaming pass-through for tool executions. (PR #8, PR #9, PR #11)
- @yashyadav711 (Yash) — Fixed Draft-2020-12 inline JSON-Schema union type mapping for Gemini tools support. (PR #10)
- @javargasm (Jeisson Alexander Vargas Marroquin) — Anthropic tool-use compatibility layer (
tool_use/tool_resultcontent block conversion), JSON schema round-trip fixes, and compat test suite expansion. (PR #3, PR #7)
Development
npm run typecheck # Type-check src/
npm run typecheck:test # Type-check src/ + test/
npm test # Run test suite
npm run check # typecheck + test + lint (full gate)