Enable Opencode to authenticate against Antigravity (Google's IDE) via OAuth so you can use Antigravity rate limits and access models like gemini-3-pro and clau
Enable Opencode to authenticate against Antigravity (Google's IDE) via OAuth so you can use Antigravity rate limits and access models like gemini-3-pro and clau
Enable Opencode to authenticate against Antigravity (Google's IDE) via OAuth so you can use Antigravity rate limits and access models like gemini-3.1-pro and claude-opus-4-6-thinking with your Google credentials.
[!CAUTION] Using this plugin (and any proxy for Antigravity) violates Google's Terms of Service. A number of users have reported their Google accounts being banned or shadow-banned (restricted access without explicit notification).
By using this plugin, you acknowledge:
- This is an unofficial tool not endorsed by Google
- Your account may be suspended or permanently banned
- You assume all risks associated with using this plugin
Option A: Let an LLM do it
Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
Install the opencode-antigravity-auth plugin and add the Antigravity model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/dev/README.mdOption B: Manual setup
Add the plugin to ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-antigravity-auth@latest"]
}Want bleeding-edge features? Use
opencode-antigravity-auth@betainstead.
Login with your Google account:
opencode auth loginAdd models — choose one:
opencode auth login → Google → OAuth with Google (Antigravity) → select "Configure models in opencode.json" (auto-configures all models)Use it:
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=maxEdit the OpenCode configuration file at ~/.config/opencode/opencode.json
Note: This path works on all platforms. On Windows,
~resolves to your user home directory (e.g.,C:\Users\YourName).
Add the plugin to the plugin array
Add the model definitions from the Full models configuration section
Set provider to "google" and choose a model
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=maxAntigravity quota (default routing for Claude and Gemini):
| Model | Variants | Notes |
|---|---|---|
antigravity-gemini-3-pro |
low, high | Gemini 3 Pro with thinking |
antigravity-gemini-3.1-pro |
low, high | Gemini 3.1 Pro with thinking (rollout-dependent) |
antigravity-gemini-3-flash |
minimal, low, medium, high | Gemini 3 Flash with thinking |
antigravity-claude-sonnet-4-6 |
— | Claude Sonnet 4.6 |
antigravity-claude-opus-4-6-thinking |
low, max | Claude Opus 4.6 with extended thinking |
Gemini CLI quota (separate from Antigravity; used when cli_first is true or as fallback):
| Model | Notes |
|---|---|
gemini-2.5-flash |
Gemini 2.5 Flash |
gemini-2.5-pro |
Gemini 2.5 Pro |
gemini-3-flash-preview |
Gemini 3 Flash (preview) |
gemini-3-pro-preview |
Gemini 3 Pro (preview) |
gemini-3.1-pro-preview |
Gemini 3.1 Pro (preview, rollout-dependent) |
gemini-3.1-pro-preview-customtools |
Gemini 3.1 Pro Preview Custom Tools (preview, rollout-dependent) |
Routing Behavior:
- Antigravity-first (default): Gemini models use Antigravity quota across accounts.
- CLI-first (
cli_first: true): Gemini models use Gemini CLI quota first.- When a Gemini quota pool is exhausted, the plugin automatically falls back to the other pool.
- Claude and image models always use Antigravity. Model names are automatically transformed for the target API (e.g.,
antigravity-gemini-3-flash→gemini-3-flash-previewfor CLI).
Using variants:
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=maxFor details on variant configuration and thinking levels, see docs/MODEL-VARIANTS.md.
Full models configuration (copy-paste ready)Add this to your ~/.config/opencode/opencode.json:
…Backward Compatibility: Legacy model names with
antigravity-prefix (e.g.,antigravity-gemini-3-flash) still work. The plugin automatically handles model name transformation for both Antigravity and Gemini CLI APIs.
Add multiple Google accounts for a higher combined quota. The plugin automatically rotates between accounts when one is rate-limited.
opencode auth login # Run again to add more accountsAccount management options (via opencode auth login):
For details on load balancing, dual quota pools, and account storage, see docs/MULTI-ACCOUNT.md.
Quick Reset: Most issues can be resolved by deleting
~/.config/opencode/antigravity-accounts.jsonand runningopencode auth loginagain.
OpenCode uses ~/.config/opencode/ on all platforms including Windows.
| File | Path |
|---|---|
| Main config | ~/.config/opencode/opencode.json |
| Accounts | ~/.config/opencode/antigravity-accounts.json |
| Plugin config | ~/.config/opencode/antigravity.json |
| Debug logs | ~/.config/opencode/antigravity-logs/ |
Windows users:
~resolves to your user home directory (e.g.,C:\Users\YourName). Do NOT use%APPDATA%.
Custom path: Set
OPENCODE_CONFIG_DIRenvironment variable to use a custom location.
Windows migration: If upgrading from plugin v1.3.x or earlier, the plugin will automatically find your existing config in
%APPDATA%\opencode\and use it. New installations use~/.config/opencode/.
If you encounter authentication issues with multiple accounts:
rm ~/.config/opencode/antigravity-accounts.jsonopencode auth loginrising-fact-p41fc)Error:
Permission 'cloudaicompanion.companions.generateChat' denied on resource
'//cloudaicompanion.googleapis.com/projects/rising-fact-p41fc/locations/global'Cause: Plugin falls back to a default project ID when no valid project is found. This works for Antigravity but fails for Gemini CLI models.
Solution:
cloudaicompanion.googleapis.com)projectId to your accounts file:{
"accounts": [
{
"email": "[email protected]",
"refreshToken": "...",
"projectId": "your-project-id"
}
]
}Note: Do this for each account in a multi-account setup.
Add this to your google provider config:
{
"provider": {
"google": {
"npm": "@ai-sdk/google",
"models": { ... }
}
}
}Error:
Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]'Causes:
Solutions:
Update to latest beta:
{ "plugin": ["opencode-antigravity-auth@beta"] }Disable MCP servers one-by-one to find the problematic one
Add npm override:
{ "provider": { "google": { "npm": "@ai-sdk/google" } } }Some MCP servers have schemas incompatible with Antigravity's strict JSON format.
Common symptom:
Invalid function name must start with a letter or underscoreSometimes it shows up as:
GenerateContentRequest.tools[0].function_declarations[12].name: Invalid function name must start with a letter or underscoreThis usually means an MCP tool name starts with a number (for example, a 1mcp key like 1mcp_*). Rename the MCP key to start with a letter (e.g., gw) or disable that MCP entry for Antigravity models.
Diagnosis:
Cause: Cascade bug in clearExpiredRateLimits() in hybrid mode (fixed in recent beta).
Solutions:
account_selection_strategy to "sticky" in antigravity.jsonIf you encounter errors during a session:
continue to trigger the recovery mechanism/undo to revert to pre-error stateImportant: Disable the built-in Google auth to prevent conflicts:
// ~/.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" }
}
}.tmp Files CreatedCause: When account is rate-limited and plugin retries infinitely, it creates many temp files.
Workaround:
rm ~/.config/opencode/*.tmpSymptoms:
Cause: Safari's "HTTPS-Only Mode" blocks http://localhost callback.
Solutions:
Use Chrome or Firefox (easiest): Copy the OAuth URL and paste into a different browser.
Disable HTTPS-Only Mode temporarily:
opencode auth loginmacOS / Linux:
# Find process using the port
lsof -i :51121
# Kill if stale
kill -9 <PID>
# Retry
opencode auth loginWindows (PowerShell):
netstat -ano | findstr :51121
taskkill /PID <PID> /F
opencode auth loginOAuth callback requires browser to reach localhost on the machine running OpenCode.
WSL2:
No open issues yet, or sync has not completed.