Skip to main content

Google Antigravity Provider Plugin for Hermes Agent

License: MIT Python 3.10+ PRs Welcome

🇬🇧 English Version | 🇫🇷 Version Française


A native inference provider plugin integrating Google Antigravity / Cloud Code Assist into Hermes Agent (nousresearch/hermes-agent). It enables running state-of-the-art Gemini and Claude models with full streaming support, native tool calling (function calling), and reasoning/thinking tokens.

🎓 Built for Gemini Pro, Student & Google One AI Subscriptions

Google does not provide API keys for consumer or student subscriptions (Gemini Pro Student, Gemini Advanced, Google One AI Premium, Google Workspace for Education). Historically, Hermes Agent could only connect to Google via Google AI Studio API keys (GOOGLE_API_KEY) or Vertex AI service accounts, leaving subscription holders unable to use their quota.

This plugin solves that problem: it authenticates directly with your Google account via OAuth 2.0 PKCE, unlocking your subscription models in Hermes Agent without burning paid API tokens!

Provenance: this plugin originated as a Python adaptation of the pi-antigravity extension for the Pi Coding Agent by Rahul Arya (@Rahularya01), re-architected as a native Hermes ProviderProfile. It is now maintained independently: wire behavior is validated directly against the official Antigravity CLI (measured fingerprint) and the live Cloud Code Assist relay (live model discovery, quota, retirement tags) — not by tracking pi-antigravity's advances. pi-antigravity remains credited below as the project that pioneered the reverse-engineering. Every wire constant is tracked in UPSTREAM_DRIFT.md so divergence from the measured reference is visible rather than silent. See Acknowledgements & Provenance.

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                 Hermes Agent (AIAgent Loop)                 │
└──────────────────────────────┬──────────────────────────────┘
                               │ client.chat.completions.create()
                               ▼
┌─────────────────────────────────────────────────────────────┐
│           Hermes Antigravity Plugin (ProviderProfile)        │
│                                                             │
│  ┌──────────────────────┐        ┌───────────────────────┐  │
│  │       auth.py        │        │     translator.py     │  │
│  │  - OAuth 2.0 PKCE    │        │  - OpenAI <-> Google  │  │
│  │  - Token Auto-refresh│        │  - SSE Chunk Parser   │  │
│  │  - loadCodeAssist    │        │  - Thinking & Tools   │  │
│  └──────────┬───────────┘        └───────────▲───────────┘  │
│             │ Bearer Token                   │ SSE Stream   │
│             ▼                                │              │
│  ┌───────────────────────────────────────────┴───────────┐  │
│  │                  client.py (Transport)                │  │
│  │  POST /v1internal:streamGenerateContent?alt=sse       │  │
│  │  Failover: daily-cloudcode-pa -> cloudcode-pa         │  │
│  └───────────────────────────┬───────────────────────────┘  │
└──────────────────────────────┼──────────────────────────────┘
                               │ HTTPS (User-Agent: antigravity/cli)
                               ▼
┌─────────────────────────────────────────────────────────────┐
│           Google Cloud Code Assist / Antigravity API        │
│    (Gemini 3.8 Flash, Gemini 3.7, Claude Sonnet/Opus)       │
└─────────────────────────────────────────────────────────────┘

