MCPcopy Index your code
hub / github.com/NoeFabris/opencode-antigravity-auth

github.com/NoeFabris/opencode-antigravity-auth @v1.6.0 sqlite

repository ↗ · DeepWiki ↗ · release v1.6.0 ↗
827 symbols 2,207 edges 96 files 134 documented · 16%
README

Antigravity + Gemini CLI OAuth Plugin for Opencode

npm version npm beta npm downloads License: MIT X (Twitter)

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 claude-opus-4-6-thinking with your Google credentials.

What You Get

  • Claude Opus 4.6, Sonnet 4.6 and Gemini 3 Pro/Flash via Google OAuth
  • Multi-account support — add multiple Google accounts, auto-rotates when rate-limited
  • Dual quota system — access both Antigravity and Gemini CLI quotas from one plugin
  • Thinking models — extended thinking for Claude and Gemini 3 with configurable budgets
  • Google Search grounding — enable web search for Gemini models (auto or always-on)
  • Auto-recovery — handles session errors and tool failures automatically
  • Plugin compatible — works alongside other OpenCode plugins (oh-my-opencode, dcp, etc.)

⚠️ Terms of Service Warning — Read Before Installing

[!CAUTION] Using this plugin may violate Google's Terms of Service. A small number of users have reported their Google accounts being banned or shadow-banned (restricted access without explicit notification).

High-risk scenarios: - 🚨 Fresh Google accounts have a very high chance of getting banned - 🚨 New accounts with Pro/Ultra subscriptions are frequently flagged and banned

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

Recommendation: Use an established Google account that you don't rely on for critical services. Avoid creating new accounts specifically for this plugin.


Installation

For Humans

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.md

Option B: Manual setup

  1. Add the plugin to ~/.config/opencode/opencode.json:

json { "plugin": ["opencode-antigravity-auth@latest"] }

Want bleeding-edge features? Use opencode-antigravity-auth@beta instead.

  1. Login with your Google account:

bash opencode auth login

  1. Add models — choose one:
  2. Run opencode auth login → select "Configure models in opencode.json" (auto-configures all models)
  3. Or manually copy the full configuration below

  4. Use it:

bash opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max

For LLM Agents

Step-by-Step Instructions

  1. Edit 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).

  1. Add the plugin to the plugin array

  2. Add the model definitions from the Full models configuration section

  3. Set provider to "google" and choose a model

Verification

opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max

Models

Model Reference

Antigravity 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-flashgemini-3-flash-preview for CLI).

Using variants:

opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max

