@heyhuynhgiabuu/pi-oauth-antigravity

Google Antigravity OAuth provider extension for Pi with Gemini 3.8, prompt cache session affinity, and trajectory chaining.

Packages

Package details

extension

Install @heyhuynhgiabuu/pi-oauth-antigravity from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@heyhuynhgiabuu/pi-oauth-antigravity
Package
@heyhuynhgiabuu/pi-oauth-antigravity
Version
0.3.5
Published
Nov 27, 2026
Downloads
2,021/mo · 1,077/wk
Author
killerkidbo
License
MIT
Types
extension
Size
254 KB
Dependencies
2 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./dist/index.js"
  ]
}

Security note

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

README

@heyhuynhgiabuu/pi-oauth-antigravity

Google Antigravity OAuth provider extension for Pi. Connects Pi directly to Google Cloud Code Assist / Antigravity with zero-friction OAuth login, day-one support for Gemini 3.8 Flash, prompt-cache session affinity, and image generation.

Features

  • Google OAuth Login: Browser-based PKCE flow with local loopback callback (localhost:51121) and headless paste-URL fallback. Automatically handles token refresh with AbortSignal forwarding.
  • Day-One Gemini 3.8 Flash: First-class support for gemini-3.8-flash with dynamic effort-tier routing (-low, -medium, -high), 65,536 max output token clamping, and fallback resilience.
  • Prompt Cache Affinity & Trajectory Chaining:
    • Deterministic 63-bit session IDs derived from initial turn content.
    • Monotonic trajectory tracking (agentId, trajectoryId, stepIndex).
    • Response ID chaining via labels.last_execution_id.
    • Endpoint stickiness to prevent cluster hopping across Google's daily and fallback endpoints.
    • Cross-restart session state persistence (.pi/agent/cache/antigravity-sessions.json) to maintain cluster affinity across quick Pi restarts.
  • Image Generation: Built-in generate_image tool and /antigravity.image command powered by Google's image models with aspect-ratio selection and safe directory containment.
  • Diagnostic & Usage Tools:
    • /antigravity.usage — shared quota pools (Gemini 5h/weekly, Claude+GPT 5h) with plan tier and reset countdowns.
    • Optional unified dashboard: install pi-usage-core and the same pools also appear in the shared /usage dashboard and footer status line.
    • /antigravity.models — backend discovery of available Cloud Code Assist models and remaining pool fractions.
    • /antigravity.doctor — connection check, token expiry inspection, and diagnostic dump.

Supported Models

Public Model ID Backend Wire ID Max Output Context Window
antigravity/gemini-4-neon gemini-4-neon-{low,medium,high,xhigh}† 65,536 1,048,576
antigravity/gemini-4-hydrogen gemini-4-hydrogen-{low,medium,high,xhigh}† 65,536† 1,048,576†
antigravity/gemini-4-carbon gemini-4-carbon-{low,medium,high}† 65,536† 1,048,576†
antigravity/gemini-4-argon gemini-4-argon-{low,medium,high} 65,536† 1,048,576†
antigravity/gemini-3.8-flash gemini-3.8-flash-{low,medium,high} 65,536 1,048,576
antigravity/gemini-3.7-flash gemini-3.7-flash-{low,medium,high} 65,536 1,048,576
antigravity/gemini-3.7-flash-thinking gemini-3.7-flash-thinking 65,536 1,048,576
antigravity/gemini-3.6-flash gemini-3.6-flash-{low,medium,high} 65,536 1,048,576
antigravity/gemini-3.1-pro gemini-3.1-pro 65,536 1,048,576
antigravity/claude-opus-5-5-low claude-opus-5-5-low 64,000* 250,000*
antigravity/claude-opus-5-5-medium claude-opus-5-5-medium 64,000* 250,000*
antigravity/claude-opus-5-5-high claude-opus-5-5-high 64,000* 250,000*
antigravity/claude-sonnet-5-5-low claude-sonnet-5-5-low 64,000* 200,000*
antigravity/claude-sonnet-5-5-medium claude-sonnet-5-5-medium 64,000* 200,000*
antigravity/claude-sonnet-5-5-high claude-sonnet-5-5-high 64,000* 200,000*

Neon (2026-11-18, Antigravity's default model) and Hydrogen (2026-11-12) have an -xhigh effort tier; Carbon (2026-11-10) and Argon (2026-10-13) top out at High. The Gemini 4 models are entitlement-gated (Ultra / Enterprise / paid Pro); a rejected or throttled request falls back through the Gemini 4 family (Neon → Hydrogen → Carbon → Argon) to Gemini 3.8 Flash. A transient 429 honors the server's wait hint from the Retry-After header or the body's RetryInfo detail before moving to the fallback model; an explicit QUOTA_EXHAUSTED reason fails fast like plan quota. Neon's wire id matches CLIProxyAPI's registry; its listed context (1M) comes from the same registry — Antigravity's own doc says 512K, untested either way.

claude-opus-4-6-thinking, claude-sonnet-4-6 and gpt-oss-120b-medium were removed by Google on 2026-11-18 and are no longer selectable; pinned overrides to their wire ids still resolve until the backend drops them, and their retirement notices are detected and surfaced as errors instead of assistant text.

Third-party OAuth is a ToS risk

Google also fingerprints third-party clients by request content: requests whose system text or tool descriptions carry the harness name are answered with 429 RESOURCE_EXHAUSTED before quota is even considered. The extension scrubs its name from system instructions and tool descriptions it authors (message text is left untouched). On lanes that enforce a small per-request input budget, set ANTIGRAVITY_COMPACT_PROMPT=1 to run with a bundled compact preamble — see the changelog for the verified scope.

On accounts whose requests are limited to a small input budget (observed ~500-750 input tokens per request on the shared consumer lane, tightening after 429 bursts), the full default Pi system prompt (~4k tokens) cannot fit at all. Set ANTIGRAVITY_COMPACT_PROMPT=1 to swap the prompt preamble for a bundled ~1.9KB compact one and drop the fingerprint-heavy <docs>/<tools>/<rules> sections — Pi's <project_context> (AGENTS.md), <skills>, and <cwd> sections are preserved, so AGENTS.md rules and skills keep working. Point the variable at a file path to supply your own preamble instead. Skills keep working normally: listing them is a system section, and reading a skill's SKILL.md is a runtime read-tool call.

Google's enforcement against third-party Antigravity OAuth clients is active: appeal forms name "using third party software to access Antigravity", and 403 PERMISSION_DENIED / TOS_VIOLATION reports against third-party clients exist (oh-my-pi paused its provider on 2026-11-14 for this reason). Using this extension may put your Google account at risk — prefer the official Antigravity IDE/CLI when possible, and don't say you weren't warned.

† Gemini 4 family: Argon wire ids verified against live discovery (2026-10-14); Carbon/Hydrogen wire ids follow the family pattern but are UNVERIFIED against a live listing. Limits and pricing are same-family estimates; a rejected request falls back to the previous Gemini 4 model, then Gemini 3.8 Flash.

* Claude Opus 5.5 / Sonnet 5.5 are officially served (2026-11 models doc, live discovery since 2026-10-03); the listed output/context figures stay same-family estimates until Google publishes 5.5-specific numbers.

The request identity tracks the shipping client (antigravity/hub/2.32.1) and every call sends fresh x-cloudaicompanion-trace-id / X-Aicode-Request-Id headers — a stale client identity silently receives a REDUCED model catalog from discovery, without an error.

Installation

Install directly into Pi via npm:

pi install npm:@heyhuynhgiabuu/pi-oauth-antigravity

Or run directly from source:

pi -e /path/to/pi-oauth-antigravity/dist/index.js

Setup & Login

  1. Run Pi and start the OAuth login:
    pi auth login --provider antigravity
  2. Your browser will open the Google Sign-In page. Sign in with your Google account.
  3. Once authenticated, the extension saves credentials and discovers your available Cloud Code Assist project.
  4. Select or switch to any Antigravity model:
    pi --model antigravity/gemini-3.8-flash

Slash Commands

  • /antigravity.usage — View shared quota pools (Gemini 5h/weekly, Claude+GPT 5h), plan tier, and reset countdowns.
  • /antigravity.models — List dynamically fetched and statically registered models + remaining pool fraction.
  • /antigravity.doctor — Diagnose OAuth state, refresh token health, and endpoint connectivity.
  • /antigravity.image <prompt> [--aspect 1:1|16:9|...] — Generate images directly to your project.

Optional: unified /usage dashboard. This extension always works standalone. If you also install pi-usage-core (pi install npm:pi-usage-core), the Antigravity pools are additionally registered into its interactive /usage dashboard and persistent footer status line. /antigravity.doctor reports which mode is active on the usageCore= line.

Development

# Install dependencies
npm install

# Run unit tests (84 tests)
npm test

# Typecheck
npm run typecheck

# Build TypeScript to dist/
npm run build

Credits & Upstream

Vendored and adapted from Rahularya01/pi-antigravity (MIT License) with prompt-cache session affinity, day-one Gemini 3.8 Flash catalog, response chaining, and cross-process persistence.

License

MIT © 2026 huynhgiabuu