🚀 Features

  • Live Model Discovery (30+ models):
    • gemini-3.8-flash (recommended for fast agentic coding; auto-routed to the -low/-medium/-high runtime IDs that carry your quota)
    • gemini-3.7-flash / gemini-3.6-flash / gemini-3.5-flash
    • gemini-3.1-pro / gemini-2.5-pro
    • gemini-2.5-flash
    • claude-sonnet-4-6 / claude-opus-4-6-thinking
  • Model Routing: public IDs map to the suffixed runtime IDs Google attributes quota on. Sending a bare public ID returns 429 even with quota remaining — the client routes automatically, per thinking effort.
  • Session Envelope: stable conversation/trajectory IDs plus request labels on every call, so multi-turn usage is attributed to one session.
  • Per-Model Output Caps: max_tokens is clamped to each family ceiling (Claude 64000, gpt-oss 32768) instead of failing with HTTP 400.
  • Strict Schema Sanitization: tool schemas are stripped of keywords Claude rejects (anyOf, oneOf, allOf, …) before declaration.
  • Native SSE Streaming & Thinking: Server-Sent Events (SSE) streaming with live reasoning display (delta.reasoning_content) in the Hermes TUI and Gateway.
  • Bidirectional Tool Calling: Transparent mapping of OpenAI JSON schemas to Google Cloud Code Assist function declarations and function responses.
  • Hybrid Authentication:
    • Account onboarding through the Hermes auth surface (hermes auth add antigravity and hermes auth remove antigravity).
    • Interactive Google OAuth 2.0 PKCE flow with local callback listener (http://localhost:51121/oauth-callback) and headless fallback.
    • Transparent access token auto-refresh before expiration.
  • Native Hermes Integration (hermes model & /model):
    • Interactive provider and model selection with persistent configuration in ~/.hermes/config.yaml.
    • Native auth commands: hermes auth add antigravity, hermes auth list, hermes auth status antigravity, hermes auth remove antigravity.
    • Live quota in status: hermes auth status antigravity appends the account's remaining quota (plan, aggregate groups on paid tiers, per-model summary on free tier) read directly from Antigravity.
    • Multi-account registry with legacy migration.
  • Network Resilience: Automatic failover across candidate endpoints (daily-cloudcode-pa.googleapis.com, daily-cloudcode-pa.sandbox.googleapis.com, cloudcode-pa.googleapis.com) plus retry with backoff on transient HTTP 429.

📦 Installation & Discovery

Catalog status: this plugin is not listed in the upstream Nous Research Hermes Agent provider catalog (declined 2026-10-24: it presents Google's official Antigravity client fingerprint, which the catalog does not accept). It is distributed from this repository only. Install instructions below.

Requirements

Hermes Agent v0.20.0 or newer. This plugin delivers inference through ProviderProfile.create_client(). On older cores that hook does not exist, so the provider still loads and still appears in hermes model, but every request fails with HTTP 404 — the core quietly builds its own OpenAI-shaped client and POSTs it to the Antigravity API, which does not speak that shape.

If requests 404 on a provider that looks correctly configured, check your core version before anything else. The plugin logs an explicit error at load time when the hook is missing.

Option A — pip (recommended):

pip install hermes-antigravity

Hermes Agent discovers the plugin automatically via its entry point.

Option B — git clone (development / pinned revision): Clone this repository into your Hermes model providers plugin directory:

Linux & macOS:

git clone https://github.com/zeyxx/hermes-antigravity ~/.hermes/plugins/model-providers/antigravity

Upgrading an existing install: do not cp over it. The installed plugin is itself a git clone and can hold commits or edits that exist nowhere else; a plain copy destroys them with no diff and no error. Use the guarded sync instead:

./tools/sync-installed.sh --dry-run   # report what would change, write nothing
./tools/sync-installed.sh             # sync, refusing if the installed copy has local work

It refuses when the installed tree is dirty, when it has commits missing from its own upstream, or when it sits at an unexpected revision — so work that exists only on that machine becomes a loud failure instead of a silent loss. --force overrides, and the message tells you what you would be discarding.

Windows (PowerShell):

git clone https://github.com/zeyxx/hermes-antigravity "$env:USERPROFILE\.hermes\plugins\model-providers\antigravity"

Verify detection:

python3 -c "from providers import get_provider_profile; print(get_provider_profile('antigravity'))"

🔑 Authentication

Run:

hermes model

Select Google Antigravity. If not already authenticated, Hermes launches the interactive Google OAuth 2.0 PKCE flow directly in your terminal.

2. Standalone Authentication CLI

Authenticate or inspect status at any time:

# Check status
python3 ~/.hermes/plugins/model-providers/antigravity/auth.py status

# Measure remaining quota (read-only; also prints as JSON with --json)
python3 ~/.hermes/plugins/model-providers/antigravity/auth.py quota
python3 ~/.hermes/plugins/model-providers/antigravity/auth.py quota --json

# Run interactive OAuth login
python3 ~/.hermes/plugins/model-providers/antigravity/auth.py

3. Optional Environment Variables

  • ANTIGRAVITY_ACCESS_TOKEN: Google Bearer access token.
  • ANTIGRAVITY_REFRESH_TOKEN: Google OAuth refresh token.
  • ANTIGRAVITY_PROJECT_ID: Google Cloud Code Assist project ID.
  • ANTIGRAVITY_CLIENT_ID / ANTIGRAVITY_CLIENT_SECRET: use your own Google OAuth client instead of the bundled default.

4. Credential safety

The default OAuth client is Google's public Antigravity desktop client, not a private app secret.

A desktop "installed app" OAuth client cannot keep a secret: the binary ships with it, so the value is inherently public and its only protection is that Google treats it as non-confidential. This plugin embeds the same public client identifier used by the official Antigravity Desktop app, verified independently against the official CLI (the value was also historically documented by pi-antigravity (MIT)).

That is different from an API secret, and it is why secret scanners may flag it:

  • The embedded value is public by design. It grants no access on its own — a token exchange still requires an interactive Google sign-in by the account owner.
  • The credentials that are sensitive are the tokens, and they are never in this repository. ANTIGRAVITY_REFRESH_TOKEN is a live account credential: keep it out of source control, issues and chat logs.
  • Do not commit real tokens. Stored accounts live in ~/.hermes/antigravity-accounts.json, which must stay owner-only (chmod 600).
  • Prefer your own client for anything sensitive. Set ANTIGRAVITY_CLIENT_ID / ANTIGRAVITY_CLIENT_SECRET if you want your own quota, audit trail and revocation surface.

If a scanner blocks a push here, read this section before dismissing it: confirm the flagged value is the embedded public desktop client, not a user token. A blocked push is worth understanding rather than force-pushing past.

Signing in requests these Google OAuth scopes:

Scope Why it's needed
aicode Access to the Cloud Code Assist / Antigravity model catalog and endpoints
cloud-platform General Cloud Code Assist API access
userinfo.email, userinfo.profile Identify the signed-in Google account
cclog Cloud Code Assist logging/telemetry endpoints used by the API
experimentsandconfigs Server-side experiment and config flags for the API

Review these permissions before approving access. If credentials expire or are revoked, run hermes model again and re-select Google Antigravity.

5. Multiple Hermes profiles

Plugin discovery is per profile. If you run Hermes with more than one profile (hermes -p <profile> ..., or a HERMES_HOME override), link the plugin into each one:

for profile in work personal; do
  mkdir -p ~/.hermes/profiles/$profile/plugins/model-providers
  ln -s ~/.hermes/plugins/model-providers/antigravity \
          ~/.hermes/profiles/$profile/plugins/model-providers/antigravity
done

Each profile keeps its own accounts. The account registry resolves through the profile's own HERMES_HOME, so credentials never leak between profiles. Sign in once per profile:

hermes -p work model     # then select Google Antigravity
hermes -p personal model # then select Google Antigravity

If you want one set of Google accounts across profiles, symlink the registry instead of logging in twice — it is a single JSON file, chmod 600:

ln -s ~/.hermes/antigravity-accounts.json ~/.hermes/profiles/work/antigravity-accounts.json

Before v1.1.2 every profile shared ~/.hermes/antigravity-accounts.json because the path was hardcoded rather than resolved through HERMES_HOME. That looked like working sharing and would have broken the other way the moment the core honoured the variable. Profiles are now isolated by default.


🛠️ Usage with Hermes Agent

Interactive Model Selection

hermes model
# or inside the interactive chat / TUI:
/model

Direct CLI Invocation (One-Shot)

hermes -z "Explain this file in one concise sentence" --provider antigravity --model gemini-3.8-flash

Persistent Configuration in ~/.hermes/config.yaml

model:
  provider: antigravity
  default: gemini-3.8-flash
  reasoning_effort: medium

🧪 Tests

Run the full suite (currently 96 tests — confirm with --collect-only, a module that fails to import drops its tests silently):

export PYTHONPATH=".:$HOME/.hermes/hermes-agent"   # the plugin imports `providers` from the Hermes core
python3 tools/run_tests.py --collect-only
python3 tools/run_tests.py --min-tests "$(python3 tools/run_tests.py --collect-only)"

No pytest, no dependencies: the runner is standard library only (see CONTRIBUTING.md for the full contributor workflow).


⚠️ Disclaimer — read this before signing in

This plugin uses Google's Cloud Code Assist endpoints (cloudcode-pa.googleapis.com) through Antigravity OAuth, outside the official Antigravity CLI. This is a breach of Google's Antigravity Terms of Service. The terms are explicit:

"Using third party software, tools, or services to access the Service (e.g. using OpenClaw with Antigravity OAuth) is a breach of this Agreement. Such actions may be grounds for suspension or termination of your Antigravity and/or Gemini CLI accounts."

This is not theoretical. Google has run active enforcement waves disabling accounts that access Antigravity through third-party OAuth clients. Bans have also cut off Gemini CLI and Gemini Code Assist access on the same account, and a second flag is a permanent ban. A personal Google account can carry unrelated services you care about.

The compliant alternative: use a Gemini AI Studio / Google AI Studio API key (pay-per-token) with a Gemini provider, instead of Antigravity OAuth. The terms only prohibit piggybacking on the subscription OAuth; a metered API key is the supported path.

hermes auth add antigravity prints this warning before it starts the OAuth flow. If you proceed, you accept the account risk.

TLS transport (detection surface)

The official agy client is a Go binary; this plugin speaks TLS through Python's stdlib ssl/OpenSSL with a default handshake. Their TLS ClientHello (and thus their JA3 fingerprint) differs, and that gap is left as-is: probed 2026-10-14, the relay answers 200 over the default handshake, so fingerprint tuning was removed (no mimicry without a measured need). The stdlib-vs-Go gap is still documented in UPSTREAM_DRIFT.md and measured by tools/transport_check.py. This does not make the integration ToS-compliant.

Use at your own discretion and risk. The authors of this plugin are not responsible for any consequences arising from its use.


🔄 Upstream drift

This plugin speaks Google's Cloud Code Assist API directly. Its references are the official agy CLI (wire fingerprint, measured live) and the live relay responses (model catalog, quota, retirement tags) — not a third-party reimplementation's release notes. Google moves; nothing compiles against it to notice.

UPSTREAM_DRIFT.md lists every wire field, its measured value, and when it was last checked. Tests assert the plugin side, so a relay or CLI change shows up as a red test rather than a silent degradation — the failure mode behind every real incident in this plugin's history (a stale CLI fingerprint, a missing core hook).

tools/check_upstream_drift.py additionally cross-checks protocol constants against pi-antigravity's source as a secondary signal. If you change anything against the reference, update that file in the same PR.

🙏 Acknowledgements & Provenance

This project stands on the shoulders of giants. In open-source software, provenance and proper attribution are fundamental to sustainable, ethical collaboration.

The reverse-engineered protocol wire format, Google Cloud Code Assist endpoint discovery (daily-cloudcode-pa.googleapis.com), and OAuth PKCE integration patterns were originally pioneered and researched in TypeScript by Rahul Arya (@Rahularya01) for the Pi Coding Agent:

We ported, adapted, and re-architected these concepts into a native Python model-provider plugin implementing ProviderProfile for Hermes Agent (nousresearch/hermes-agent). Ported 1:1 from the TypeScript source: the public-to-runtime model routing table, the session/trajectory request envelope, the tool-schema stripping, the thought-signature handling for Gemini 3+, and the SSE streaming protocol.

That was the starting point. The plugin is now maintained independently of pi-antigravity's advances: the wire fingerprint is measured against the official CLI, the model catalog, quota and retirement signals are read from the live relay, and validation runs on Linux, macOS and Windows CI. All gratitude and credit for the foundational Cloud Code Assist discovery go to Rahul Arya and the Pi open-source community.


📄 License

MIT License (c) 2026 zeyxx. Built for the Hermes Agent community.

Metadata

Release files for hermes-antigravity 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hermes-antigravity 1.7.0
File Size Uploaded Provenance Actions
hermes_antigravity-1.7.0.tar.gz 102.8 kB With provenance Details for hermes_antigravity-1.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hermes-antigravity 1.7.0
File Interpreter ABI Platform Actions
hermes_antigravity-1.7.0-py3-none-any.whl Python 3 none any Details for hermes_antigravity-1.7.0-py3-none-any.whl

Total release size: 171.3 kB

Release files / hermes_antigravity-1.7.0.tar.gz

Download URL hermes_antigravity-1.7.0.tar.gz
Size 102.8 kB
Tags Source
SHA-256 checksum
How to use checksums
64bc98989b7087010b269e3154bca2d646d6b3929b37cf49ae5cc8f395912c68
BLAKE2b-256 checksum
How to use checksums
800b9b7991e00c41f37dd8449995517572cf444afd40a083210e695d21765824
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / hermes_antigravity-1.7.0-py3-none-any.whl

Download URL hermes_antigravity-1.7.0-py3-none-any.whl
Size 68.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c6b2e6e0e3a9be9fa1f6615056218cf0c7671b62ec87345b016a792c7207de6
BLAKE2b-256 checksum
How to use checksums
9204a20786a14184dd527dbc6239c0d1acc6aa6d1a6c5568c19061babae0b430
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for hermes-antigravity 1.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hermes_antigravity-1.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page