For 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:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-antigravity-auth@latest"],
  "provider": {
    "google": {
      "models": {
        "antigravity-gemini-3-pro": {
          "name": "Gemini 3 Pro (Antigravity)",
          "limit": { "context": 1048576, "output": 65535 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
          "variants": {
            "low": { "thinkingLevel": "low" },
            "high": { "thinkingLevel": "high" }
          }
        },
        "antigravity-gemini-3.1-pro": {
          "name": "Gemini 3.1 Pro (Antigravity)",
          "limit": { "context": 1048576, "output": 65535 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
          "variants": {
            "low": { "thinkingLevel": "low" },
            "high": { "thinkingLevel": "high" }
          }
        },
        "antigravity-gemini-3-flash": {
          "name": "Gemini 3 Flash (Antigravity)",
          "limit": { "context": 1048576, "output": 65536 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
          "variants": {
            "minimal": { "thinkingLevel": "minimal" },
            "low": { "thinkingLevel": "low" },
            "medium": { "thinkingLevel": "medium" },
            "high": { "thinkingLevel": "high" }
          }
        },
        "antigravity-claude-sonnet-4-6": {
          "name": "Claude Sonnet 4.6 (Antigravity)",
          "limit": { "context": 200000, "output": 64000 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
        },
        "antigravity-claude-opus-4-6-thinking": {
          "name": "Claude Opus 4.6 Thinking (Antigravity)",
          "limit": { "context": 200000, "output": 64000 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
          "variants": {
            "low": { "thinkingConfig": { "thinkingBudget": 8192 } },
            "max": { "thinkingConfig": { "thinkingBudget": 32768 } }
          }
        },
        "gemini-2.5-flash": {
          "name": "Gemini 2.5 Flash (Gemini CLI)",
          "limit": { "context": 1048576, "output": 65536 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
        },
        "gemini-2.5-pro": {
          "name": "Gemini 2.5 Pro (Gemini CLI)",
          "limit": { "context": 1048576, "output": 65536 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
        },
        "gemini-3-flash-preview": {
          "name": "Gemini 3 Flash Preview (Gemini CLI)",
          "limit": { "context": 1048576, "output": 65536 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
        },
        "gemini-3-pro-preview": {
          "name": "Gemini 3 Pro Preview (Gemini CLI)",
          "limit": { "context": 1048576, "output": 65535 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
        },
        "gemini-3.1-pro-preview": {
          "name": "Gemini 3.1 Pro Preview (Gemini CLI)",
          "limit": { "context": 1048576, "output": 65535 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
        },
        "gemini-3.1-pro-preview-customtools": {
          "name": "Gemini 3.1 Pro Preview Custom Tools (Gemini CLI)",
          "limit": { "context": 1048576, "output": 65535 },
          "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
        }
      }
    }
  }
}

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.


Multi-Account Setup

Add multiple Google accounts for higher combined quotas. The plugin automatically rotates between accounts when one is rate-limited.

opencode auth login  # Run again to add more accounts

Account management options (via opencode auth login): - Configure models — Auto-configure all plugin models in opencode.json - Check quotas — View remaining API quota for each account - Manage accounts — Enable/disable specific accounts for rotation

For details on load balancing, dual quota pools, and account storage, see docs/MULTI-ACCOUNT.md.


Troubleshoot

Quick Reset: Most issues can be resolved by deleting ~/.config/opencode/antigravity-accounts.json and running opencode auth login again.

Configuration Path (All Platforms)

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_DIR environment 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/.


Multi-Account Auth Issues

If you encounter authentication issues with multiple accounts:

  1. Delete the accounts file: bash rm ~/.config/opencode/antigravity-accounts.json
  2. Re-authenticate: bash opencode auth login

403 Permission Denied (rising-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: 1. Go to Google Cloud Console 2. Create or select a project 3. Enable the Gemini for Google Cloud API (cloudaicompanion.googleapis.com) 4. Add projectId to your accounts file: json { "accounts": [ { "email": "your@email.com", "refreshToken": "...", "projectId": "your-project-id" } ] }

Note: Do this for each account in a multi-account setup.


Gemini Model Not Found

Add this to your google provider config:

{
  "provider": {
    "google": {
      "npm": "@ai-sdk/google",
      "models": { ... }
    }
  }
}

Gemini 3 Models 400 Error ("Unknown name 'parameters'")

Error:

Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]'

Causes: - Tool schema incompatibility with Gemini's strict protobuf validation - MCP servers with malformed schemas - Plugin version regression

Solutions: 1. Update to latest beta: json { "plugin": ["opencode-antigravity-auth@beta"] }

  1. Disable MCP servers one-by-one to find the problematic one

  2. Add npm override: json { "provider": { "google": { "npm": "@ai-sdk/google" } } }


MCP Servers Causing Errors

Some MCP servers have schemas incompatible with Antigravity's strict JSON format.

Common symptom:

Invalid function name must start with a letter or underscore

Sometimes it shows up as:

GenerateContentRequest.tools[0].function_declarations[12].name: Invalid function name must start with a letter or underscore

This 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: 1. Disable all MCP servers in your config 2. Enable one-by-one until error

Extension points exported contracts — how you extend this code

RefreshQueueState (Interface)
State for tracking refresh operations
src/plugin/refresh-queue.ts
ModelTest (Interface)
(no doc)
script/test-models.ts
MultiTurnTest (Interface)
(no doc)
script/test-regression.ts
RateLimitBodyInfo (Interface)
(no doc)
src/plugin.ts
PkcePair (Interface)
(no doc)
src/shims.d.ts
PkcePair (Interface)
(no doc)
src/antigravity/oauth.ts
BunLockfile (Interface)
(no doc)
src/hooks/auto-update-checker/cache.ts
HealthScoreConfig (Interface)
(no doc)
src/plugin/rotation.ts

Core symbols most depended-on inside this repo

set
called by 88
src/plugin/core/streaming/types.ts
getCurrentOrNextForFamily
called by 85
src/plugin/accounts.ts
get
called by 71
src/plugin/core/streaming/types.ts
markRateLimited
called by 45
src/plugin/accounts.ts
toGeminiSchema
called by 43
src/plugin/transform/gemini.ts
prepareAntigravityRequest
called by 38
src/plugin/request.ts
debug
called by 38
src/plugin/logger.ts
pushDebug
called by 36
src/plugin.ts

Shape

Function 551
Interface 152
Method 108
Class 16

Languages

TypeScript100%

Modules by API surface

src/plugin.ts73 symbols
src/plugin/request-helpers.ts69 symbols
src/plugin/accounts.ts67 symbols
src/plugin/request.ts39 symbols
src/plugin/rotation.ts34 symbols
src/plugin/debug.ts32 symbols
src/plugin/storage.ts29 symbols
src/plugin/cache/signature-cache.ts24 symbols
src/plugin/recovery.ts21 symbols
src/plugin/quota.ts19 symbols
src/plugin/recovery/storage.ts17 symbols
src/plugin/transform/gemini.ts16 symbols

Dependencies from manifests, versioned

@opencode-ai/plugin0.15.30 · 1×
@types/node24.10.1 · 1×
@types/proper-lockfile4.1.4 · 1×
@vitest/coverage-v83.0.0 · 1×
@vitest/ui3.0.0 · 1×
proper-lockfile4.1.2 · 1×
typescript5.0.0 · 1×
vitest3.0.0 · 1×
xdg-basedir5.1.0 · 1×
zod4.0.0 · 1×
zod-to-json-schema3.25.1 · 1×

For agents

$ claude mcp add opencode-antigravity-auth \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact