Antigravity Unified Gateway API Overview
maincandidates[] structure.repository·main·Indexed 27 days ago
https://github.com/noefabris/opencode-antigravity-authAn authentication plugin for OpenCode that enables access to Google's Antigravity and Gemini CLI services via OAuth. It allows users to access high-tier models such as Claude 4.6 and Gemini 3.1 Pro, featuring multi-account rotation, automatic quota management, and support for both Antigravity and Gemini CLI quota pools.
candidates[] structure.The plugin intercepts requests to generativelanguage.googleapis.com and performs several transformations to make them compatible with the Antigravity API and Claude models:
thinkingConfig for supported thinking models.functionDeclarations[].const, $ref, $defs, default, examples, $schema, and title. Note that const: "value" is transformed into enum: ["value"].{ project, model, request: {...} }.Once your runner status shows as "Idle" (green) in your GitHub Repository settings, update your workflow file (e.g., .github/workflows/issue-triage.yml) to target the self-hosted runner.
Use the runs-on key to specify the runner. You can use a generic label or a specific label if you have multiple self-hosted runners.
runs-on: self-hosted
# or specifically:
# runs-on: [self-hosted, pi]OpenCode's variant system allows you to dynamically configure thinking budgets without needing separate model definitions for every level. When a model has variants defined in its configuration, you can select a specific variant using the --variant flag in the CLI. This passes the providerOptions to the plugin to set the thinking configuration.
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=maxWhen using oh-my-opencode, you must disable the built-in Google authentication to prevent conflicts. You should also override the agent models in your oh-my-opencode.json file.
Example configuration for ~/.config/opencode/oh-my-opencode.json:
{
"google_auth": false,
"agents": {
"frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3-pro" },
"document-writer": { "model": "google/antigravity-gemini-3-flash" }
}
}To install the plugin, add it to the plugin array in your OpenCode configuration file located at ~/.config/opencode/opencode.json. You can use the @latest tag for stable releases or @beta for bleeding-edge features.
After adding the plugin, run the login command to authenticate with your Google account:
opencode auth login{
"plugin": ["opencode-antigravity-auth@latest"]
}If you encounter authentication issues, the quickest fix is to delete the existing accounts file and re-authenticate using the CLI.
rm ~/.config/opencode/antigravity-accounts.json
opencode auth loginThe plugin includes regression tests that consume API quota. Use these commands to verify functionality:
--sanity: Runs 7 tests (approx. 5 min).--heavy: Runs 4 tests (approx. 30 min).--dry-run: Lists available tests without running them.npx tsx script/test-regression.ts --sanity # 7 tests, ~5 min
npx tsx script/test-regression.ts --heavy # 4 tests, ~30 min
npx tsx script/test-regression.ts --dry-run # List testsIf the OAuth process fails because the port is already in use, kill the process occupying port 51121.
### macOS/Linux
```bash
lsof -i :51121
kill -9 <PID>
opencode auth loginnetstat -ano | findstr :51121
taskkill /PID <PID> /F
opencode auth loginUse these pre-configured JSON objects based on your requirements:
1 Account (Preserve prompt cache):
{
"$schema": "https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/assets/antigravity.schema.json",
"account_selection_strategy": "sticky"
}2-3 Accounts (Smart rotation):
{
"$schema": "https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/assets/antigravity.schema.json",
"account_selection_strategy": "hybrid"
}3+ Accounts / Parallel Agents (Maximum throughput):
{
"$schema": "https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/assets/antigravity.schema.json",
"account_selection_strategy": "round-robin",
"switch_on_first_rate_limit": true,
"pid_offset_enabled": true
}After setting up the runner, you must authenticate tools like gh copilot and other AI utilities by running the auth-pi-tools.sh script (found in the scripts/ folder of this repository).
# On your Pi
chmod +x auth-pi-tools.sh
./auth-pi-tools.shFollow the interactive login flows to complete authentication.
chmod +x auth-pi-tools.sh
./auth-pi-tools.shGoogle enforces strict quotas. If you experience hanging prompts or 403 errors, follow these steps:
max_rate_limit_wait_seconds: 0 to avoid infinite retries.