pi-antigravity

September 4, 2026 · View on GitHub

npm version license Sponsor

pi-antigravity is a Pi Coding Agent provider that lets Pi talk directly to Google Antigravity / Cloud Code Assist models — Gemini, plus the Claude and GPT-OSS models Antigravity also advertises. Sign in with Google, pick a model, and go. Under the hood it handles OAuth login, native streaming, model routing, and quota diagnostics itself, so it never shells out to an external Antigravity CLI.

Using OpenCode instead of Pi? Install the companion plugin @rahularya01/opencode-antigravity.

Unofficial integration. This project is not affiliated with or endorsed by Google. Use it only with an account and services you are authorized to access, and review its source before granting OAuth permissions.

Contents

Requirements

  • Pi Coding Agent and Pi AI version 0.80.0 or later
  • A Google account that can use the relevant Cloud Code Assist / Antigravity services
  • A browser to complete the Google sign-in. Same-machine is best (the browser hits the local callback automatically); on a remote/headless machine, complete sign-in anywhere and paste the resulting callback URL back into Pi (see Troubleshooting).

Install

Install from npm:

pi install npm:pi-antigravity

Or install the latest repository version:

pi install git:github.com/Rahularya01/pi-antigravity

Restart Pi (or run /reload) after installation. To update the npm package later, use pi update npm:pi-antigravity.

Quick start

  1. Start Pi and run /login antigravity.

  2. Complete Google sign-in in your browser.

  3. Select a model, for example:

    /model antigravity/gemini-3.8-flash
    
  4. Start working. If a request fails, run /antigravity.doctor for sanitized diagnostics.

Authentication and credential safety

The provider uses the OAuth 2.0 Authorization Code flow with PKCE, so credentials are only ever exchanged with Google — never typed into Pi.

  1. /login antigravity opens Google sign-in and starts a temporary callback listener at http://localhost:51121/oauth-callback.
  2. After you approve access, Pi exchanges the callback code for tokens and stores the provider credentials in Pi's auth store (normally ~/.pi/agent/auth.json).
  3. Pi refreshes access tokens automatically when they expire — you shouldn't need to sign in again unless a token is revoked.

The callback listener binds only to a loopback host, so it isn't reachable from outside your machine. The auth file it writes to contains sensitive access and refresh tokens: do not commit it, paste it into issues, or share its contents.

Signing in requests these Google OAuth scopes:

ScopeWhy it's needed
aicodeAccess to the Cloud Code Assist / Antigravity model catalog and endpoints
cloud-platformGeneral Cloud Code Assist API access
userinfo.email, userinfo.profileIdentify the signed-in Google account
cclogCloud Code Assist logging/telemetry endpoints used by the API
experimentsandconfigsServer-side experiment and config flags for the API

Review these permissions before approving access. If your credentials expire or are revoked, just re-run /login antigravity to sign in again.

Commands

CommandDescription
/login antigravitySign in to Google and configure the provider.
/model antigravity/<model-id>Choose a registered Antigravity model.
/antigravity.usageShow the server-reported shared quota groups and reset times.
/antigravity.modelsList available runtime models, remaining shared-pool quota, and capabilities.
/antigravity.models allInclude tab/chat models normally hidden from the model list.
/antigravity.refreshForce refresh the dynamic model catalog from Antigravity.
/antigravity.doctorShow sanitized provider diagnostics, including the endpoint, status, and resolved runtime model.
/antigravity.image <prompt>Generate an image via Antigravity and save it under .pi/generated-images/. Optional --ratio 16:9, --model, --path.

Model availability, entitlement, quota groups, and resets are returned by the service and can differ by account. The quota percentage shown for a model can represent a shared pool, not a private per-model allowance.

The extension also registers a generate_image tool the model can call. Images are written inside the project directory (default .pi/generated-images/). Image models such as gemini-3-pro-image are account-dependent; /antigravity.image falls back to other advertised Gemini image IDs on 404.

Models and routing

After you sign in, the provider refreshes its catalog from Antigravity (fetchAvailableModels) and groups runtime thinking variants into public Pi model IDs. Newly enabled models — for example a new Gemini Flash generation — become selectable after that refresh without waiting for an extension release. A last-known-good cache is kept for offline/cold start; the static table below is only the conservative fallback and a routing reference.

Use /antigravity.models to see live availability and quota for your account. Runtime names such as gemini-3.8-flash-low / -medium / -high collapse to gemini-3.8-flash with those thinking levels. The conservative static entries remain selectable when an account's authenticated catalog omits them.

Why Claude and GPT-OSS appear

Antigravity / Cloud Code Assist exposes a multi-provider catalog. Depending on your account, its Google-authenticated API can advertise Google Gemini models alongside Claude models served through Anthropic Vertex and GPT-OSS served through OpenAI Vertex. This extension intentionally exposes those advertised Claude and GPT-OSS models through the single antigravity provider; they are not separate Pi providers and do not use a separate Anthropic or OpenAI login.

The backend's display labels do not always match its runtime IDs. For example, gemini-3.5-flash-extra-low, gemini-3.5-flash-low, and gemini-3-flash-agent can be displayed as Gemini 3.5 Flash Low, Medium, and High. Gemini 3.8, 3.7, and 3.6 Flash use per-effort runtime IDs and send thinkingLevel; Gemini 3.5 Flash and 3.1 Pro send thinkingBudget.

