Skip to content

Latest commit

 

History

History
145 lines (102 loc) · 3.58 KB

File metadata and controls

145 lines (102 loc) · 3.58 KB

Multi-Account Setup

Add multiple Google accounts to increase your combined quota. The plugin automatically rotates between accounts when one is rate-limited.

opencode auth login  # Run again to add more accounts

Load Balancing Behavior

  • Sticky account selection — Sticks to the same account until rate-limited (preserves Anthropic's prompt cache)
  • Per-model-family limits — Rate limits tracked separately for Claude and Gemini models
  • Dual quota pools for Gemini — Automatic fallback between Antigravity quota and Gemini CLI quota before switching accounts
  • Smart retry threshold — Short rate limits (≤5s) are retried on same account
  • Exponential backoff — Increasing delays for consecutive rate limits

Dual Quota Pools

For Gemini models, the plugin accesses two independent quota pools per account:

Quota Pool When Used
Antigravity Primary (tried first)
Gemini CLI Fallback when Antigravity is rate-limited

This effectively doubles your Gemini quota per account.

To enable automatic fallback between pools, set in antigravity.json:

{
  "quota_fallback": true
}

Adding Accounts

When running opencode auth login with existing accounts:

2 account(s) saved:
  1. user1@gmail.com
  2. user2@gmail.com

(a)dd new account(s) or (f)resh start? [a/f]:

Choose a to add more accounts while keeping existing ones.


Account Storage

Accounts are stored in ~/.config/opencode/antigravity-accounts.json:

{
  "version": 3,
  "accounts": [
    {
      "email": "user1@gmail.com",
      "refreshToken": "1//0abc...",
      "projectId": "my-gcp-project"
    },
    {
      "email": "user2@gmail.com",
      "refreshToken": "1//0xyz..."
    }
  ],
  "activeIndex": 0,
  "activeIndexByFamily": {
    "claude": 0,
    "gemini": 0
  }
}

⚠️ Security: This file contains OAuth refresh tokens. Treat it like a password file.

Fields

Field Description
email Google account email
refreshToken OAuth refresh token (auto-managed)
projectId Optional. Required for Gemini CLI models. See Troubleshooting.
activeIndex Currently active account index
activeIndexByFamily Per-model-family active account (claude/gemini tracked separately)

Token Revocation

If Google revokes a token (e.g., password change, security event), you'll see invalid_grant errors. The plugin automatically removes invalid accounts.

To manually reset:

rm ~/.config/opencode/antigravity-accounts.json
opencode auth login

Parallel Sessions (oh-my-opencode)

When using oh-my-opencode with parallel subagents, multiple processes may select the same account, causing rate limit errors.

Solution: Enable PID-based offset in antigravity.json:

{
  "pid_offset_enabled": true
}

This distributes sessions across accounts based on process ID.

Alternatively, add more accounts via opencode auth login.


Account Selection Strategies

Configure in antigravity.json:

{
  "account_selection_strategy": "hybrid"
}
Strategy Behavior Best For
sticky Same account until rate-limited Prompt cache preservation
round-robin Rotate to next account on every request Maximum throughput
hybrid Deterministic selection based on health score + token bucket + LRU Best overall distribution

See Configuration for more details.