๐ŸŒ‰ Antigravity Bridge

March 9, 2026 ยท View on GitHub

๐ŸŒ‰ Antigravity Bridge

Turn Google's free Antigravity IDE into a REST API โ€” access Claude Opus 4.6, Gemini 3.1 Pro, and more for free

License: MIT Python Version

6 free AI models ยท REST API ยท Sync & async chat ยท Image generation


Caution

โš ๏ธ Risk Warning โ€” Read Before Use

This project turns a desktop client into a headless API via CDP injection. This violates Antigravity's Terms of Service and carries real risks:

  • Account throttling โ€” Rate limits, degraded responses, shadow-banning
  • Account ban โ€” Your Google account may be suspended, potentially affecting other Google services (GCP, Workspace, Gmail)
  • Detection is trivial โ€” CDP debugger attachment, Security.setIgnoreCertificateErrors, and non-human interaction patterns (zero typing delay, no cursor movement) are all easily detectable

Protect yourself:

  1. ๐Ÿšซ Never use your primary Google account โ€” Register a throwaway account
  2. ๐Ÿข Add delays between requests โ€” Mimic human typing speed, avoid high concurrency
  3. ๐Ÿงช Personal research only โ€” Do not use as a production API or multi-user backend
  4. ๐Ÿ’€ Expect breakage โ€” This is a cat-and-mouse game; the channel can be killed at any time

Use at your own risk. The authors are not responsible for any account actions taken by Google/Antigravity.


๐Ÿ˜ก The Problem

"Opus 4.6 API costs hundreds per month" "Gemini 3.1 Pro is free but has no convenient API" "I want my agent to use multiple models without paying for each"

Antigravity Bridge wraps Antigravity โ€” a free AI desktop app by Google โ€” into a standard REST API via Chrome DevTools Protocol (CDP). One endpoint, six free models.

๐Ÿš€ Quick Start

1. Install & Start

# Install Antigravity from https://antigravity.com (macOS only)

# Clone this repo
git clone https://github.com/ythx-101/antigravity-bridge.git
cd antigravity-bridge

# Install dependency
pip install websockets

# Start Antigravity with CDP
bash scripts/start_antigravity.sh

# Start the bridge
python3 scripts/bridge.py

2. Use the API

# Chat with Opus (free!)
curl -X POST http://localhost:19999/chat \
  -H 'Content-Type: application/json' \
  -d '{"prompt":"Explain quantum computing","model":"Claude Opus 4.6 (Thinking)"}'

# Async mode (recommended for long tasks)
curl -X POST http://localhost:19999/async \
  -d '{"prompt":"Deep analysis...","timeout":600}'
# โ†’ {"status":"accepted","task_id":"abc123"}
curl http://localhost:19999/task/abc123

# New conversation (clear context)
curl -X POST http://localhost:19999/new

# Health check
curl http://localhost:19999/health

๐Ÿค– Available Models

ModelKeyBest For
Claude Opus 4.6 (Thinking)Claude Opus 4.6 (Thinking)Deep reasoning
Gemini 3.1 Pro (High)Gemini 3.1 Pro (High)Fast + image gen
Claude Sonnet 4.6 (Thinking)Claude Sonnet 4.6 (Thinking)Balanced
Gemini 3 FlashGemini 3 FlashFastest
GPT-OSS 120B (Medium)GPT-OSS 120B (Medium)GPT alternative
Gemini 3.1 Pro (Low)Gemini 3.1 Pro (Low)Quota-friendly

๐Ÿ“ก API Reference

MethodPathDescription
POST/chatSynchronous chat (default 180s timeout)
POST/asyncAsync chat, returns task_id
GET/task/{id}Poll async result
POST/newNew conversation (two-phase reload)
POST/modelSwitch model
GET/healthHealth check
GET/modelsList available models
GET/historyCurrent conversation content
GET/imgcountCount generated images
GET/extract?after=NExtract generated image as base64

๐Ÿ“Š Architecture

Your Agent / Script
    โ”‚
    โ”œโ”€โ”€ curl http://localhost:19999/chat
    โ”‚
    โ””โ”€โ”€ bridge.py (:19999)
          โ”‚ WebSocket (CDP)
          โ–ผ
        Antigravity (CDP :9229)
          โ”‚ Security.setIgnoreCertificateErrors โ† v1.3.0 fix
          โ–ผ
        language_server_macos_arm
          โ”‚ gRPC over TLS
          โ–ผ
        googleapis.com (AI models)

๐Ÿ”ง How It Works

  1. Antigravity runs with --remote-debugging-port=9229 (auto-configured via argv.json)
  2. bridge.py connects via CDP WebSocket to the Antigravity chat UI
  3. Messages are injected into the Lexical editor via document.execCommand('insertText')
  4. Responses are polled from the DOM until completion markers appear
  5. SSL Fix: Antigravity's language_server uses a self-signed cert (CN=localhost). The bridge calls Security.setIgnoreCertificateErrors to allow the renderer's fetch() to communicate with it

โš ๏ธ Known Issues & Solutions

"Messages send but no response" (most common)

Root cause: Electron's fetch() rejects the self-signed SSL cert used by language_server_macos_arm.

Fix (applied in v1.3.0): The bridge automatically calls Security.setIgnoreCertificateErrors({ignore: true}) before each chat.

"gRPC connection fails"

The language_server connects to daily-cloudcode-pa.googleapis.com via gRPC. If this endpoint is unreachable (e.g., blocked by firewall), models will show as placeholders and won't respond.

Fix: Ensure your network can reach googleapis.com.

Planning mode gets stuck

Some long prompts trigger Antigravity's "Planning" mode which can hang.

Fix: The bridge auto-switches to "Fast" mode. Keep prompts concise.

๐Ÿ“ Files

antigravity-bridge/
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ SKILL.md
โ””โ”€โ”€ scripts/
    โ”œโ”€โ”€ bridge.py             # REST API server (v1.3.0)
    โ””โ”€โ”€ start_antigravity.sh  # Mac startup helper

๐Ÿ“ Requirements

  • macOS with Antigravity installed
  • Python 3.8+ with websockets package
  • Network access to googleapis.com

License

MIT