agy-bridge
Health Pass
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 10 GitHub stars
Code Pass
- Code scan — Scanned 3 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Run Google Antigravity (CLI, IDE, hub) on any third-party LLM: Gemini v1beta + Cloud Code v1internal -> OpenAI-compatible chat/completions
agy-bridge
Run Google Antigravity on any third-party LLM — OpenRouter, Together, Groq, a local vLLM, Ollama,
or anything else that speaks OpenAI /chat/completions.
Antigravity is not hardwired to Gemini. Its CLI talks the public Gemini API and its IDE talks the
Cloud Code API; both accept an endpoint override. agy-bridge sits on that override and translates
the Gemini wire format into an OpenAI-compatible one, including streaming and full tool calling.
Antigravity CLI ──Gemini v1beta──┐
├──► agy-bridge ──OpenAI /v1/chat/completions──► your model
Antigravity IDE ──Cloud Code─────┘

Antigravity IDE, mid-task. The picker at the bottom reads Claude Opus 4.6 (Thinking) · DeepSeek-V4.1-Flash-1017:
the client thinks it is talking to Google, while every generated token comes from the configured upstream.
Why
Antigravity's agent loop is good; its model list is not yours. Pointing the app at your own gateway
keeps your quota, your model choice and your keys under your control, with the native tool schema,
streaming and multi-turn loop intact.
Features
- Two protocols, one binary. Public Gemini (
v1beta/models/{model}:generateContent) for the CLI,
Cloud Code (v1internal:*) for the IDE and its hub. - Streaming. OpenAI SSE deltas are re-framed as Gemini SSE chunks, reasoning included.
- Tool calling. Gemini
functionDeclarationsmap 1:1 onto OpenAItools; tool results flow back
asrole: toolmessages with synthesised call ids. - Selective proxying. On the Cloud Code route only generation is rerouted; sign-in, the model
catalog and quota calls are forwarded verbatim to Google with the caller's own token. - No dependencies. Standard library only, one static binary for Linux, macOS and Windows.
Quick start
Prebuilt binaries
Download from Releases — Linux (x86-64,
ARM64), Windows x86-64, macOS (Apple Silicon, Intel) — and verify with SHA256SUMS. No Go toolchain
needed.
Hosted
export GOOGLE_GEMINI_BASE_URL=https://your-host/agy
export GEMINI_API_KEY=<your-upstream-key>
agy
~/.gemini/config/settings.json must contain:
{ "modelProvider": "gemini" }
Self-hosted
make build
UPSTREAM_BASE=https://api.openai.com/v1 UPSTREAM_KEY=sk-... DEFAULT_MODEL=gpt-4o-mini ./bin/agy-bridge
GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:8198 GEMINI_API_KEY=anything agy
Windows in four steps
No Go toolchain needed — use the prebuilt binary.
# 1. download
curl.exe -L -o "$env:USERPROFILE\Downloads\agy-bridge.exe" `
https://github.com/codewith-aditya/agy-bridge/releases/download/v0.1.0/agy-bridge-windows-amd64.exe
# 2. move it somewhere permanent
mkdir "$env:USERPROFILE\tools\agy-bridge" -Force
move "$env:USERPROFILE\Downloads\agy-bridge.exe" "$env:USERPROFILE\tools\agy-bridge\"
# 3. run it in its own terminal
$env:UPSTREAM_BASE="https://api.openai.com/v1"
$env:UPSTREAM_KEY="sk-..."
$env:DEFAULT_MODEL="gpt-4o-mini"
& "$env:USERPROFILE\tools\agy-bridge\agy-bridge.exe"
// 4. %APPDATA%\Antigravity IDE\User\settings.json
{ "jetski.cloudCodeUrl": "http://127.0.0.1:8198" }
Restart the IDE. Building from source instead:
make is not available on Windows, so build directly and run it in its own terminal:
winget install GoLang.Go
git clone https://github.com/codewith-aditya/agy-bridge.git
cd agy-bridge
go build -trimpath -ldflags "-s -w" -o agy-bridge.exe ./cmd/agy-bridge
$env:UPSTREAM_BASE="https://api.openai.com/v1"
$env:UPSTREAM_KEY="sk-..."
$env:DEFAULT_MODEL="gpt-4o-mini"
.\agy-bridge.exe
Then point the client at it from a second terminal:
$env:GOOGLE_GEMINI_BASE_URL="http://127.0.0.1:8198"
$env:GEMINI_API_KEY="unused" # the bridge already has UPSTREAM_KEY
agy
For the IDE, add "jetski.cloudCodeUrl": "http://127.0.0.1:8198" to its user settings. To keep the
bridge running without an open terminal, register it with NSSM — see
docs/deployment.md.
Antigravity IDE
Add to the IDE's user settings.json (%APPDATA%\Antigravity IDE\User\settings.json on Windows,~/.config/Antigravity IDE/User/settings.json on Linux):
{ "jetski.cloudCodeUrl": "http://127.0.0.1:8198" }
Restart the IDE. Google sign-in still runs through the passthrough, so onboarding and the native
model picker keep working while generation is served by your upstream.
Configuration
| Variable | Default | Description |
|---|---|---|
LISTEN |
127.0.0.1:8198 |
Bind address. |
UPSTREAM_BASE |
https://api.openai.com/v1 |
OpenAI-compatible base URL, no trailing slash. |
UPSTREAM_KEY |
empty | Upstream key for the CLI route. Empty means the caller's GEMINI_API_KEY is used. |
CLOUD_SERVER_KEY |
empty | Upstream key for the IDE route, whose caller presents a Google OAuth bearer instead of an upstream key. |
DEFAULT_MODEL |
empty | Upstream model for any Gemini model ID not present in MODEL_MAP. |
MODEL_MAP |
empty | gemini-3.1-pro-preview=glm-5.3,gemini-3-flash=deepseek-v4-flash |
MAX_OUTPUT_TOKENS |
100000 |
Clamp for maxOutputTokens. Antigravity requests 65535, which passes through at this default. 0 disables it. |
CLOUD_CODE_PASSTHROUGH_BASE |
https://cloudcode-pa.googleapis.com |
Google host for non-generation Cloud Code RPCs. |
DEBUG |
empty | Any value dumps the last request bodies to /tmp. |
UPSTREAM_KEY is deliberately optional: leaving it empty makes every caller spend their own key,
which is what makes a shared endpoint safe.
Endpoints
| Method | Path | Purpose |
|---|---|---|
POST |
/v1beta/models/{model}:generateContent |
Gemini generation. |
POST |
/v1beta/models/{model}:streamGenerateContent?alt=sse |
Gemini streaming. |
POST |
/v1beta/models/{model}:countTokens |
Rough token estimate. |
POST |
/v1internal:generateContent |
Cloud Code generation. |
POST |
/v1internal:streamGenerateContent |
Cloud Code streaming. |
POST |
/v1internal:* |
Forwarded to Google with the caller's bearer. |
GET |
/health |
Effective configuration. |
Check what a running bridge is actually serving before pointing a client at it:
curl -s http://127.0.0.1:8198/health | jq
{
"ok": true,
"upstream": "https://api.openai.com/v1",
"default_model": "gpt-4o-mini",
"model_map": { "gemini-3-flash": "deepseek-v4-flash" }
}
upstream, default_model and model_map are the values the process started with, so this is the
quickest way to tell a stale deployment from a wrong one.
How it works
Transport override. The CLI honours GOOGLE_GEMINI_BASE_URL. The IDE honours the hiddenjetski.cloudCodeUrl setting; its hub additionally honours CLOUD_CODE_URL and--cloud_code_endpoint=.
Request translation. systemInstruction becomes a system message. contents[].role == "model"
becomes an assistant message carrying tool_calls. Inline base64 images become image_url parts.
Two details matter more than they look:
- Antigravity sends
functionResponseunder rolemodel, notuseras the Gemini spec says.
Dispatching on role silently turns every tool result into an empty assistant message, and the
agent loop dies without an error. Dispatch on part type instead. functionResponsecarries only a function name, never a call id, so the bridge synthesises ids
(call_<n>_<name>) and hands them back FIFO per name.
Response translation. OpenAI deltas become Gemini candidates; reasoning_content surfaces asthought: true parts; tool-call fragments are concatenated and emitted as a single functionCall
part with a placeholder thoughtSignature, which Gemini 3 era clients round-trip.
Limitations
- The IDE route is verified at protocol level; in-app behaviour depends on the Antigravity build.
- The IDE still requires Google sign-in, because onboarding and the catalog are proxied.
- Attachments are supported as inline images only; other media passes through untouched.
- Vendor-specific fields (safety settings, cached content, grounding) are ignored.
Documentation
Full guides live in docs/:
| Page | What it covers |
|---|---|
| Getting started | Install, first run, CLI and IDE wiring. |
| Configuration | Every environment variable, model mapping, key strategy. |
| Architecture | Package layout and request lifecycle. |
| Gemini v1beta protocol | The CLI surface, request and response shapes. |
| Cloud Code protocol | The IDE envelope, passthrough and the hidden setting. |
| Deployment | systemd, nginx, Docker, hardening checklist. |
| Troubleshooting | Symptom → cause → fix. |
| FAQ | Short answers to recurring questions. |
| Internals | Reverse-engineering notes from the binaries. |
Development
make test # unit tests
make vet # static checks
make build # ./bin/agy-bridge
make cross # linux/amd64, windows/amd64, darwin/arm64
See CONTRIBUTING.md for the project layout and review process.
License
MIT — see LICENSE.
Antigravity is a Google product. This project is unaffiliated with Google and ships no Google code.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found