opencode-ag-auth 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +749 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/src/antigravity/oauth.d.ts +31 -0
- package/dist/src/antigravity/oauth.d.ts.map +1 -0
- package/dist/src/antigravity/oauth.js +171 -0
- package/dist/src/antigravity/oauth.js.map +1 -0
- package/dist/src/constants.d.ts +138 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +220 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/cache.d.ts +3 -0
- package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/cache.js +71 -0
- package/dist/src/hooks/auto-update-checker/cache.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/checker.d.ts +16 -0
- package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/checker.js +237 -0
- package/dist/src/hooks/auto-update-checker/checker.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/constants.d.ts +9 -0
- package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/constants.js +23 -0
- package/dist/src/hooks/auto-update-checker/constants.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/index.d.ts +34 -0
- package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/index.js +125 -0
- package/dist/src/hooks/auto-update-checker/index.js.map +1 -0
- package/dist/src/hooks/auto-update-checker/types.d.ts +25 -0
- package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -0
- package/dist/src/hooks/auto-update-checker/types.js +1 -0
- package/dist/src/hooks/auto-update-checker/types.js.map +1 -0
- package/dist/src/plugin/accounts.d.ts +173 -0
- package/dist/src/plugin/accounts.d.ts.map +1 -0
- package/dist/src/plugin/accounts.js +1035 -0
- package/dist/src/plugin/accounts.js.map +1 -0
- package/dist/src/plugin/auth.d.ts +21 -0
- package/dist/src/plugin/auth.d.ts.map +1 -0
- package/dist/src/plugin/auth.js +46 -0
- package/dist/src/plugin/auth.js.map +1 -0
- package/dist/src/plugin/cache/index.d.ts +5 -0
- package/dist/src/plugin/cache/index.d.ts.map +1 -0
- package/dist/src/plugin/cache/index.js +5 -0
- package/dist/src/plugin/cache/index.js.map +1 -0
- package/dist/src/plugin/cache/signature-cache.d.ts +111 -0
- package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -0
- package/dist/src/plugin/cache/signature-cache.js +375 -0
- package/dist/src/plugin/cache/signature-cache.js.map +1 -0
- package/dist/src/plugin/cache.d.ts +44 -0
- package/dist/src/plugin/cache.d.ts.map +1 -0
- package/dist/src/plugin/cache.js +200 -0
- package/dist/src/plugin/cache.js.map +1 -0
- package/dist/src/plugin/cli.d.ts +27 -0
- package/dist/src/plugin/cli.d.ts.map +1 -0
- package/dist/src/plugin/cli.js +130 -0
- package/dist/src/plugin/cli.js.map +1 -0
- package/dist/src/plugin/config/index.d.ts +16 -0
- package/dist/src/plugin/config/index.d.ts.map +1 -0
- package/dist/src/plugin/config/index.js +16 -0
- package/dist/src/plugin/config/index.js.map +1 -0
- package/dist/src/plugin/config/loader.d.ts +37 -0
- package/dist/src/plugin/config/loader.d.ts.map +1 -0
- package/dist/src/plugin/config/loader.js +196 -0
- package/dist/src/plugin/config/loader.js.map +1 -0
- package/dist/src/plugin/config/models.d.ts +27 -0
- package/dist/src/plugin/config/models.d.ts.map +1 -0
- package/dist/src/plugin/config/models.js +70 -0
- package/dist/src/plugin/config/models.js.map +1 -0
- package/dist/src/plugin/config/schema.d.ts +133 -0
- package/dist/src/plugin/config/schema.d.ts.map +1 -0
- package/dist/src/plugin/config/schema.js +438 -0
- package/dist/src/plugin/config/schema.js.map +1 -0
- package/dist/src/plugin/config/updater.d.ts +55 -0
- package/dist/src/plugin/config/updater.d.ts.map +1 -0
- package/dist/src/plugin/config/updater.js +125 -0
- package/dist/src/plugin/config/updater.js.map +1 -0
- package/dist/src/plugin/core/streaming/index.d.ts +3 -0
- package/dist/src/plugin/core/streaming/index.d.ts.map +1 -0
- package/dist/src/plugin/core/streaming/index.js +3 -0
- package/dist/src/plugin/core/streaming/index.js.map +1 -0
- package/dist/src/plugin/core/streaming/transformer.d.ts +10 -0
- package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -0
- package/dist/src/plugin/core/streaming/transformer.js +271 -0
- package/dist/src/plugin/core/streaming/transformer.js.map +1 -0
- package/dist/src/plugin/core/streaming/types.d.ts +27 -0
- package/dist/src/plugin/core/streaming/types.d.ts.map +1 -0
- package/dist/src/plugin/core/streaming/types.js +1 -0
- package/dist/src/plugin/core/streaming/types.js.map +1 -0
- package/dist/src/plugin/debug.d.ts +94 -0
- package/dist/src/plugin/debug.d.ts.map +1 -0
- package/dist/src/plugin/debug.js +418 -0
- package/dist/src/plugin/debug.js.map +1 -0
- package/dist/src/plugin/errors.d.ts +28 -0
- package/dist/src/plugin/errors.d.ts.map +1 -0
- package/dist/src/plugin/errors.js +42 -0
- package/dist/src/plugin/errors.js.map +1 -0
- package/dist/src/plugin/fingerprint.d.ts +64 -0
- package/dist/src/plugin/fingerprint.d.ts.map +1 -0
- package/dist/src/plugin/fingerprint.js +125 -0
- package/dist/src/plugin/fingerprint.js.map +1 -0
- package/dist/src/plugin/image-saver.d.ts +25 -0
- package/dist/src/plugin/image-saver.d.ts.map +1 -0
- package/dist/src/plugin/image-saver.js +86 -0
- package/dist/src/plugin/image-saver.js.map +1 -0
- package/dist/src/plugin/logger.d.ts +54 -0
- package/dist/src/plugin/logger.d.ts.map +1 -0
- package/dist/src/plugin/logger.js +120 -0
- package/dist/src/plugin/logger.js.map +1 -0
- package/dist/src/plugin/project.d.ts +33 -0
- package/dist/src/plugin/project.d.ts.map +1 -0
- package/dist/src/plugin/project.js +234 -0
- package/dist/src/plugin/project.js.map +1 -0
- package/dist/src/plugin/proxy.d.ts +2 -0
- package/dist/src/plugin/proxy.d.ts.map +1 -0
- package/dist/src/plugin/proxy.js +20 -0
- package/dist/src/plugin/proxy.js.map +1 -0
- package/dist/src/plugin/quota.d.ts +35 -0
- package/dist/src/plugin/quota.d.ts.map +1 -0
- package/dist/src/plugin/quota.js +273 -0
- package/dist/src/plugin/quota.js.map +1 -0
- package/dist/src/plugin/recovery/constants.d.ts +22 -0
- package/dist/src/plugin/recovery/constants.d.ts.map +1 -0
- package/dist/src/plugin/recovery/constants.js +43 -0
- package/dist/src/plugin/recovery/constants.js.map +1 -0
- package/dist/src/plugin/recovery/index.d.ts +12 -0
- package/dist/src/plugin/recovery/index.d.ts.map +1 -0
- package/dist/src/plugin/recovery/index.js +12 -0
- package/dist/src/plugin/recovery/index.js.map +1 -0
- package/dist/src/plugin/recovery/storage.d.ts +24 -0
- package/dist/src/plugin/recovery/storage.d.ts.map +1 -0
- package/dist/src/plugin/recovery/storage.js +354 -0
- package/dist/src/plugin/recovery/storage.js.map +1 -0
- package/dist/src/plugin/recovery/types.d.ts +116 -0
- package/dist/src/plugin/recovery/types.d.ts.map +1 -0
- package/dist/src/plugin/recovery/types.js +6 -0
- package/dist/src/plugin/recovery/types.js.map +1 -0
- package/dist/src/plugin/recovery.d.ts +61 -0
- package/dist/src/plugin/recovery.d.ts.map +1 -0
- package/dist/src/plugin/recovery.js +378 -0
- package/dist/src/plugin/recovery.js.map +1 -0
- package/dist/src/plugin/refresh-queue.d.ts +101 -0
- package/dist/src/plugin/refresh-queue.d.ts.map +1 -0
- package/dist/src/plugin/refresh-queue.js +248 -0
- package/dist/src/plugin/refresh-queue.js.map +1 -0
- package/dist/src/plugin/request-helpers.d.ts +282 -0
- package/dist/src/plugin/request-helpers.d.ts.map +1 -0
- package/dist/src/plugin/request-helpers.js +2319 -0
- package/dist/src/plugin/request-helpers.js.map +1 -0
- package/dist/src/plugin/request.d.ts +93 -0
- package/dist/src/plugin/request.d.ts.map +1 -0
- package/dist/src/plugin/request.js +1352 -0
- package/dist/src/plugin/request.js.map +1 -0
- package/dist/src/plugin/rotation.d.ts +169 -0
- package/dist/src/plugin/rotation.d.ts.map +1 -0
- package/dist/src/plugin/rotation.js +328 -0
- package/dist/src/plugin/rotation.js.map +1 -0
- package/dist/src/plugin/search.d.ts +32 -0
- package/dist/src/plugin/search.d.ts.map +1 -0
- package/dist/src/plugin/search.js +195 -0
- package/dist/src/plugin/search.js.map +1 -0
- package/dist/src/plugin/server.d.ts +23 -0
- package/dist/src/plugin/server.d.ts.map +1 -0
- package/dist/src/plugin/server.js +324 -0
- package/dist/src/plugin/server.js.map +1 -0
- package/dist/src/plugin/storage.d.ts +136 -0
- package/dist/src/plugin/storage.d.ts.map +1 -0
- package/dist/src/plugin/storage.js +588 -0
- package/dist/src/plugin/storage.js.map +1 -0
- package/dist/src/plugin/stores/signature-store.d.ts +5 -0
- package/dist/src/plugin/stores/signature-store.d.ts.map +1 -0
- package/dist/src/plugin/stores/signature-store.js +25 -0
- package/dist/src/plugin/stores/signature-store.js.map +1 -0
- package/dist/src/plugin/thinking-recovery.d.ts +90 -0
- package/dist/src/plugin/thinking-recovery.d.ts.map +1 -0
- package/dist/src/plugin/thinking-recovery.js +316 -0
- package/dist/src/plugin/thinking-recovery.js.map +1 -0
- package/dist/src/plugin/token.d.ts +19 -0
- package/dist/src/plugin/token.d.ts.map +1 -0
- package/dist/src/plugin/token.js +128 -0
- package/dist/src/plugin/token.js.map +1 -0
- package/dist/src/plugin/transform/claude.d.ts +80 -0
- package/dist/src/plugin/transform/claude.d.ts.map +1 -0
- package/dist/src/plugin/transform/claude.js +265 -0
- package/dist/src/plugin/transform/claude.js.map +1 -0
- package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +35 -0
- package/dist/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
- package/dist/src/plugin/transform/cross-model-sanitizer.js +225 -0
- package/dist/src/plugin/transform/cross-model-sanitizer.js.map +1 -0
- package/dist/src/plugin/transform/gemini.d.ts +100 -0
- package/dist/src/plugin/transform/gemini.d.ts.map +1 -0
- package/dist/src/plugin/transform/gemini.js +465 -0
- package/dist/src/plugin/transform/gemini.js.map +1 -0
- package/dist/src/plugin/transform/index.d.ts +15 -0
- package/dist/src/plugin/transform/index.d.ts.map +1 -0
- package/dist/src/plugin/transform/index.js +14 -0
- package/dist/src/plugin/transform/index.js.map +1 -0
- package/dist/src/plugin/transform/model-resolver.d.ts +104 -0
- package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -0
- package/dist/src/plugin/transform/model-resolver.js +361 -0
- package/dist/src/plugin/transform/model-resolver.js.map +1 -0
- package/dist/src/plugin/transform/types.d.ts +111 -0
- package/dist/src/plugin/transform/types.d.ts.map +1 -0
- package/dist/src/plugin/transform/types.js +1 -0
- package/dist/src/plugin/transform/types.js.map +1 -0
- package/dist/src/plugin/types.d.ts +97 -0
- package/dist/src/plugin/types.d.ts.map +1 -0
- package/dist/src/plugin/types.js +1 -0
- package/dist/src/plugin/types.js.map +1 -0
- package/dist/src/plugin/ui/ansi.d.ts +32 -0
- package/dist/src/plugin/ui/ansi.d.ts.map +1 -0
- package/dist/src/plugin/ui/ansi.js +52 -0
- package/dist/src/plugin/ui/ansi.js.map +1 -0
- package/dist/src/plugin/ui/auth-menu.d.ts +33 -0
- package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -0
- package/dist/src/plugin/ui/auth-menu.js +110 -0
- package/dist/src/plugin/ui/auth-menu.js.map +1 -0
- package/dist/src/plugin/ui/confirm.d.ts +2 -0
- package/dist/src/plugin/ui/confirm.d.ts.map +1 -0
- package/dist/src/plugin/ui/confirm.js +15 -0
- package/dist/src/plugin/ui/confirm.js.map +1 -0
- package/dist/src/plugin/ui/select.d.ts +23 -0
- package/dist/src/plugin/ui/select.d.ts.map +1 -0
- package/dist/src/plugin/ui/select.js +254 -0
- package/dist/src/plugin/ui/select.js.map +1 -0
- package/dist/src/plugin/version.d.ts +19 -0
- package/dist/src/plugin/version.d.ts.map +1 -0
- package/dist/src/plugin/version.js +80 -0
- package/dist/src/plugin/version.js.map +1 -0
- package/dist/src/plugin.d.ts +30 -0
- package/dist/src/plugin.d.ts.map +1 -0
- package/dist/src/plugin.js +3050 -0
- package/dist/src/plugin.js.map +1 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
# OpenCode AG Auth (Antigravity Guard)
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/opencode-ag-auth)
|
|
4
|
+
[](https://www.npmjs.com/package/opencode-ag-auth)
|
|
5
|
+
[](https://www.npmjs.com/package/opencode-ag-auth)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://x.com/dopesalmon)
|
|
8
|
+
|
|
9
|
+
**The Hardened, Safety-First Antigravity Plugin for OpenCode.**
|
|
10
|
+
|
|
11
|
+
Enable OpenCode to authenticate against **Antigravity** (Google's IDE) with enterprise-grade **account protection** and **session stability**. Access models like `gemini-3-pro` and `claude-opus-4-6-thinking` while keeping your accounts safe from bans and your agents running without interruption.
|
|
12
|
+
|
|
13
|
+
## Why this Fork?
|
|
14
|
+
|
|
15
|
+
This is a specialized fork of `opencode-antigravity-auth` focused on **Safety** and **Reliability** for power users and autonomous agents.
|
|
16
|
+
|
|
17
|
+
### 🛡️ Enhanced Protection
|
|
18
|
+
- **Strict Quota Protocol (SQP)**: Enforces a **70% safety buffer** on API usage. Accounts are strictly locked *before* they hit Google's abuse limits.
|
|
19
|
+
- **Leak-Proof Locking**: Locked accounts are ignored until their specific reset time passes, preventing "leaky" usage from cache expiry.
|
|
20
|
+
|
|
21
|
+
### ⚡ Agent Stability
|
|
22
|
+
- **Oh-My-OpenCode Integration**: Native support for session recovery. Automatically handles tool crashes and model "thinking" blocks without user intervention.
|
|
23
|
+
- **Smart Proxy Support**: Enterprise-ready `undici` proxy support for complex network environments.
|
|
24
|
+
- **Interactive Pause**: Gracefully pauses execution when quotas run low, allowing human intervention instead of crashing.
|
|
25
|
+
|
|
26
|
+
## Key Features
|
|
27
|
+
|
|
28
|
+
- **All Antigravity Models**: Claude Opus 4.6, Sonnet 4.5, and Gemini 3 Pro/Flash via Google OAuth.
|
|
29
|
+
- **Thinking Models**: Configurable thinking budgets for complex reasoning tasks.
|
|
30
|
+
- **Multi-Account Rotation**: Add unlimited Google accounts; the plugin auto-rotates based on health and quota.
|
|
31
|
+
- **Dual Quota Pools**: Intelligently routes between Antigravity and Gemini CLI quotas.
|
|
32
|
+
- **Google Search Grounding**: Enable real-time web search for Gemini models.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
<details open>
|
|
37
|
+
<summary><b>⚠️ Terms of Service Warning — Read Before Installing</b></summary>
|
|
38
|
+
|
|
39
|
+
> [!CAUTION]
|
|
40
|
+
> 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).
|
|
41
|
+
>
|
|
42
|
+
> **High-risk scenarios:**
|
|
43
|
+
> - 🚨 **Fresh Google accounts** have a very high chance of getting banned
|
|
44
|
+
> - 🚨 **New accounts with Pro/Ultra subscriptions** are frequently flagged and banned
|
|
45
|
+
>
|
|
46
|
+
> **By using this plugin, you acknowledge:**
|
|
47
|
+
> - This is an unofficial tool not endorsed by Google
|
|
48
|
+
> - Your account may be suspended or permanently banned
|
|
49
|
+
> - You assume all risks associated with using this plugin
|
|
50
|
+
>
|
|
51
|
+
> **Recommendation:** Use an established Google account that you don't rely on for critical services. Avoid creating new accounts specifically for this plugin.
|
|
52
|
+
|
|
53
|
+
</details>
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
<details open>
|
|
60
|
+
<summary><b>For Humans</b></summary>
|
|
61
|
+
|
|
62
|
+
**Option A: Let an LLM do it**
|
|
63
|
+
|
|
64
|
+
Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Install the opencode-ag-auth plugin and add the Antigravity model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/andyvandaric/opencode-ag-auth/main/README.md
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Option B: Manual setup**
|
|
71
|
+
|
|
72
|
+
1. **Add the plugin** to `~/.config/opencode/opencode.json`:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"plugin": ["opencode-ag-auth@latest"]
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
> Want bleeding-edge features? Use `opencode-ag-auth@beta` instead.
|
|
81
|
+
|
|
82
|
+
2. **Login** with your Google account:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
opencode auth login
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
3. **Add models** — choose one:
|
|
89
|
+
- Run `opencode auth login` → select **"Configure models in opencode.json"** (auto-configures all models)
|
|
90
|
+
- Or manually copy the [full configuration](#models) below
|
|
91
|
+
|
|
92
|
+
4. **Use it:**
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5-thinking --variant=max
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
</details>
|
|
99
|
+
|
|
100
|
+
<details>
|
|
101
|
+
<summary><b>For LLM Agents</b></summary>
|
|
102
|
+
|
|
103
|
+
### Step-by-Step Instructions
|
|
104
|
+
|
|
105
|
+
1. Edit the OpenCode configuration file at `~/.config/opencode/opencode.json`
|
|
106
|
+
|
|
107
|
+
> **Note**: This path works on all platforms. On Windows, `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
|
|
108
|
+
|
|
109
|
+
2. Add the plugin to the `plugin` array
|
|
110
|
+
|
|
111
|
+
3. Add the model definitions from the [Full models configuration](#models) section
|
|
112
|
+
|
|
113
|
+
4. Set `provider` to `"google"` and choose a model
|
|
114
|
+
|
|
115
|
+
### Verification
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5-thinking --variant=max
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
</details>
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Models
|
|
126
|
+
|
|
127
|
+
### Model Reference
|
|
128
|
+
|
|
129
|
+
**Antigravity quota** (default routing for Claude and Gemini):
|
|
130
|
+
|
|
131
|
+
| Model | Variants | Notes |
|
|
132
|
+
|-------|----------|-------|
|
|
133
|
+
| `antigravity-gemini-3-pro` | low, high | Gemini 3 Pro with thinking |
|
|
134
|
+
| `antigravity-gemini-3-flash` | minimal, low, medium, high | Gemini 3 Flash with thinking |
|
|
135
|
+
| `antigravity-claude-sonnet-4-5` | — | Claude Sonnet 4.5 |
|
|
136
|
+
| `antigravity-claude-sonnet-4-5-thinking` | low, max | Claude Sonnet with extended thinking |
|
|
137
|
+
|
|
138
|
+
| `antigravity-claude-opus-4-6-thinking` | low, max | Claude Opus 4.6 with extended thinking |
|
|
139
|
+
|
|
140
|
+
**Gemini CLI quota** (separate from Antigravity; used when `cli_first` is true or as fallback):
|
|
141
|
+
|
|
142
|
+
| Model | Notes |
|
|
143
|
+
|-------|-------|
|
|
144
|
+
| `gemini-2.5-flash` | Gemini 2.5 Flash |
|
|
145
|
+
| `gemini-2.5-pro` | Gemini 2.5 Pro |
|
|
146
|
+
| `gemini-3-flash-preview` | Gemini 3 Flash (preview) |
|
|
147
|
+
| `gemini-3-pro-preview` | Gemini 3 Pro (preview) |
|
|
148
|
+
|
|
149
|
+
> **Routing Behavior:**
|
|
150
|
+
> - **Antigravity-first (default):** Gemini models use Antigravity quota across accounts.
|
|
151
|
+
> - **CLI-first (`cli_first: true`):** Gemini models use Gemini CLI quota first.
|
|
152
|
+
> - When a Gemini quota pool is exhausted, the plugin automatically falls back to the other pool.
|
|
153
|
+
> - Claude and image models always use Antigravity.
|
|
154
|
+
> Model names are automatically transformed for the target API (e.g., `antigravity-gemini-3-flash` → `gemini-3-flash-preview` for CLI).
|
|
155
|
+
|
|
156
|
+
**Using variants:**
|
|
157
|
+
```bash
|
|
158
|
+
opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5-thinking --variant=max
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
For details on variant configuration and thinking levels, see [docs/MODEL-VARIANTS.md](docs/MODEL-VARIANTS.md).
|
|
162
|
+
|
|
163
|
+
<details>
|
|
164
|
+
<summary><b>Full models configuration (copy-paste ready)</b></summary>
|
|
165
|
+
|
|
166
|
+
Add this to your `~/.config/opencode/opencode.json`:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"$schema": "https://opencode.ai/config.json",
|
|
171
|
+
"plugin": ["opencode-ag-auth@latest"],
|
|
172
|
+
"provider": {
|
|
173
|
+
"google": {
|
|
174
|
+
"models": {
|
|
175
|
+
"antigravity-gemini-3-pro": {
|
|
176
|
+
"name": "Gemini 3 Pro (Antigravity)",
|
|
177
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
178
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
179
|
+
"variants": {
|
|
180
|
+
"low": { "thinkingLevel": "low" },
|
|
181
|
+
"high": { "thinkingLevel": "high" }
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"antigravity-gemini-3-flash": {
|
|
185
|
+
"name": "Gemini 3 Flash (Antigravity)",
|
|
186
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
187
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
188
|
+
"variants": {
|
|
189
|
+
"minimal": { "thinkingLevel": "minimal" },
|
|
190
|
+
"low": { "thinkingLevel": "low" },
|
|
191
|
+
"medium": { "thinkingLevel": "medium" },
|
|
192
|
+
"high": { "thinkingLevel": "high" }
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"antigravity-claude-sonnet-4-5": {
|
|
196
|
+
"name": "Claude Sonnet 4.5 (Antigravity)",
|
|
197
|
+
"limit": { "context": 200000, "output": 64000 },
|
|
198
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
199
|
+
},
|
|
200
|
+
"antigravity-claude-sonnet-4-5-thinking": {
|
|
201
|
+
"name": "Claude Sonnet 4.5 Thinking (Antigravity)",
|
|
202
|
+
"limit": { "context": 200000, "output": 64000 },
|
|
203
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
204
|
+
"variants": {
|
|
205
|
+
"low": { "thinkingConfig": { "thinkingBudget": 8192 } },
|
|
206
|
+
"max": { "thinkingConfig": { "thinkingBudget": 32768 } }
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
"antigravity-claude-opus-4-6-thinking": {
|
|
211
|
+
"name": "Claude Opus 4.6 Thinking (Antigravity)",
|
|
212
|
+
"limit": { "context": 200000, "output": 64000 },
|
|
213
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
214
|
+
"variants": {
|
|
215
|
+
"low": { "thinkingConfig": { "thinkingBudget": 8192 } },
|
|
216
|
+
"max": { "thinkingConfig": { "thinkingBudget": 32768 } }
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
"gemini-2.5-flash": {
|
|
220
|
+
"name": "Gemini 2.5 Flash (Gemini CLI)",
|
|
221
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
222
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
223
|
+
},
|
|
224
|
+
"gemini-2.5-pro": {
|
|
225
|
+
"name": "Gemini 2.5 Pro (Gemini CLI)",
|
|
226
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
227
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
228
|
+
},
|
|
229
|
+
"gemini-3-flash-preview": {
|
|
230
|
+
"name": "Gemini 3 Flash Preview (Gemini CLI)",
|
|
231
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
232
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
233
|
+
},
|
|
234
|
+
"gemini-3-pro-preview": {
|
|
235
|
+
"name": "Gemini 3 Pro Preview (Gemini CLI)",
|
|
236
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
237
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
> **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.
|
|
246
|
+
|
|
247
|
+
</details>
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Multi-Account Setup
|
|
252
|
+
|
|
253
|
+
Add multiple Google accounts for higher combined quotas. The plugin automatically rotates between accounts when one is rate-limited.
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
opencode auth login # Run again to add more accounts
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Account management options (via `opencode auth login`):**
|
|
260
|
+
- **Configure models** — Auto-configure all plugin models in opencode.json
|
|
261
|
+
- **Check quotas** — View remaining API quota for each account
|
|
262
|
+
- **Manage accounts** — Enable/disable specific accounts for rotation
|
|
263
|
+
|
|
264
|
+
For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Troubleshoot
|
|
269
|
+
|
|
270
|
+
> **Quick Reset**: Most issues can be resolved by deleting `~/.config/opencode/antigravity-accounts.json` and running `opencode auth login` again.
|
|
271
|
+
|
|
272
|
+
### Configuration Path (All Platforms)
|
|
273
|
+
|
|
274
|
+
OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
|
|
275
|
+
|
|
276
|
+
| File | Path |
|
|
277
|
+
|------|------|
|
|
278
|
+
| Main config | `~/.config/opencode/opencode.json` |
|
|
279
|
+
| Accounts | `~/.config/opencode/antigravity-accounts.json` |
|
|
280
|
+
| Plugin config | `~/.config/opencode/antigravity.json` |
|
|
281
|
+
| Debug logs | `~/.config/opencode/antigravity-logs/` |
|
|
282
|
+
|
|
283
|
+
> **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`). Do NOT use `%APPDATA%`.
|
|
284
|
+
|
|
285
|
+
> **Custom path**: Set `OPENCODE_CONFIG_DIR` environment variable to use a custom location.
|
|
286
|
+
|
|
287
|
+
> **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/`.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
### Multi-Account Auth Issues
|
|
292
|
+
|
|
293
|
+
If you encounter authentication issues with multiple accounts:
|
|
294
|
+
|
|
295
|
+
1. Delete the accounts file:
|
|
296
|
+
```bash
|
|
297
|
+
rm ~/.config/opencode/antigravity-accounts.json
|
|
298
|
+
```
|
|
299
|
+
2. Re-authenticate:
|
|
300
|
+
```bash
|
|
301
|
+
opencode auth login
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### 403 Permission Denied (`rising-fact-p41fc`)
|
|
307
|
+
|
|
308
|
+
**Error:**
|
|
309
|
+
```
|
|
310
|
+
Permission 'cloudaicompanion.companions.generateChat' denied on resource
|
|
311
|
+
'//cloudaicompanion.googleapis.com/projects/rising-fact-p41fc/locations/global'
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**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.
|
|
315
|
+
|
|
316
|
+
**Solution:**
|
|
317
|
+
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
|
|
318
|
+
2. Create or select a project
|
|
319
|
+
3. Enable the **Gemini for Google Cloud API** (`cloudaicompanion.googleapis.com`)
|
|
320
|
+
4. Add `projectId` to your accounts file:
|
|
321
|
+
```json
|
|
322
|
+
{
|
|
323
|
+
"accounts": [
|
|
324
|
+
{
|
|
325
|
+
"email": "your@email.com",
|
|
326
|
+
"refreshToken": "...",
|
|
327
|
+
"projectId": "your-project-id"
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
> **Note**: Do this for each account in a multi-account setup.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
### Gemini Model Not Found
|
|
338
|
+
|
|
339
|
+
Add this to your `google` provider config:
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"provider": {
|
|
344
|
+
"google": {
|
|
345
|
+
"npm": "@ai-sdk/google",
|
|
346
|
+
"models": { ... }
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
### Gemini 3 Models 400 Error ("Unknown name 'parameters'")
|
|
355
|
+
|
|
356
|
+
**Error:**
|
|
357
|
+
```
|
|
358
|
+
Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]'
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Causes:**
|
|
362
|
+
- Tool schema incompatibility with Gemini's strict protobuf validation
|
|
363
|
+
- MCP servers with malformed schemas
|
|
364
|
+
- Plugin version regression
|
|
365
|
+
|
|
366
|
+
**Solutions:**
|
|
367
|
+
1. **Update to latest beta:**
|
|
368
|
+
```json
|
|
369
|
+
{ "plugin": ["opencode-ag-auth@beta"] }
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
2. **Disable MCP servers** one-by-one to find the problematic one
|
|
373
|
+
|
|
374
|
+
3. **Add npm override:**
|
|
375
|
+
```json
|
|
376
|
+
{ "provider": { "google": { "npm": "@ai-sdk/google" } } }
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
### MCP Servers Causing Errors
|
|
382
|
+
|
|
383
|
+
Some MCP servers have schemas incompatible with Antigravity's strict JSON format.
|
|
384
|
+
|
|
385
|
+
**Common symptom:**
|
|
386
|
+
```bash
|
|
387
|
+
Invalid function name must start with a letter or underscore
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Sometimes it shows up as:
|
|
391
|
+
```bash
|
|
392
|
+
GenerateContentRequest.tools[0].function_declarations[12].name: Invalid function name must start with a letter or underscore
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
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.
|
|
396
|
+
|
|
397
|
+
**Diagnosis:**
|
|
398
|
+
1. Disable all MCP servers in your config
|
|
399
|
+
2. Enable one-by-one until error reappears
|
|
400
|
+
3. Report the specific MCP in a [GitHub issue](https://github.com/andyvandaric/opencode-ag-auth/issues)
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
### "All Accounts Rate-Limited" (But Quota Available)
|
|
405
|
+
|
|
406
|
+
**Cause:** Cascade bug in `clearExpiredRateLimits()` in hybrid mode (fixed in recent beta).
|
|
407
|
+
|
|
408
|
+
**Solutions:**
|
|
409
|
+
1. Update to latest beta version
|
|
410
|
+
2. If persists, delete accounts file and re-authenticate
|
|
411
|
+
3. Try switching `account_selection_strategy` to `"sticky"` in `antigravity.json`
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
### Session Recovery
|
|
416
|
+
|
|
417
|
+
If you encounter errors during a session:
|
|
418
|
+
1. Type `continue` to trigger the recovery mechanism
|
|
419
|
+
2. If blocked, use `/undo` to revert to pre-error state
|
|
420
|
+
3. Retry the operation
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
### Using with Oh-My-OpenCode
|
|
425
|
+
|
|
426
|
+
**Important:** Disable the built-in Google auth to prevent conflicts:
|
|
427
|
+
|
|
428
|
+
```json
|
|
429
|
+
// ~/.config/opencode/oh-my-opencode.json
|
|
430
|
+
{
|
|
431
|
+
"google_auth": false,
|
|
432
|
+
"agents": {
|
|
433
|
+
"frontend-ui-ux-engineer": { "model": "google/gemini-3-pro" },
|
|
434
|
+
"document-writer": { "model": "google/gemini-3-flash" },
|
|
435
|
+
"multimodal-looker": { "model": "google/gemini-3-flash" }
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
### Infinite `.tmp` Files Created
|
|
443
|
+
|
|
444
|
+
**Cause:** When account is rate-limited and plugin retries infinitely, it creates many temp files.
|
|
445
|
+
|
|
446
|
+
**Workaround:**
|
|
447
|
+
1. Stop OpenCode
|
|
448
|
+
2. Clean up: `rm ~/.config/opencode/*.tmp`
|
|
449
|
+
3. Add more accounts or wait for rate limit to expire
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
### OAuth Callback Issues
|
|
454
|
+
|
|
455
|
+
<details>
|
|
456
|
+
<summary><b>Safari OAuth Callback Fails (macOS)</b></summary>
|
|
457
|
+
|
|
458
|
+
**Symptoms:**
|
|
459
|
+
- "fail to authorize" after successful Google login
|
|
460
|
+
- Safari shows "Safari can't open the page"
|
|
461
|
+
|
|
462
|
+
**Cause:** Safari's "HTTPS-Only Mode" blocks `http://localhost` callback.
|
|
463
|
+
|
|
464
|
+
**Solutions:**
|
|
465
|
+
|
|
466
|
+
1. **Use Chrome or Firefox** (easiest):
|
|
467
|
+
Copy the OAuth URL and paste into a different browser.
|
|
468
|
+
|
|
469
|
+
2. **Disable HTTPS-Only Mode temporarily:**
|
|
470
|
+
- Safari > Settings (⌘,) > Privacy
|
|
471
|
+
- Uncheck "Enable HTTPS-Only Mode"
|
|
472
|
+
- Run `opencode auth login`
|
|
473
|
+
- Re-enable after authentication
|
|
474
|
+
|
|
475
|
+
</details>
|
|
476
|
+
|
|
477
|
+
<details>
|
|
478
|
+
<summary><b>Port Conflict (Address Already in Use)</b></summary>
|
|
479
|
+
|
|
480
|
+
**macOS / Linux:**
|
|
481
|
+
```bash
|
|
482
|
+
# Find process using the port
|
|
483
|
+
lsof -i :51121
|
|
484
|
+
|
|
485
|
+
# Kill if stale
|
|
486
|
+
kill -9 <PID>
|
|
487
|
+
|
|
488
|
+
# Retry
|
|
489
|
+
opencode auth login
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
**Windows (PowerShell):**
|
|
493
|
+
```powershell
|
|
494
|
+
netstat -ano | findstr :51121
|
|
495
|
+
taskkill /PID <PID> /F
|
|
496
|
+
opencode auth login
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
</details>
|
|
500
|
+
|
|
501
|
+
<details>
|
|
502
|
+
<summary><b>Docker / WSL2 / Remote Development</b></summary>
|
|
503
|
+
|
|
504
|
+
OAuth callback requires browser to reach `localhost` on the machine running OpenCode.
|
|
505
|
+
|
|
506
|
+
**WSL2:**
|
|
507
|
+
- Use VS Code's port forwarding, or
|
|
508
|
+
- Configure Windows → WSL port forwarding
|
|
509
|
+
|
|
510
|
+
**SSH / Remote:**
|
|
511
|
+
```bash
|
|
512
|
+
ssh -L 51121:localhost:51121 user@remote
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
**Docker / Containers:**
|
|
516
|
+
- OAuth with localhost redirect doesn't work in containers
|
|
517
|
+
- Wait 30s for manual URL flow, or use SSH port forwarding
|
|
518
|
+
|
|
519
|
+
</details>
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
### Configuration Key Typo: `plugin` not `plugins`
|
|
524
|
+
|
|
525
|
+
The correct key is `plugin` (singular):
|
|
526
|
+
|
|
527
|
+
```json
|
|
528
|
+
{
|
|
529
|
+
"plugin": ["opencode-ag-auth@beta"]
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
**Not** `"plugins"` (will cause "Unrecognized key" error).
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
### Migrating Accounts Between Machines
|
|
538
|
+
|
|
539
|
+
When copying `antigravity-accounts.json` to a new machine:
|
|
540
|
+
1. Ensure the plugin is installed: `"plugin": ["opencode-ag-auth@beta"]`
|
|
541
|
+
2. Copy `~/.config/opencode/antigravity-accounts.json`
|
|
542
|
+
3. If you get "API key missing" error, the refresh token may be invalid — re-authenticate
|
|
543
|
+
|
|
544
|
+
## Known Plugin Interactions
|
|
545
|
+
For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
## Plugin Compatibility
|
|
550
|
+
|
|
551
|
+
### @tarquinen/opencode-dcp
|
|
552
|
+
|
|
553
|
+
DCP creates synthetic assistant messages that lack thinking blocks. **List this plugin BEFORE DCP:**
|
|
554
|
+
|
|
555
|
+
```json
|
|
556
|
+
{
|
|
557
|
+
"plugin": [
|
|
558
|
+
"opencode-ag-auth@latest",
|
|
559
|
+
"@tarquinen/opencode-dcp@latest"
|
|
560
|
+
]
|
|
561
|
+
}
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
### oh-my-opencode
|
|
565
|
+
|
|
566
|
+
Disable built-in auth and override agent models in `oh-my-opencode.json`:
|
|
567
|
+
|
|
568
|
+
```json
|
|
569
|
+
{
|
|
570
|
+
"google_auth": false,
|
|
571
|
+
"agents": {
|
|
572
|
+
"frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3-pro" },
|
|
573
|
+
"document-writer": { "model": "google/antigravity-gemini-3-flash" },
|
|
574
|
+
"multimodal-looker": { "model": "google/antigravity-gemini-3-flash" }
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
> **Tip:** When spawning parallel subagents, enable `pid_offset_enabled: true` in `antigravity.json` to distribute sessions across accounts.
|
|
580
|
+
|
|
581
|
+
### Plugins you don't need
|
|
582
|
+
|
|
583
|
+
- **gemini-auth plugins** — Not needed. This plugin handles all Google OAuth.
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
## Configuration
|
|
588
|
+
|
|
589
|
+
Create `~/.config/opencode/antigravity.json` for optional settings:
|
|
590
|
+
|
|
591
|
+
```json
|
|
592
|
+
{
|
|
593
|
+
"$schema": "https://raw.githubusercontent.com/andyvandaric/opencode-ag-auth/main/assets/antigravity.schema.json"
|
|
594
|
+
}
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Most users don't need to configure anything — defaults work well.
|
|
598
|
+
|
|
599
|
+
### Model Behavior
|
|
600
|
+
|
|
601
|
+
| Option | Default | What it does |
|
|
602
|
+
|--------|---------|--------------
|
|
603
|
+
| `keep_thinking` | `false` | Preserve Claude's thinking across turns. **Warning:** enabling may degrade model stability. |
|
|
604
|
+
| `session_recovery` | `true` | Auto-recover from tool errors |
|
|
605
|
+
| `cli_first` | `false` | Route Gemini models to Gemini CLI first (Claude and image models stay on Antigravity). |
|
|
606
|
+
|
|
607
|
+
### Account Rotation
|
|
608
|
+
|
|
609
|
+
| Your Setup | Recommended Config |
|
|
610
|
+
|------------|-------------------|
|
|
611
|
+
| **1 account** | `"account_selection_strategy": "sticky"` |
|
|
612
|
+
| **2-5 accounts** | Default (`"hybrid"`) works great |
|
|
613
|
+
| **5+ accounts** | `"account_selection_strategy": "round-robin"` |
|
|
614
|
+
| **Parallel agents** | Add `"pid_offset_enabled": true` |
|
|
615
|
+
|
|
616
|
+
### Quota Protection
|
|
617
|
+
|
|
618
|
+
| Option | Default | What it does |
|
|
619
|
+
|--------|---------|--------------|
|
|
620
|
+
| `soft_quota_threshold_percent` | `90` | Skip account when quota usage exceeds this percentage. Prevents Google from penalizing accounts that fully exhaust quota. Set to `100` to disable. |
|
|
621
|
+
| `quota_refresh_interval_minutes` | `15` | Background quota refresh interval. After successful API requests, refreshes quota cache if older than this interval. Set to `0` to disable. |
|
|
622
|
+
| `soft_quota_cache_ttl_minutes` | `"auto"` | How long quota cache is considered fresh. `"auto"` = max(2 × refresh interval, 10 minutes). Set a number (1-120) for fixed TTL. |
|
|
623
|
+
|
|
624
|
+
> **How it works**: Quota cache is refreshed automatically after API requests (when older than `quota_refresh_interval_minutes`) and manually via "Check quotas" in `opencode auth login`. The threshold check uses `soft_quota_cache_ttl_minutes` to determine cache freshness - if cache is older, the account is considered "unknown" and allowed (fail-open). When ALL accounts exceed the threshold, the plugin waits for the earliest quota reset time (like rate limit behavior). If wait time exceeds `max_rate_limit_wait_seconds`, it errors immediately.
|
|
625
|
+
|
|
626
|
+
### Rate Limit Scheduling
|
|
627
|
+
|
|
628
|
+
Control how the plugin handles rate limits:
|
|
629
|
+
|
|
630
|
+
| Option | Default | What it does |
|
|
631
|
+
|--------|---------|--------------|
|
|
632
|
+
| `scheduling_mode` | `"cache_first"` | `"cache_first"` = wait for same account (preserves prompt cache), `"balance"` = switch immediately, `"performance_first"` = round-robin |
|
|
633
|
+
| `max_cache_first_wait_seconds` | `60` | Max seconds to wait in cache_first mode before switching accounts |
|
|
634
|
+
| `failure_ttl_seconds` | `3600` | Reset failure count after this many seconds (prevents old failures from permanently penalizing accounts) |
|
|
635
|
+
|
|
636
|
+
**When to use each mode:**
|
|
637
|
+
- **cache_first** (default): Best for long conversations. Waits for the same account to recover, preserving your prompt cache.
|
|
638
|
+
- **balance**: Best for quick tasks. Switches accounts immediately when rate-limited for maximum availability.
|
|
639
|
+
- **performance_first**: Best for many short requests. Distributes load evenly across all accounts.
|
|
640
|
+
|
|
641
|
+
### App Behavior
|
|
642
|
+
|
|
643
|
+
| Option | Default | What it does |
|
|
644
|
+
|--------|---------|--------------|
|
|
645
|
+
| `quiet_mode` | `false` | Hide toast notifications |
|
|
646
|
+
| `debug` | `false` | Enable debug logging |
|
|
647
|
+
| `auto_update` | `true` | Auto-update plugin |
|
|
648
|
+
|
|
649
|
+
For all options, see [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
650
|
+
|
|
651
|
+
**Environment variables:**
|
|
652
|
+
```bash
|
|
653
|
+
OPENCODE_CONFIG_DIR=/path/to/config opencode # Custom config directory
|
|
654
|
+
OPENCODE_ANTIGRAVITY_DEBUG=1 opencode # Enable debug logging
|
|
655
|
+
OPENCODE_ANTIGRAVITY_DEBUG=2 opencode # Verbose logging
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
## Troubleshooting
|
|
661
|
+
|
|
662
|
+
See the full [Troubleshooting Guide](docs/TROUBLESHOOTING.md) for solutions to common issues including:
|
|
663
|
+
|
|
664
|
+
- Auth problems and token refresh
|
|
665
|
+
- "Model not found" errors
|
|
666
|
+
- Session recovery
|
|
667
|
+
- Gemini CLI permission errors
|
|
668
|
+
- Safari OAuth issues
|
|
669
|
+
- Plugin compatibility
|
|
670
|
+
- Migration guides
|
|
671
|
+
|
|
672
|
+
---
|
|
673
|
+
|
|
674
|
+
## Documentation
|
|
675
|
+
|
|
676
|
+
- [Configuration](docs/CONFIGURATION.md) — All configuration options
|
|
677
|
+
- [Multi-Account](docs/MULTI-ACCOUNT.md) — Load balancing, dual quota pools, account storage
|
|
678
|
+
- [Model Variants](docs/MODEL-VARIANTS.md) — Thinking budgets and variant system
|
|
679
|
+
- [Troubleshooting](docs/TROUBLESHOOTING.md) — Common issues and fixes
|
|
680
|
+
- [Architecture](docs/ARCHITECTURE.md) — How the plugin works
|
|
681
|
+
- [API Spec](docs/ANTIGRAVITY_API_SPEC.md) — Antigravity API reference
|
|
682
|
+
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
## Support & Community
|
|
686
|
+
|
|
687
|
+
If this plugin helps your workflow, consider supporting its development:
|
|
688
|
+
|
|
689
|
+
### 🇮🇩 Indonesia / ASEAN (QRIS)
|
|
690
|
+
|
|
691
|
+
- **[Saweria](https://saweria.co/andyvandaric)** (Recommended for one-off support)
|
|
692
|
+
- **[Trakteer](https://trakteer.id/andyvandaric)** (For recurring support / exclusive content)
|
|
693
|
+
|
|
694
|
+
### 🌍 International
|
|
695
|
+
|
|
696
|
+
- **[Ko-fi](https://ko-fi.com/andyvandaric)** (PayPal / Card)
|
|
697
|
+
- **[GitHub Sponsors](https://github.com/sponsors/andyvandaric)**
|
|
698
|
+
|
|
699
|
+
---
|
|
700
|
+
|
|
701
|
+
## Credits
|
|
702
|
+
|
|
703
|
+
This project is built upon the work of incredible developers:
|
|
704
|
+
|
|
705
|
+
- **[jenslys](https://github.com/jenslys)** - Original creator of [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) (Basis for Gemini CLI auth).
|
|
706
|
+
- **[NoeFabris](https://github.com/NoeFabris)** - Added Antigravity support in [opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) (Multi-account support).
|
|
707
|
+
- **[Andy Vandaric](https://github.com/andyvandaric)** - **Enhanced Protection & Stability**:
|
|
708
|
+
- **Strict Quota Protocol**: Custom safety algorithm with **70% usage threshold** (30% safety buffer). Accounts are strictly locked until their specific reset time passes, preventing "leaky" usage from cache expiry.
|
|
709
|
+
- **Oh-My-OpenCode Integration**: Full session recovery for tool crashes and thinking block errors.
|
|
710
|
+
- **Enterprise Feat**: Proxy support via `undici`.
|
|
711
|
+
- **UX/Fixes**: Interactive quota pause and Cloud Code API header fixes.
|
|
712
|
+
|
|
713
|
+
### Community Contributors
|
|
714
|
+
- **[aaronsewall](https://github.com/aaronsewall)** - Added HTTP/HTTPS proxy support (#301).
|
|
715
|
+
- **[sunbos](https://github.com/sunbos)** - Logic for Oh-My-OpenCode integration (#349).
|
|
716
|
+
- **[m2m6vrm5fp-source](https://github.com/m2m6vrm5fp-source)** - Fixed Gemini 400 errors for empty properties (#319).
|
|
717
|
+
- **[jcromero](https://github.com/jcromero)** - Added interactive pause feature (#443).
|
|
718
|
+
- **[mynameistito](https://github.com/mynameistito)** - Cleaned up deprecated models (#437).
|
|
719
|
+
|
|
720
|
+
Special thanks to [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI).
|
|
721
|
+
|
|
722
|
+
## License
|
|
723
|
+
|
|
724
|
+
MIT License. See [LICENSE](LICENSE) for details.
|
|
725
|
+
|
|
726
|
+
<details>
|
|
727
|
+
<summary><b>Legal</b></summary>
|
|
728
|
+
|
|
729
|
+
### Intended Use
|
|
730
|
+
|
|
731
|
+
- Personal / internal development only
|
|
732
|
+
- Respect internal quotas and data handling policies
|
|
733
|
+
- Not for production services or bypassing intended limits
|
|
734
|
+
|
|
735
|
+
### Warning
|
|
736
|
+
|
|
737
|
+
By using this plugin, you acknowledge:
|
|
738
|
+
|
|
739
|
+
- **Terms of Service risk** — This approach may violate ToS of AI model providers
|
|
740
|
+
- **Account risk** — Providers may suspend or ban accounts
|
|
741
|
+
- **No guarantees** — APIs may change without notice
|
|
742
|
+
- **Assumption of risk** — You assume all legal, financial, and technical risks
|
|
743
|
+
|
|
744
|
+
### Disclaimer
|
|
745
|
+
|
|
746
|
+
- Not affiliated with Google. This is an independent open-source project.
|
|
747
|
+
- "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
|
|
748
|
+
|
|
749
|
+
</details>
|