Turn Google's free Antigravity IDE into a REST API — access Claude Opus 4.6, Gemini 3.1 Pro, and more for free
Antigravity Bridge is an unofficial Python tool that connects to the Google Antigravity desktop app on macOS through the Chrome DevTools Protocol (CDP) and exposes its chat as a local REST API, so your own scripts and agents can send prompts to the models available in Antigravity — for personal research only.
中文:非官方工具,通过 CDP 把 macOS 上的 Google Antigravity 桌面端聊天变成本地 REST API,方便自己的脚本 / AI agent 调用;仅供个人研究,违反服务条款,有封号风险。
6 free AI models · REST API · Sync & async chat · Image generation
Caution
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:
- 🚫 Never use your primary Google account — Register a throwaway account
- 🐢 Add delays between requests — Mimic human typing speed, avoid high concurrency
- 🧪 Personal research only — Do not use as a production API or multi-user backend
- 💀 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.
"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 — Google's AI desktop app — into a local REST API via Chrome DevTools Protocol (CDP). One endpoint for the models listed in Antigravity's UI.
# Install Antigravity from https://antigravity.google
# The scripts here target macOS (tested on Apple Silicon, per `language_server_macos_arm`)
git clone https://github.com/ythx-101/antigravity-bridge.git
cd antigravity-bridge
pip install -r requirements.txt # equivalent: pip install websocketsPick one of the two ways to start (don't run both — the port would already be in use):
# Option A: one script starts Antigravity (CDP on 9229) AND the bridge (log: /tmp/ag_bridge.log)
bash scripts/start_antigravity.sh
# Option B: manual
open -a Antigravity --args --remote-debugging-port=9229
python3 scripts/bridge.py# Chat with Opus
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| Model | Key | Best 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 Flash | Gemini 3 Flash |
Fastest |
| GPT-OSS 120B (Medium) | GPT-OSS 120B (Medium) |
GPT alternative |
| Gemini 3.1 Pro (Low) | Gemini 3.1 Pro (Low) |
Quota-friendly |
| Method | Path | Description |
|---|---|---|
| POST | /chat |
Synchronous chat (default 180s timeout) |
| POST | /async |
Async chat, returns task_id |
| GET | /task/{id} |
Poll async result |
| POST | /new |
New conversation (two-phase reload) |
| POST | /model |
Switch model |
| GET | /health |
Health check |
| GET | /models |
List available models |
| GET | /history |
Current conversation content |
| GET | /imgcount |
Count generated images |
| GET | /extract?after=N |
Extract generated image as base64 |
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)
- Antigravity is launched with
--remote-debugging-port=9229(start_antigravity.shdoes this viaopen -a Antigravity --args ..., or run that command yourself) - bridge.py connects via CDP WebSocket to the Antigravity chat UI
- Messages are injected into the Lexical editor via
document.execCommand('insertText') - Responses are polled from the DOM until completion markers appear
- SSL Fix: Antigravity's
language_serveruses a self-signed cert (CN=localhost). The bridge callsSecurity.setIgnoreCertificateErrorsto allow the renderer'sfetch()to communicate with it
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.
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.
Some long prompts trigger Antigravity's "Planning" mode which can hang.
Fix: The bridge auto-switches to "Fast" mode. Keep prompts concise.
scripts/ag_chat.sh prints a plain-text reply. Set it up as an alias:
alias ag="bash $(pwd)/scripts/ag_chat.sh"
ag "Your question" [model] [timeout] # model defaults to opus, timeout to 180sModel shorthands: opus, sonnet, gemini, gemini-low, flash, gpt (any other value is passed through as the full model name). It retries up to 3 times on high traffic.
To reach a bridge on another machine, set the full URL: AG_BRIDGE_HOST=http://<mac-ip>:19999 ag "hi".
bash scripts/agy_invoke.sh "Task description" [--model opus|gemini|sonnet|flash] triggers the Antigravity IDE agent over SSH + CDP. It needs SSH (Remote Login) access to the Mac, and Node.js with the ws package on the Mac. Configure with MAC_SSH_HOST, MAC_SSH_USER, MAC_SSH_PORT, AGY_NODE_PATH (env vars or ~/.remote-mac.conf); see the header of the script.
| Antigravity Bridge | Official APIs (Anthropic / Google Gemini API) | |
|---|---|---|
| Officially supported | No | Yes |
| Complies with ToS | No — may get your account banned | Yes |
| Stability | Can break any time (depends on Antigravity's DOM and quota) | Versioned, documented |
| Production / multi-user | No | Yes |
| Cost model | Relies on Antigravity's own free quota, which can change at any time | Pay-as-you-go |
Use the bridge for personal experiments with a throwaway account. For anything else, use the official APIs.
There is a real risk — see the Risk Warning (CAUTION block) at the top of this README and Issue #1. Use a throwaway account, never your primary one, and add delays between requests.
The scripts target macOS only (open -a, osascript, language_server_macos_arm). Other platforms are untested.
See "Messages send but no response" under Known Issues (self-signed cert, fixed in v1.3.0) and make sure your network can reach googleapis.com.
start_antigravity.sh already starts a bridge in the background. Use Option A or Option B, not both.
Whatever Antigravity shows in its UI. The MODELS list in bridge.py is hard-coded and may be outdated; GET /models shows it.
No. It uses custom endpoints, see API Reference.
Yes — the bridge listens on 0.0.0.0 (use AG_BRIDGE_HOST with ag). There is no authentication, so only do this on a trusted network.
No.
antigravity-bridge/
├── README.md
├── CHANGELOG.md
├── LICENSE
├── SKILL.md
├── llms.txt # Summary for LLMs
├── requirements.txt # websockets>=10
├── tests/test_bridge.py # Offline tests (no Antigravity needed)
└── scripts/
├── bridge.py # REST API server
├── start_antigravity.sh # Starts Antigravity with CDP and the bridge
├── ag_chat.sh # `ag` CLI helper
├── agy_invoke.sh # Trigger the IDE agent over SSH + CDP
└── cdp_inject.js # Node.js CDP injection script used by agy_invoke.sh
Run the tests: python3 -m unittest discover -s tests
- macOS with Antigravity installed
- Python 3.8+ with
websocketspackage (requirements.txt) - Network access to
googleapis.com
MIT