Add custom AI models (Claude 3.5/3.7 Sonnet, GPT-4o, DeepSeek R1, Ollama), pool multiple Google accounts with OmniRoute load balancing, and control everything on mobile with Antigravity Remote 2.0.
The complete AI development ecosystem for Google Antigravity (v3.7.4):
- 🌐 Google Services & OmniRoute Pooling Suite: Multi-account OAuth pooling, Google AI Studio integration, Power of Two Choices (P2C) candidate selection, in-flight concurrency tracking, 4-tier 429 classification, smart weekly quota governor & cross-model cascade (Gemini → Claude Sonnet 4.6 / Opus 4.6).
- 🧩 Antigravity IDE & Extension Engine: Native support for VS Code-based Antigravity IDE (v1.107.0+) and classic Electron shell with autonomous proxy auto-starter (
out/main.js), dual summary store reconciliation (SQLite + Protobuf), and injected chat suggestion pills.- 🖥️ Desktop Patch Proxy: Injects Anthropic Claude, OpenAI GPT-4o, DeepSeek R1 / V3, Google Gemini, OpenRouter, Ollama, Groq, Mistral, and xAI directly into IDE chat dropdowns with AES-256-GCM encryption and bi-directional SSE streaming.
- 📊 Token Tracker & Tokenizer Engine: Real-time token consumption metrics (prompt, completion, cached), cache hit ratio %, and financial savings analysis inside
ag-doctor-ui.- 📱 Antigravity Remote 2.0 (Mobile Companion): Native Flutter application (Android & iOS) to supervise agent trajectories, review code diffs, approve terminal commands, inspect MCP servers, manage Git worktrees, and chat with AI from anywhere via Zero-Config LAN Discovery or Cloudflare Quick Tunnels.
| 🖥️ Desktop IDE Custom Models | 📱 Mobile Remote 2.0 Companion |
|---|---|
![]() |
|
| Native IDE dropdown with custom LLMs & Auto-Fallback | Live mobile streaming, 7ms latency, unified diffs & voice input |
- Overview & Key Capabilities
- What's New in v3.7.x
- Google Services & OmniRoute Quota Pooling Suite
- Antigravity IDE & Extension Architecture
- Token Tracker & Tokenizer Engine
- Antigravity Remote 2.0 (Mobile & Daemon Bridge)
- Architecture & Reverse Engineering
- Desktop UI Screenshots & Custom Models
- Key Technical Features
- Security Architecture & AES-256-GCM
- Quick Start & Installation
ag-doctorDiagnostic CLI & UI- Supported LLM Providers & Matrix
custom_models.jsonSchema Reference- Developer Guide & Testing
- Frequently Asked Questions (FAQ)
- License
Google Antigravity Custom Model Enabler & Remote Ecosystem transforms your development environment:
- Universal LLM Bridge: Intercepts internal communication between the IDE's Language Server (Go binary) and Google's internal Cloud Code infrastructure (
daily-cloudcode-pa.googleapis.com→127.0.0.1:${AG_PROXY_PORT:-51074}), translating API requests into standard payloads for 20+ LLM providers while preserving tool calls and SSE token streaming. - Google Services & Smart Multi-Account Pooling: Pools multiple Google Cloud Code and AI Studio accounts with OmniRoute-parity load balancing (Power of Two Choices, in-flight concurrency penalty, 4-tier 429 classification, smart weekly quota governor, and cross-model failover cascade).
- Antigravity IDE & Extension Engine: Seamless integration with VS Code-based Antigravity IDE (v1.107.0+) and Classic Shell (v2.9.1 / v2.18.x) featuring an autonomous proxy auto-starter (
out/main.js), chat suggestion pills, and Dual Summary Store reconciliation (SQLite + Protobuf). - Mobile IDE Companion: Connects securely to your IDE session from your smartphone via WebSocket JSON-RPC over local Wi-Fi or Cloudflare Quick Tunnels, giving you real-time human-in-the-loop controls wherever you are.
- 🌐 Google Multi-Account Quota Pooling: Pool multiple Google accounts (OAuth & Google AI Studio keys) to multiply quotas and bypass single-account rate limits.
- ⚖️ OmniRoute-Parity Intelligent Balancing: Power of Two Choices (P2C) candidate selection and real-time in-flight concurrency tracking (20-point penalty per active request).
- 🚦 4-Tier 429 Classification & Quota Governor: Granular differentiation between soft bursts, RPM throttles, 5-hour quota exhaustion, and unknown errors, paired with a weekly quota reset countdown.
- 🔀 Cross-Model Billing & Quota Cascade: Instant failover from exhausted Google Gemini models to Claude Sonnet 4.6 / Opus 4.6, skipping sibling accounts sharing the same quota.
- 🧩 Antigravity IDE (v1.107.0+) Auto-Starter:
out/main.jshook starts the proxy daemon automatically before extensions load, preventingECONNREFUSEDconnection issues on boot. - 🗄️ Dual Summary Store Reconciliation: Syncs SQLite
conversation_summaries.dband Protobufagyhub_summaries_proto.pbviaag-doctor db:pruneto permanently clean orphan and archived sessions. - 💬 Injected Chat Suggestion Pills: Quick-action pills inside the chat UI for rapid repository review and Git workflows.
- 📊 Token Tracker & Cost Optimization Engine: Live prompt caching ratio and dollar savings tracking inside
ag-doctor-ui. - 🛡️ Comprehensive Security Sanitization: Eradicated legacy Trojan backdoor risks (Issue #22) and implemented zero-eval streaming JSON repair.
Antigravity Patch Proxy v3.7.1 introduces enterprise-grade support for Google Services, combining Google Cloud Code OAuth, Google AI Studio developer keys, and Gemini CLI endpoints into a unified, high-availability account pool.
flowchart TD
Req["Incoming IDE Gemini Request"] --> Aff{"Session Affinity Check<br/>(Sticky Sessions)"}
Aff -->|"Bound & Healthy"| Exec["Dispatch to Assigned Account"]
Aff -->|"Unbound or Cooldown"| P2C["Power of Two Choices (P2C) Selection<br/>• Filter cooling & unlicensed accounts<br/>• Penalty: -20 pts per in-flight request<br/>• Random pick between top 2 healthy nodes"]
P2C --> CloudCode["Google Cloud Code OAuth<br/>(daily-cloudcode-pa / prod)"]
P2C --> AIStudio["Google AI Studio Keys<br/>(generativelanguage.google)"]
P2C --> GeminiCli["Gemini CLI OAuth<br/>(Isolated project quota)"]
CloudCode --> Resp{"Response Status"}
AIStudio --> Resp
GeminiCli --> Resp
Resp -->|"200 OK"| Success["Stream Tokens to IDE"]
Resp -->|"429 Soft Burst"| Backoff["2-3s Exponential Backoff"]
Resp -->|"429 RPM Limit"| Cooldown60["60s Cooldown + Alternate Account"]
Resp -->|"429 Quota Exhausted"| Cascade["5h Cooldown + Unbind Session<br/>Cascade to Claude Sonnet/Opus 4.6"]
The proxy supports combining multiple accounts across three distinct Google services flavors:
google(Google Cloud Code OAuth): Connects directly to Google's internal Cloud Code APIs (daily-cloudcode-pa.googleapis.comorcloudcode-pa.googleapis.com/v1internal). Supports 1-click Google Sign-in inag-doctor-ui, automatically retrieving and refreshing OAuth tokens.google-gemini(Google AI Studio API Keys): Connects tohttps://generativelanguage.googleapis.comusing developer API keys (AIza...). Each key operates with independent rate limits and quotas.gemini-cli(Gemini CLI OAuth): Connects using Gemini CLI OAuth credentials with isolated project quotas.
Accounts can be configured via ag-doctor-ui (Accounts tab), loaded via environment variables (AG_ACCOUNTS_FILE / AG_ACCOUNTS_JSON), or stored in custom_models.json.
To prevent rate limits and eliminate single-account hotspotting:
- Power of Two Choices (P2C): Instead of naive round-robin that floods accounts sequentially, the scheduler queries health scores across the pool, identifies the top-tier candidates within a 45-point delta (
P2C_SCORE_DELTA = 45), and picks between two randomly selected candidates usingcrypto.randomInt. - In-Flight Concurrency Tracking: Each active request subtracts 20 points from an account's dynamic health score during execution. Simultaneous concurrent prompts automatically fan out across idle accounts.
- Weighted Round-Robin: When accounts have equal quota tiers, requests rotate seamlessly to maximize overall throughput.
- Sticky Session Affinity: Conversation threads maintain affinity to the same account across turns to preserve context and cached prompt prefixes, immediately releasing the binding if the account hits a rate limit.
Upstream HTTP 429 errors are decoded into four distinct operational tiers:
soft_rate_limit: Short temporary spike. Retried with a 2-3 second backoff without taking the account out of rotation.rate_limited: Requests-per-minute (RPM) throttle. Account enters a 60-second cooldown while alternate accounts handle traffic.quota_exhausted: Daily/5-hour token quota reached. The account is placed in a 5-hour cooldown, session affinity is unbound, and the pool immediately fails over to the next available account.unknown: Conservative 60-second cooldown fallback.
Smart Weekly Quota Governor: Live quota monitors track weekly token limits (gemini-weekly, 3p-weekly) and display a live countdown to the next scheduled quota reset.
When all Google Gemini accounts in the pool are exhausted or encounter billing limits:
- The proxy automatically cascades to secondary fallback models (e.g. Claude Sonnet 4.6 and Claude Opus 4.6).
- Sibling Account Bypass: Skips sibling accounts linked to the same billing profile or project to eliminate unproductive ping-pong retry loops.
- Injects a transparent Markdown notice into the chat stream informing you of the failover without breaking code generation.
- Background Token Pre-Warming (
schedulePrewarm): Refresh tokens are proactively renewed 60 seconds before expiration in the background, eliminating mid-stream authentication delays. - Token Revocation Quarantine (
markTokenRevoked): Quarantines revoked refresh tokens (invalid_grant) to prevent failed requests, emitting visual notification banners in the UI. - Unlicensed Account Isolation: Accounts lacking active Cloud Code subscriptions (HTTP 403) are quarantined permanently, saving network round-trips.
Gemini 2.0 Thinking models output internal reasoning blocks and encrypted thought signatures. The proxy caches and restores thought_signature across multi-turn conversations, preserving reasoning context across tool invocations and user follow-ups.
Google Antigravity does not use public Gemini REST endpoints (v1beta). Instead, it communicates via internal v1internal endpoints:
POST /v1internal:fetchAvailableModels— Fetches active model definitions, quotas, and capabilities.POST /v1internal:streamGenerateContent?alt=sse— Real-time Server-Sent Event (SSE) chat and code completion stream.POST /v1internal:generateContent— Non-streaming fallback generation.POST /v1internal:loadCodeAssist— Pre-loads context, quotas, and assistant configuration.POST /v1internal:listExperiments— Mocked experiment flags for seamless UI feature activation.GET /metrics&GET /health— Real-time Prometheus metrics and proxy health check probes.
The Cloud Code protocol wraps request payloads inside a top-level request object:
{
"project": "antigravity-internal-project",
"requestId": "req-12345-abcde",
"request": {
"contents": [
{
"role": "user",
"parts": [{ "text": "Refactor this function to be async." }]
}
],
"systemInstruction": {
"parts": [{ "text": "You are an expert TypeScript developer." }]
},
"generationConfig": {
"temperature": 0.2,
"maxOutputTokens": 4096
}
},
"model": "custom-claude-3-5-sonnet"
}The local proxy intercepts these calls, extracts request, translates roles, system instructions, and tool definitions into the targeted provider format, and re-wraps the output in Google's expected envelope: {"response": {...}, "traceId": "...", "metadata": {}}.
Recent Google Antigravity releases hardcode daily-cloudcode-pa.googleapis.com inside the Language Server Go binary. To prevent the IDE from bypassing the local proxy:
- Binary Patching: Build scripts patch the compiled binary string tables, replacing Google's hostname with
127.0.0.1:${AG_PROXY_PORT:-51074}. - Frontend Interception:
src/main.tsintercepts and blocksSetCloudCodeURLIPC requests from overriding the endpoint dynamically. - URL Padding Handler:
src/proxy/urlBuilder.tsstrips null/space binary padding from incoming URLs.
To inject custom models into the native IDE model picker:
- When
fetchAvailableModelsis called,src/proxy/protoInjector.tsparses the Google response. src/proxy/idGenerator.tsgenerates DJB2-hash-based IDs (MODEL_PLACEHOLDER_<hash>) for each user model.- Custom models are dynamically appended to
agentModelSortsand model arrays so they render natively inside the IDE picker with full feature flags enabled.
sequenceDiagram
autonumber
participant IDE as Antigravity IDE (UI)
participant LS as Language Server (Go Binary)
participant Proxy as Local Proxy (127.0.0.1:${AG_PROXY_PORT:-51074})
participant Registry as Translator Registry
participant Ext as External Provider API (OpenAI/Claude/Ollama)
IDE->>LS: User sends prompt with custom model selected
LS->>Proxy: POST /v1internal:streamGenerateContent?alt=sse
Proxy->>Proxy: Intercept request & detect model ID (MODEL_PLACEHOLDER_*)
Proxy->>Registry: Lookup provider translator (e.g. anthropic.ts)
Registry->>Proxy: Transformed payload (Anthropic / OpenAI format)
Proxy->>Ext: POST https://api.anthropic.com/v1/messages (SSE)
loop SSE Token Streaming
Ext-->>Proxy: data: {"type": "content_block_delta", ...}
Proxy->>Proxy: mapChunkToGemini() via jsonRepair
Proxy-->>LS: SSE data: {"response": {"candidates": [...]}}
LS-->>IDE: Render text chunk in chat UI
end
The injected UI seamlessly blends with Antigravity's dark VS Code-adjacent chrome:
| Custom Models Dashboard | Add Model Modal |
|---|---|
Manage and encrypt custom model endpoints & keys |
Configure model names, thinking budget, and context limits |
| Auto-fallback & Failover Stream Notification |
|---|
Real-time stream warning notification when failing over to secondary model |
When a primary model encounters rate limits (rate_limit / 429), context length limits, or provider timeouts, the proxy automatically initiates an Auto-Fallback:
- Seamless Failover: Automatically retries the prompt with a secondary model (e.g. falling back from
MiniMax-M2.7toMiniMax-M3orClaude-3.5-SonnettoGPT-4o). - Native Stream Warning Card: Emits an inline markdown warning block (
> ⚠️ Auto-fallback: <model-1> failed (<reason>). Retrying with <model-2>…) directly into the IDE chat response stream without interrupting the agent's workflow. - Context Preservation: Retains the full conversational history and active tool definitions across the failover boundary.
The proxy features isolated translator modules under src/proxy/translators/:
- OpenAI Translator (
openai.ts): Full mapping between Geminicontents/partsand OpenAImessages, including tool calls, system prompts, andusagetoken metrics. - Anthropic Translator (
anthropic.ts): Handles Claudesystemparameter,tool_useblocks, SSEcontent_block_start/deltaevents, and thinking parameter extraction. - Google AI Studio Passthrough (
google.ts): Direct passthrough to Google AI Studio keys (https://generativelanguage.googleapis.com) with automated model routing. - Ollama Translator (
ollama.ts): Compatible with local Ollama, LM Studio, and vLLM servers without requiring API keys.
- No Buffering Timeouts: Streaming requests (
streamGenerateContent) bypass response buffering and pipe SSE chunks directly to prevent Language Server execution timeouts. - Safe JSON Repair (
jsonRepair.ts): Malformed or truncated SSE chunks are parsed and repaired using string-level state machines (repairPartialJson()). Zero use ofeval()ornew Function().
- Converts Gemini
functionDeclarationsto OpenAItools/ Anthropictool_use. - Matches execution responses (
functionResponse) back to upstreamtool_call_idtokens across multi-turn sessions usingsrc/proxy/shared.tsstate storage.
- Detects reasoning parameters (
reasoning_effort,thinking) inmodelUtils.ts. - Automatically strips or surfaces reasoning blocks (
<think>...</think>) depending on IDE capabilities.
- Short-Circuiting Failures: Automatically trips when an upstream provider experiences persistent errors or timeouts. Prevents the proxy from hanging and keeps the IDE model selection dropdown responsive.
- Adaptive Retry Budget (
retryBudget.ts): Dynamically adjusts retries per provider based on observed historical reliability. Flaky models receive fewer retries to prevent request storms, while stable models are granted retries.
- Seamless Provider Redirection: If a primary custom model returns
429 Rate Limitor5xx Server Error, the proxy automatically reroutes the prompt to an alternate configured fallback model. - In-Stream Transparency: Emits a lightweight markdown notification chunk directly at the top of the chat stream (e.g.
> ⚠️ Auto-fallback: Claude 3.5 Sonnet failed (rate_limit). Retrying with DeepSeek R1...).
- Real-Time Latency Metrics (
metrics.ts): Exposes latency distributions (proxy_upstream_ms) and error counters (proxy_errors_total) via/metrics. - Config Import / Export (
configExchange.ts): Provides structured JSON export and bulk import for easy model preset sharing across developer teams. - Native System Tray Integration (
tray.ts,menu.ts): Embedded tray menu providing quick server status, log shortcuts, and toggle controls.
All custom model configurations are stored in ~/.gemini/antigravity/custom_models.json (or %USERPROFILE%\.gemini\antigravity\custom_models.json on Windows).
- Encryption at Rest: API keys are encrypted using AES-256-GCM via Electron
safeStorage(backed by Windows DPAPI, macOS Keychain, or Linux Secret Service). - Auto-Migration: Upgrades legacy plaintext keys to encrypted payloads (
enc:gcm:...) seamlessly on first run (src/proxy/modelLoader.ts).
- Request Body Size Cap: Default 100 MB payload limit (configurable via
AG_MAX_BODY_SIZE_MB/AG_MAX_BODY_SIZE) to support large multi-turn conversations while preventing buffer exhaustion DoS attacks (HTTP 413 Payload Too Large). - Timeouts: 30s-120s configurable timeouts on all outbound requests to prevent hung connections.
- Header Masking: CSRF tokens and authorization headers are scrubbed from diagnostic logging outputs.
Double-click or run in terminal:
repatch.batnpm run build
npm run repatch# macOS (Extracts /Applications/Antigravity.app, patches, repacks app.asar)
npm run repack:mac
# Linux (Auto-detects installation directory)
npm run repack:linuxIf your network requires port 443 interception with custom SSL certificates:
"Start Antigravity MITM.bat"(Requires Administrator privileges)
ag-doctor is the built-in diagnostic and maintenance tool provided with this repository.
# Run full diagnostic suite (Binary patch status, proxy port, config integrity)
npm run doctor
# Quick health check
npm run doctor:check
# Automated repair (Applies binary patch, fixes corrupt config, resets ports)
npm run doctor:repair
# List active custom models and test API endpoints
npm run doctor:models
# Stream real-time diagnostic logs
npm run doctor:logs
# Purge orphan trajectories & vacuum database (Dual Summary Store cleanup)
node ag-doctor/bin/ag-doctor.js db:prune
node ag-doctor/bin/ag-doctor.js db:prune --dry-run
# Re-key models with proxy-compatible encryption
node ag-doctor/bin/ag-doctor.js models rekey
# Apply version-specific surgical patches
npm run patch:2.17 # Antigravity 2.17.x
npm run patch:2.18 # Antigravity 2.18.x
# Windows one-click repatch & launcher (or double-click repatch.bat in Explorer)
repatch.batThe ecosystem provides full dual-support for both the classic Electron shell and the VS Code-based Antigravity IDE:
| Dimension | Antigravity 2.0 (Classic Shell) | Antigravity IDE (VS Code) |
|---|---|---|
| Installation Path | %LOCALAPPDATA%\Programs\antigravity |
%LOCALAPPDATA%\Programs\Antigravity IDE |
| Binary / Core | v2.9.1 / v2.18.x (Electron shell) | v1.107.0 (VS Code platform fork) |
| UI Experience | Lightweight Agent chat & session management | Full IDE (editor, terminals, git, extensions) |
| Patch Mechanism | app.asar overlay + language_server.exe string table |
jetski.cloudCodeUrl override + out/main.js hook |
| Proxy Lifecycle | Internal Electron main process lifecycle | Autonomous auto-starter hook in main.js |
| Models Injected | All custom models in custom_models.json |
All custom models in custom_models.json |
- Autonomous Proxy Auto-Starter (
out/main.js): Antigravity IDE automatically verifies if port51074is active upon launch. If closed (e.g. Antigravity 2.0 is not running), it immediately spawns the detached background proxy runner from~/.gemini/antigravity/proxy/before extension activation, eliminating initial authentication errors (ECONNREFUSED). - Dual Summary Store Reconciliation: Language Server 2.18+ synchronizes
conversation_summaries.db(SQLite) andagyhub_summaries_proto.pb(ProtobufSummariesState). Boot repair inproxy-runner.jsandag-doctor db:pruneeliminates orphan sessions (missingconversations/<id>.db), syncsannotations/<id>.pbtxtarchive flags intoraw_summary(field 15 tag0x7a), and scrubsapp_storage.jsonso archived/deleted sessions never resurrect. - Chat Workflow Pills & Injected Suggestions: Injected renderer hooks embed interactive workflow action pills (
git status,git diff,review,explain) directly above the IDE input field, boosting command discovery and productivity. - Unified Model Configuration: Both flavors read from the centralized
~/.gemini/antigravity/custom_models.jsonwith live health monitoring and auto-fallback. - 1-Click Launchers:
Start Antigravity IDE.bat: Launches Antigravity IDE with guaranteed background proxy execution.repatch.bat: One-click repatch and launcher for both classic and IDE installations.
models rekey: The language server stores API keys in its ownv10format that the local proxy cannot decrypt.ag-doctor models rekeywalks each affected model and re-enters the key in the proxy-compatible format (interactive, or--keys-file <json>for batch).
Tip: Add or re-key custom models via
ag-doctor models add/models rekeyorag-doctor-uirather than the IDE's internal settings UI — the IDE re-encrypts keys into its private format, which the proxy cannot read.
ag-doctor runs in two execution modes (ag-doctor/bin/ag-doctor.js):
- CLI Mode: One-shot execution for terminal environment checks, model listing, and automated repairs.
- Worker Mode (
--worker): Spawns an in-process JSON-RPC daemon viastdin/stdout, eliminating process spawn overhead for IDE UI queries.
In addition to the terminal CLI, this repository includes ag-doctor-ui, a dedicated Electron UI renderer application:
- Visual Health Monitors: Real-time status indicators for port
${AG_PROXY_PORT:-51074}binding, Language Server binary patches, and SSL certificate validity. - One-Click Auto-Repair: Single button repair flow to un-stick ports, restore corrupt
app.asarbackups, and re-apply version patches. - Live Log Inspector: Integrated log tailing window with real-time severity filters (
INFO,WARN,ERROR) and automatic API key masking.
- Real-Time Network Logging: Intercepts and displays active Cloud Code API requests, HTTP status codes, target models, translated providers, and end-to-end latency benchmarks.
- Payload Diff & Replay: Generates visual diff views (
generateDiffView) for request/response payloads and enables single-click request replaying (replayEntry). - Multi-Field Filtering: Filter entries instantly by URL path, model name, provider, or HTTP status code.
- Visual Error Simulation: Interactive showcase previewing all provider error scenarios (Rate Limits 429, Billing/Quota Overage, Auth Errors 401/403, Network Timeouts, SSL Bypass failures).
- Native Antigravity Banner Rendering: Renders full-replica native Antigravity error cards complete with category badges, status tags, decoded troubleshooting hints, and primary/secondary action buttons (
ag-btn-primary,ag-btn-dismiss). - Interactive QA Filter Chips: Filter error cards by scenario category (
Rate Limit,Authentication,Network,Quota) for visual debugging and QA verification.
- Real-Time Token Usage Metrics: Displays precise breakdown for Prompt Tokens, Completion Tokens, and Total Tokens consumed per request and aggregated across sessions.
- Context Cache Hit Ratio: Measures and displays Google Gemini and Claude prompt caching performance (
cachedTokens/promptTokens), helping you monitor context cache efficiency. - Financial Savings Estimation: Automatically calculates estimated dollar savings derived from prompt cache hits and reduced cached pricing tiers.
- Per-Provider Analytics: Filter and inspect token consumption, costs, and end-to-end latency metrics across Google Gemini, OpenAI, Claude, DeepSeek, and local models.
- Multi-Version Patching:
ag-doctorautomatically detects installed Antigravity releases (v2.0.x through v2.18.x) and performs binary string replacement or settings interception without corrupting Go executable alignment. - Surgical Patch Scripts: Dedicated automated scripts for each major version tier (
npm run patch:2.2,patch:2.3,patch:2.5,patch:2.14,patch:2.15,patch:2.17,patch:2.18). - Backup & Rollback Safety: Creates timestamped
.bakcopies ofapp.asarbefore modifying binary payloads, allowing instant 1-command rollbacks (npm run doctor:repair). - Auto-Healing Diagnostics: The doctor check starts the emergency proxy stub when port
${AG_PROXY_PORT:-51074}is closed (so the patched language server can initialise), andproxy startreplaces a stub with the real proxy. Provider probes use a 15s timeout with a retry on timeouts to avoid false "down" alarms.
Antigravity Remote 2.0 extends Google Antigravity IDE and custom LLM models directly to mobile devices (Flutter on Android & iOS). Control agent trajectories, monitor streaming reasoning models, review unified diffs, execute terminal commands, and approve CLI tool actions from anywhere via local Wi-Fi or automated Cloudflare Quick Tunnels.
IDE Chat UI ↔ Language Server (Hub :55256) ◄── gRPC-Web ── Daemon Go (:8090 / Cloudflare Tunnel)
▲
│ WebSocket (JSON RPC)
▼
Mobile Client (Flutter App)
| Tabbed Artifact Multitasking | Right Context Drawer |
|---|---|
![]() |
![]() |
Simultaneous artifact navigation (audit_settings_remote.md) and chat input |
Quick access to Subagents, Changed Files, Uploads, MCP & Background Tasks |
| Modular Settings & Configuration |
|---|
![]() |
| Account, General, Appearance, Models, Customizations (MCP & Skills), Browser (CDP), App & Daemon Bridge |
-
Go Daemon Bridge (
remote/daemon):- Process Auto-Discovery: Automatically locates running
language_serverinstances, parses CSRF credentials from process parameters, and maintains connection health via background watchdogs. - gRPC-Web Framing: Decodes and encodes gRPC-Web Protobuf and Jetbox Connect JSON envelopes transparently.
- StepRecovery Buffer: In-memory ring buffer of the last 100 trajectory frames ensures zero message loss during transient network switches (e.g. Wi-Fi to 5G).
- Push Quota Polling: Monitors Language Server user quota summary every 60s (only while clients are active) and pushes real-time quota updates over WebSocket.
- Process Auto-Discovery: Automatically locates running
-
Security & Zero-Config Pairing:
- UDP LAN Discovery: Broadcasts UDP beacons on port
41234for instant zero-configuration local network discovery. - 6-Digit Rotating PIN & Bearer Tokens: Authenticate mobile clients using a 60-second rotating PIN displayed on the desktop console.
- Cloudflare Quick Tunnels: 1-click end-to-end encrypted remote access outside local Wi-Fi with ASCII terminal QR code generation.
- UDP LAN Discovery: Broadcasts UDP beacons on port
-
Interactive Human-in-the-Loop Controls:
- Tool Approvals (
submit_approval): Approve or reject dangerous commands (run_command,write_to_file) with single-use (once) or full-session (session) scopes and auto-rejection timeouts. - Structured Question Answering (
AskQuestion): Interactive radio button and multi-select cards for resolving agent forks directly from phone notifications. - Colosseum Battle Arena: Multi-model duel supervision (e.g. Claude 3.5 Sonnet vs Gemini 3.8 Flash Tiered) with side-by-side branch comparison.
- Tool Approvals (
-
Offline-First Resilience & Outbox Queue:
- Optimistic UI & Local Outbox: Messages composed while disconnected are stored in local FIFO storage and automatically drained upon reconnection.
- Zero Duplicate Deliveries: UUID-based request mapping and message deduplication prevent repeated prompts.
Pre-built binaries are automatically built and published via GitHub Actions for every release:
| Component | Platform / Architecture | Asset Name | Description |
|---|---|---|---|
| Android App (Universal) | Android 7.0+ (ARM64, ARMv7, x86_64) | antigravity-remote-universal.apk |
Single APK for all Android devices |
| Android App (Split ABI) | Android 64-bit ARM (arm64-v8a) |
app-arm64-v8a-release.apk |
Lightweight optimized APK (~25MB) |
| Android App Bundle | Google Play Store Format | app-release.aab |
Official signed App Bundle |
| Daemon Bridge | Windows (x86_64) |
antigravity-remote-daemon-windows-amd64.exe |
Windows standalone daemon binary |
| Daemon Bridge | Linux (x86_64) |
antigravity-remote-daemon-linux-amd64 |
Linux headless server daemon |
| Daemon Bridge | macOS Apple Silicon (arm64) |
antigravity-remote-daemon-darwin-arm64 |
macOS M1/M2/M3 native binary |
# 1. Start the Remote Daemon on host PC (with Cloudflare tunnel & token)
cd remote/daemon
go run main.go --port 8090 --tunnel cloudflare --auth-token mysecret
# Or run pre-built daemon binary directly:
./antigravity-remote-daemon-windows-amd64.exe --tunnel cloudflare
# 2. Run the Flutter Mobile Companion App (or install the release APK)
cd remote/mobile
flutter run -d <device-id>| Provider | Provider Slug | Transport / Format | Target Base URL | Key / Auth Required | Streaming | Tool Calling |
|---|---|---|---|---|---|---|
| Google Cloud Code (OAuth Pool) | google |
Cloud Code / Gemini | https://daily-cloudcode-pa.googleapis.com |
OAuth Token | Yes | Yes |
| Google AI Studio | google-gemini |
Gemini REST | https://generativelanguage.googleapis.com |
API Key (AIza...) |
Yes | Yes |
| Gemini CLI (OAuth) | gemini-cli |
Cloud Code / Gemini | https://cloudcode-pa.googleapis.com/v1internal |
OAuth Token | Yes | Yes |
| OpenAI | openai |
OpenAI | https://api.openai.com/v1 |
Yes | Yes | Yes |
| Anthropic | anthropic |
Anthropic | https://api.anthropic.com/v1 |
Yes | Yes | Yes |
| OpenRouter | openrouter |
OpenAI | https://openrouter.ai/api/v1 |
Yes | Yes | Yes |
| DeepSeek | deepseek |
OpenAI | https://api.deepseek.com/v1 |
Yes | Yes | Yes |
| Groq | groq |
OpenAI | https://api.groq.com/openai/v1 |
Yes | Yes | Yes |
| Mistral AI | mistral |
OpenAI | https://api.mistral.ai/v1 |
Yes | Yes | Yes |
| Codestral | codestral |
OpenAI | https://codestral.mistral.ai/v1 |
Yes | Yes | Yes |
| xAI (Grok) | xai |
OpenAI | https://api.x.ai/v1 |
Yes | Yes | Yes |
| Cohere | cohere |
OpenAI | https://api.cohere.com/v1 |
Yes | Yes | Yes |
| Cerebras | cerebras |
OpenAI | https://api.cerebras.ai/v1 |
Yes | Yes | Yes |
| NVIDIA NIM | nvidia |
OpenAI | https://integrate.api.nvidia.com/v1 |
Yes | Yes | Yes |
| OpenCode | opencode |
OpenAI | Custom Endpoint | Yes | Yes | Yes |
| Kimi (Moonshot) | kimi |
Anthropic / OpenAI | https://api.moonshot.ai/v1 |
Yes | Yes | Yes |
| Fireworks AI | fireworks |
Anthropic / OpenAI | https://api.fireworks.ai/inference/v1 |
Yes | Yes | Yes |
| MiniMax | minimax |
OpenAI | https://api.minimaxi.chat/v1 |
Yes | Yes | Yes |
| Ollama | ollama |
OpenAI / Ollama | http://localhost:11434 |
No | Yes | Yes |
| LM Studio | lmstudio |
OpenAI | http://localhost:1234/v1 |
No | Yes | Yes |
| Llama.cpp | llamacpp |
OpenAI | http://localhost:8080/v1 |
No | Yes | Yes |
| Custom / OpenAI-compat | custom |
OpenAI | Custom Endpoint | Optional | Yes | Yes |
Configurations are saved under ~/.gemini/antigravity/custom_models.json (or %USERPROFILE%\.gemini\antigravity\custom_models.json on Windows):
{
"providers": [
{
"id": "provider-1720000000000-1",
"name": "Anthropic",
"provider": "anthropic",
"apiUrl": "https://api.anthropic.com/v1/messages",
"apiKey": "enc:gcm:...",
"enabled": true,
"models": [
{
"id": "claude-3-5-sonnet-20241022",
"displayName": "Claude 3.5 Sonnet",
"enabled": true
}
]
}
]
}Backward Compatibility: The proxy automatically detects and migrates legacy flat array schemas (
[{"name": "...", "provider": "..."}]) to the modern provider hierarchy on startup.
├── ag-doctor/ # Diagnostic CLI suite & worker daemon
├── scripts/ # Repack, deploy, auto-heal, and MITM launcher scripts
├── src/
│ ├── main.ts # Electron main process bootstrap & interceptors
│ ├── proxy.ts # Core HTTP proxy server orchestration & interception
│ ├── constants.ts # Central source of truth (Providers, default ports, timeouts)
│ ├── preload.ts # Injected Custom Models Settings UI & contextBridge
│ ├── ipcHandlers.ts # Canonical IPC registry & handler dispatcher
│ ├── schemaValidator.ts # Runtime response & model schema validation
│ ├── services/ # Core domain services (modelStore, cryptoStore, settingsService)
│ ├── proxy/
│ │ ├── registry.ts # Translator auto-discovery registry & router
│ │ ├── protoInjector.ts # Protobuf payload injection for IDE picker
│ │ ├── protobuf.ts # Manual varint protobuf encoding
│ │ ├── jsonRepair.ts # Safe non-eval SSE JSON repair
│ │ ├── circuitBreaker.ts # Per-provider failure isolation
│ │ ├── retryStrategy.ts # Exponential backoff retry logic
│ │ └── translators/ # Format translators (openai, anthropic, google, ollama)
│ └── __tests__/ # 60 test files, 1400+ unit tests (Vitest)
# Compile TypeScript files (src/ -> dist/)
npm run build
# Watch mode for iterative code changes
npm run watchThe test suite runs via Vitest:
# Run all unit tests across 60 test files
npm test
# Run tests in watch mode
npm run test:watchTo add support for a new LLM provider format:
- Add provider name to
PROVIDERSandALL_PROVIDERSin src/constants.ts. - If compatible with OpenAI or Anthropic formats, add it to
OPENAI_COMPATorANTHROPIC_COMPATin src/constants.ts (handled automatically bysrc/proxy/registry.ts). - If the provider uses a unique wire protocol:
- Create
src/proxy/translators/<provider>.tsexporting mapping functions (mapGeminiTo<Provider>,map<Provider>ToGemini,map<Provider>ChunkToGemini). - Register the translator in src/proxy/registry.ts.
- Create
- Add presets to src/presets.ts (optional) and tests in
src/__tests__/.
| Variable | Default | Description |
|---|---|---|
AG_PROXY_PORT |
51074 |
Local proxy listen port |
AG_BIND_HOST |
127.0.0.1 |
Bind interface for the proxy, MITM, stub, and daemon probes |
AG_MITM_PORT |
443 |
MITM HTTPS listener port |
AG_STUB_PORT |
51999 |
Emergency proxy stub port |
AG_DAEMON_PORT |
8090 |
Remote daemon WebSocket port |
AG_DAEMON_TOKEN |
— | Auth token for daemon remote access |
Setting AG_BIND_HOST to 0.0.0.0 exposes the proxy on all interfaces (required for WSL2 or LAN access).
For advanced options (retry budgets, timeout tuning, certificate pinning, daemon parameters), refer to the comprehensive .env.example configuration template.
| Symptom | Cause | Solution |
|---|---|---|
| Models missing from chat dropdown | IDE update overwrote app.asar |
Run npm run doctor:repair or repatch.bat |
| Connection test failed (401/403) | Invalid or expired API Key | Check key in Settings or npm run doctor:models |
${AG_PROXY_PORT:-51074} in use |
Another proxy instance active | ag-doctor automatically picks fallback port |
ERR_HTTP_HEADERS_SENT in logs |
Upstream response race condition | Handled automatically by safeWriteHead helpers |
| SSL / Certificate error | Corporate proxy SSL interception | Enable MITM mode via "Start Antigravity MITM.bat" |
Full troubleshooting guides are detailed in TROUBLESHOOTING.md.
You can add Claude 3.5 Sonnet, DeepSeek R1, OpenAI GPT-4o, or any custom LLM model by opening the custom model settings modal in Google Antigravity IDE, entering your API key and provider base URL, and running the automatic patcher (repatch.bat on Windows or npm run repack:mac on macOS).
Yes. All custom model configurations and API keys are stored locally and encrypted at rest using AES-256-GCM via Electron safeStorage (backed by Windows DPAPI, macOS Keychain, or Linux Secret Service). Keys are never sent to third-party tracking servers.
Yes. Set the provider to ollama or openai with endpoint http://localhost:11434 (Ollama) or http://localhost:1234/v1 (LM Studio). No API keys are required for offline local inference.
If a primary custom model returns a 429 Rate Limit, quota overage, or timeout, the proxy automatically retries the prompt with your configured secondary fallback model and renders a native warning banner in the chat stream without breaking conversation history.
You can connect multiple Google accounts (via 1-click Google Sign-in in ag-doctor-ui or Google AI Studio developer API keys). The proxy aggregates their quotas using Power of Two Choices (P2C) load balancing, automatically penalizes accounts handling concurrent active requests, and rotates accounts when rate limits (429) or quotas are reached. If all Google Gemini accounts are exhausted, it cascades to Claude Sonnet/Opus 4.6.
An autonomous hook embedded in out/main.js checks if the local proxy port 51074 is active on boot. If the proxy isn't already running, it immediately spawns the detached background proxy runner from ~/.gemini/antigravity/proxy/ before extensions activate, eliminating initial connection refused (ECONNREFUSED) errors.
Starting in Antigravity v2.18+, the Language Server synchronizes sessions across two stores: conversation_summaries.db (SQLite) and agyhub_summaries_proto.pb (Protobuf). Cleaning only SQLite causes deleted or archived sessions to resurrect from Protobuf upon IDE reboot. ag-doctor db:prune cleans both stores simultaneously, embeds archive flags into protobuf tag 0x7a, and scrubs app_storage.json so archived sessions never reload.
For maximum repository discoverability on GitHub Search and Google SERP, ensure the following repository topics are assigned under GitHub Repository Settings > About:
google-antigravity • antigravity-ide • custom-models • claude-3-5-sonnet • deepseek-r1 • openai-gpt4o • ollama • openrouter • llm-proxy • cloudcode-patch
- License: Distributed under the Apache-2.0 License. See LICENSE for details.
- Original Repository & Credits: Special thanks to Abdulvahap OGUT for the original project repository: vahapogut/antigravity-add-model.





















