Skip to content

anbt97/zerogravity

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important

Source code has moved to a private repository for long-term sustainability. Binaries, Docker images, and releases will continue to be published here.

Want access to the source?

Read-only access is granted on request.

Platform License API

ZeroGravity

ZeroGravity

OpenAI, Anthropic, and Gemini-compatible proxy for Google's Antigravity.

Early stage. Ran this on OpenCode with an Ultra account for 3 days straight, stress testing the whole time. No issues so far.

This software is developed on Linux. I aim to support every OS as best as possible, so if there is any issue please open an issue and I will be happy to assist.

Star the repo so more people can find it while it still works. Issues and PRs are welcome.


Models

Name Label Notes
opus-4.6 Claude Opus 4.6 (Thinking) Default model
sonnet-4.6 Claude Sonnet 4.6 (Thinking)
opus-4.5 Claude Opus 4.5 (Thinking)
gemini-3-pro Gemini 3 Pro (High) Default Pro tier
gemini-3-pro-high Gemini 3 Pro (High) Alias
gemini-3-pro-low Gemini 3 Pro (Low)
gemini-3-flash Gemini 3 Flash Recommended for dev

Quick Start

# Headless mode (no running Antigravity app needed)
RUST_LOG=info ./zerogravity --headless

# Or use the daemon manager
zg start

Authentication

The proxy needs an OAuth token:

  1. Env var: ZEROGRAVITY_TOKEN=ya29.xxx
  2. Token file: ~/.config/zerogravity/token
  3. Runtime: curl -X POST http://localhost:8741/v1/token -d '{ "token": "ya29.xxx" }'

API Key Protection (Optional)

Protect the proxy from unauthorized access by setting an API key:

# Single key
export ZEROGRAVITY_API_KEY="your-secret-key"

# Multiple keys (comma-separated)
export ZEROGRAVITY_API_KEY="key1,key2,key3"

Clients must then include the key in requests using either header format:

# OpenAI-style (Authorization: Bearer)
curl http://localhost:8741/v1/chat/completions \
  -H "Authorization: Bearer your-secret-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "gemini-3-flash", "messages": [{"role": "user", "content": "hi"}]}'

# Anthropic-style (x-api-key)
curl http://localhost:8741/v1/messages \
  -H "x-api-key: your-secret-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "opus-4.6", "max_tokens": 1024, "messages": [{"role": "user", "content": "hi"}]}'

Note: If ZEROGRAVITY_API_KEY is not set, no API key authentication is enforced (backward-compatible). The /health and / endpoints are always public.

How to get the token
  1. Open Antigravity → Help > Toggle Developer Tools
  2. Go to the Network tab
  3. Send any prompt
  4. Find a request to generativelanguage.googleapis.com
  5. Look for the Authorization: Bearer ya29.xxx header
  6. Copy the token (starts with ya29.)

Note: OAuth tokens expire after ~1 hour. If Antigravity is installed on the same machine, auto-refresh works automatically.

Auto-refresh with state.vscdb (recommended for Docker / remote servers)

If you don't have Antigravity installed on the machine running ZeroGravity (e.g. a remote server or Docker container), you can copy the state.vscdb file from any computer where Antigravity is logged in. This database contains a long-lived refresh token that lets the proxy auto-refresh access tokens indefinitely — no manual token rotation needed.

1. Find state.vscdb on the machine with Antigravity

OS Path
Linux ~/.config/Antigravity/User/globalStorage/state.vscdb
macOS ~/Library/Application Support/Antigravity/User/globalStorage/state.vscdb
Windows %APPDATA%\Antigravity\User\globalStorage\state.vscdb

2. Copy it to your server / Docker host

Just the single state.vscdb file — no other files needed.

3. Mount and configure

Docker run:

docker run -d --name zerogravity \
  -p 8741:8741 -p 8742:8742 \
  -v /path/to/state.vscdb:/authfile/state.vscdb:ro \
  -e ZEROGRAVITY_STATE_DB=/authfile/state.vscdb \
  ghcr.io/nikketryhard/zerogravity:latest

Docker Compose (place state.vscdb in an ./authfile/ directory next to docker-compose.yml):

services:
  zerogravity:
    image: ghcr.io/nikketryhard/zerogravity:latest
    ports:
      - "8741:8741"
      - "8742:8742"
    volumes:
      - ./authfile:/authfile:ro
    environment:
      - ZEROGRAVITY_STATE_DB=/authfile/state.vscdb
      - RUST_LOG=info

Native (no Docker):

ZEROGRAVITY_STATE_DB=/path/to/state.vscdb ./zerogravity --headless

Note: This is a one-time copy. The refresh token inside state.vscdb is long-lived — the proxy automatically uses it to obtain fresh access tokens. You only need to re-copy if you log out of Antigravity on the source machine or if Google revokes the refresh token.

Setup

Download Binary

# x86_64
curl -fsSL https://github.com/NikkeTryHard/zerogravity/releases/latest/download/zerogravity-linux-x86_64 -o zerogravity
chmod +x zerogravity

# ARM64
curl -fsSL https://github.com/NikkeTryHard/zerogravity/releases/latest/download/zerogravity-linux-arm64 -o zerogravity
chmod +x zerogravity

Linux

./scripts/setup-linux.sh
zg start

macOS

./scripts/setup-macos.sh
zg start

Windows

# Run as Administrator
powershell -ExecutionPolicy Bypass -File scripts\setup-windows.ps1
.\zerogravity.exe

Docker

docker run -d --name zerogravity \
  -p 8741:8741 -p 8742:8742 \
  -e ZEROGRAVITY_TOKEN=ya29.xxx \
  -e ZEROGRAVITY_API_KEY=your-secret-key \
  ghcr.io/nikketryhard/zerogravity:latest

Or with docker-compose:

# Set token and optional API key in .env file
echo "ZEROGRAVITY_TOKEN=ya29.xxx" > .env
echo "ZEROGRAVITY_API_KEY=your-secret-key" >> .env
docker compose up -d

Note: The Docker image bundles the LS binary so no Antigravity installation is needed. If Antigravity is installed on the host, mount its config dir for auto token refresh: -v $HOME/.config/Antigravity:/root/.config/Antigravity:ro

Endpoints

Method Path Description
POST /v1/responses Responses API (sync + streaming)
POST /v1/chat/completions Chat Completions API (OpenAI compat)
POST /v1/messages Messages API (Anthropic compat)
POST /v1beta/models/{model}:{action} Official Gemini v1beta routes
GET /v1/models List available models
GET /v1/sessions List active sessions
DELETE /v1/sessions/{id} Delete a session
POST /v1/token Set OAuth token at runtime
GET /v1/usage Token usage stats
GET /v1/quota Quota and rate limits
GET /health Health check

zg Commands

Command Description
zg start Start the proxy daemon
zg stop Stop the proxy daemon
zg restart Stop + start
zg update Download latest binary from GitHub Releases
zg status Service status + quota + usage
zg logs [N] Show last N lines (default 30)
zg logs-follow [N] Tail last N lines + follow
zg logs-all Full log dump
zg test [msg] Quick test request (gemini-3-flash)
zg health Health check

License

MIT

About

OpenAI, Anthropic, and Gemini-compatible proxy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 60.3%
  • Dockerfile 22.5%
  • PowerShell 17.2%