Public model IDInputThinking levels shownMax output tokensRequest routing
gemini-3.8-flashText, imageLow, Medium, High65,536low → gemini-3.8-flash-low; medium → gemini-3.8-flash-medium; high → gemini-3.8-flash-high
gemini-3.7-flashText, imageLow, Medium, High65,536low → gemini-3.7-flash-low; medium → gemini-3.7-flash-medium; high → gemini-3.7-flash-high
gemini-3.6-flashText, imageLow, Medium, High65,536low → gemini-3.6-flash-low; medium → gemini-3.6-flash-medium; high → gemini-3.6-flash-high
gemini-3.5-flashText, imageLow, Medium, High65,536low → gemini-3.5-flash-extra-low; medium → gemini-3.5-flash-low; high → gemini-3-flash-agent
gemini-3.1-proText, imageLow, High65,535low → gemini-3.1-pro-low; high → gemini-pro-agent
claude-sonnet-4-6Text, imageHigh64,000high → claude-sonnet-4-6
claude-opus-4-6Text, imageHigh64,000high → claude-opus-4-6-thinking
gpt-oss-120bTextMedium32,768medium → gpt-oss-120b-medium

To limit which models Pi cycles through, enable specific entries in ~/.pi/agent/settings.json:

{
  "models": {
    "antigravity/gemini-3.8-flash": { "enabled": true },
    "antigravity/gemini-3.7-flash": { "enabled": true },
    "antigravity/gemini-3.6-flash": { "enabled": true },
    "antigravity/gemini-3.5-flash": { "enabled": true },
    "antigravity/gemini-3.1-pro": { "enabled": true },
    "antigravity/claude-sonnet-4-6": { "enabled": true }
  }
}

Configuration

All primary environment variables start with ANTIGRAVITY_. The legacy NOAGY_ prefix is also accepted for compatibility.

VariablePurpose
ANTIGRAVITY_BASE_URLOverride the API base URL. It must be HTTPS, contain no URL credentials, and target an allowed Google APIs host.
ANTIGRAVITY_PROJECT_IDUse a specific Cloud Code Assist project ID instead of discovery or the stable account fallback.
ANTIGRAVITY_CALLBACK_HOSTBind OAuth callback to 127.0.0.1, ::1, or localhost only. Defaults to 127.0.0.1.
ANTIGRAVITY_USER_AGENTOverride the request user-agent.
ANTIGRAVITY_RUNTIME_MODELPin requests to a runtime model ID, bypassing discovered/fallback routing.
ANTIGRAVITY_CATALOG_REFRESH_INTERVAL_MSOverride catalog refresh TTL in ms. Defaults to 4 hours (14400000). Set to 0 to always refresh.
ANTIGRAVITY_CLIENT_IDUse a custom Google OAuth client ID.
ANTIGRAVITY_CLIENT_SECRETUse a custom Google OAuth client secret. Keep it out of source control and shell history.
ANTIGRAVITY_NO_KEEPALIVESet to 1 to skip the keep-alive connection pool.
ANTIGRAVITY_NO_PREWARMSet to 1 to skip the TLS pre-warm request made when the extension loads.

By default, the provider tries https://daily-cloudcode-pa.googleapis.com, then the sandbox host, then https://cloudcode-pa.googleapis.com. Prefer the built-in OAuth client unless you have a reason to use your own credentials.

Latency

Provider requests reuse a keep-alive connection pool when the runtime supports it, so consecutive turns do not repeat the DNS, TCP, and TLS handshake. When HTTP_PROXY, HTTPS_PROXY, or ALL_PROXY is set, that pool is skipped so Pi's proxy-aware dispatcher is used instead. The connection is also opened when the extension loads so the first message of a session skips the handshake too. For the lowest time-to-first-token, pick a fast runtime: gemini-3.8-flash with reasoning off routes to gemini-3.8-flash-low at thinking level LOW. Setting ANTIGRAVITY_PROJECT_ID also removes the project-discovery round-trip when credentials do not already carry a project ID.

Troubleshooting

  • No credentials / 401 / 403: Run /login antigravity again, then check /antigravity.doctor.
  • Remote/headless machine — browser can't reach localhost:51121: The callback binds to loopback only, so a browser on another machine can't hit it. You have two options:
    • Paste (no extra setup): Run /login antigravity, open the shown URL and complete Google sign-in in any browser. When it redirects to http://localhost:51121/oauth-callback?… and fails to load, copy that full URL from the address bar and paste it into the prompt Pi shows. The code is single-use and expires quickly, so paste promptly.
    • SSH tunnel (reusable): From the machine with the browser, run ssh -N -L 51121:127.0.0.1:51121 <user>@<server> and keep it open, then run /login antigravity on the server. The redirect to localhost:51121 tunnels through to the local callback automatically.
  • OAuth callback will not start: Ensure port 51121 is free and ANTIGRAVITY_CALLBACK_HOST is a permitted loopback address.
  • Model is unavailable: Run /antigravity.models; availability is account- and service-dependent.
  • Claude/GPT tool-call schema error: Upgrade to the latest package release. The provider adapts Pi's JSON Schema tool definitions for the Cloud Code Assist custom-tool bridge.
  • Quota or rate limit: Run /antigravity.usage. A 429 response usually indicates quota or rate limiting; changing models may still draw from the same shared pool.
  • Need a safe diagnostic: /antigravity.doctor redacts recognized secrets from its error output. Still review output before sharing it publicly.

Development

This repo uses Bun for install, scripts, and CI. The published extension itself runs on Node (Pi's CLI).

bun install
bun run check

The package declares its Pi extension in package.json under pi.extensions. See the Pi package documentation for package installation, manifest, and gallery conventions.

Support the project

If pi-antigravity is useful to you, consider sponsoring the project on GitHub.

License

MIT