opencode-antigravity-auth 2.0.0 → 2.1.0
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/README.md +34 -718
- package/dist/index.d.ts +1 -1
- package/dist/src/plugin/account-management.d.ts +67 -0
- package/dist/src/plugin/account-management.d.ts.map +1 -0
- package/dist/src/plugin/account-management.js +174 -0
- package/dist/src/plugin/account-management.js.map +1 -0
- package/dist/src/plugin/account-rpc.d.ts +70 -0
- package/dist/src/plugin/account-rpc.d.ts.map +1 -0
- package/dist/src/plugin/account-rpc.js +28 -0
- package/dist/src/plugin/account-rpc.js.map +1 -0
- package/dist/src/plugin/accounts.d.ts +23 -9
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +190 -22
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/config/models-v2.d.ts +19 -1
- package/dist/src/plugin/config/models-v2.d.ts.map +1 -1
- package/dist/src/plugin/config/models-v2.js +49 -38
- package/dist/src/plugin/config/models-v2.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +33 -1
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +43 -18
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/refresh-queue.d.ts +4 -1
- package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
- package/dist/src/plugin/refresh-queue.js +21 -4
- package/dist/src/plugin/refresh-queue.js.map +1 -1
- package/dist/src/plugin/storage.d.ts +15 -0
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +61 -2
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/token.d.ts +1 -3
- package/dist/src/plugin/token.d.ts.map +1 -1
- package/dist/src/plugin/token.js +43 -3
- package/dist/src/plugin/token.js.map +1 -1
- package/dist/src/plugin/transform/model-resolver.d.ts +2 -5
- package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -1
- package/dist/src/plugin/transform/model-resolver.js +9 -1
- package/dist/src/plugin/transform/model-resolver.js.map +1 -1
- package/dist/src/plugin/types.d.ts +5 -0
- package/dist/src/plugin/types.d.ts.map +1 -1
- package/dist/src/plugin.d.ts +3 -3
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/plugin.js +84 -26
- package/dist/src/plugin.js.map +1 -1
- package/dist/src/tui.d.ts +64 -0
- package/dist/src/tui.d.ts.map +1 -0
- package/dist/src/tui.js +124 -0
- package/dist/src/tui.js.map +1 -0
- package/dist/src/v2.d.ts.map +1 -1
- package/dist/src/v2.js +386 -105
- package/dist/src/v2.js.map +1 -1
- package/package.json +9 -3
- package/tui.js +1 -0
package/README.md
CHANGED
|
@@ -1,747 +1,63 @@
|
|
|
1
|
-
# Antigravity
|
|
1
|
+
# Antigravity auth for OpenCode
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://www.npmjs.com/package/opencode-antigravity-auth)
|
|
5
|
-
[](https://www.npmjs.com/package/opencode-antigravity-auth)
|
|
6
|
-
[](LICENSE)
|
|
7
|
-
[](https://x.com/dopesalmon)
|
|
3
|
+
Use Google OAuth to access Antigravity models in OpenCode, with multiple accounts and automatic rotation.
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
Unofficial plugin. Google may restrict accounts using third-party clients.
|
|
10
6
|
|
|
11
|
-
##
|
|
7
|
+
## Setup
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
- **Multi-account support** — add multiple Google accounts, auto-rotates when rate-limited
|
|
15
|
-
- **Dual quota system** — access both Antigravity and Gemini CLI quotas from one plugin
|
|
16
|
-
- **Thinking models** — extended thinking for Claude and Gemini 3 with configurable budgets
|
|
17
|
-
- **Google Search grounding** — enable web search for Gemini models (auto or always-on)
|
|
18
|
-
- **Auto-recovery** — handles session errors and tool failures automatically
|
|
19
|
-
- **Plugin compatible** — works alongside other OpenCode plugins (oh-my-opencode, dcp, etc.)
|
|
9
|
+
Requires OpenCode **2.1.2+** and Node.js **20+**.
|
|
20
10
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<details open>
|
|
24
|
-
<summary><b>⚠️ Terms of Service Warning — Read Before Installing</b></summary>
|
|
25
|
-
|
|
26
|
-
> [!CAUTION]
|
|
27
|
-
> 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).
|
|
28
|
-
>
|
|
29
|
-
> **By using this plugin, you acknowledge:**
|
|
30
|
-
> - This is an unofficial tool not endorsed by Google
|
|
31
|
-
> - Your account may be suspended or permanently banned
|
|
32
|
-
> - You assume all risks associated with using this plugin
|
|
33
|
-
>
|
|
34
|
-
|
|
35
|
-
</details>
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Installation
|
|
40
|
-
|
|
41
|
-
### OpenCode V2
|
|
42
|
-
|
|
43
|
-
Version **2.0.0** targets OpenCode **2.1.2 or newer**. V2 requires a new plugin implementation, plural
|
|
44
|
-
configuration keys, and a `#variant` suffix on model references.
|
|
11
|
+
Add to `~/.config/opencode/opencode.json`:
|
|
45
12
|
|
|
46
13
|
```json
|
|
47
14
|
{
|
|
48
15
|
"$schema": "https://opencode.ai/config.json",
|
|
49
|
-
"plugins": ["opencode-antigravity-auth@
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Use this configuration once version 2.0.0 is published; PR checkouts can be
|
|
54
|
-
built and loaded by absolute directory path. The plugin registers its models automatically. Connect **Google → Google OAuth
|
|
55
|
-
(Antigravity)** with `opencode auth login`, then run:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
opencode run --model=google/antigravity-gemini-3-flash#high "Hello"
|
|
59
|
-
opencode run --model=google/antigravity-claude-opus-4-6-thinking#max "Hello"
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Existing `antigravity-accounts.json` accounts are reused. Revoked refresh tokens
|
|
63
|
-
still require a fresh Google sign-in. See [the V2 migration and verification
|
|
64
|
-
guide](docs/OPENCODE-V2.md) for configuration examples, current Antigravity
|
|
65
|
-
protocol changes, and the runtime regression test.
|
|
66
|
-
|
|
67
|
-
The package also supports the V1 object plugin entrypoint in OpenCode
|
|
68
|
-
**1.18.29+**. The instructions below use V1 configuration and command syntax.
|
|
69
|
-
|
|
70
|
-
<details open>
|
|
71
|
-
<summary><b>For Humans</b></summary>
|
|
72
|
-
|
|
73
|
-
**Option A: Let an LLM do it**
|
|
74
|
-
|
|
75
|
-
Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
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
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
**Option B: Manual setup**
|
|
82
|
-
|
|
83
|
-
1. **Add the plugin** to `~/.config/opencode/opencode.json`:
|
|
84
|
-
|
|
85
|
-
```json
|
|
86
|
-
{
|
|
87
|
-
"plugin": ["opencode-antigravity-auth@latest"]
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
> Want bleeding-edge features? Use `opencode-antigravity-auth@beta` instead.
|
|
92
|
-
|
|
93
|
-
2. **Login** with your Google account:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
opencode auth login
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
3. **Add models** — choose one:
|
|
100
|
-
- Run `opencode auth login` → Google → OAuth with Google (Antigravity) → select **"Configure models in opencode.json"** (auto-configures all models)
|
|
101
|
-
- Or manually copy the [full configuration](#models) below
|
|
102
|
-
|
|
103
|
-
4. **Use it:**
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
</details>
|
|
110
|
-
|
|
111
|
-
<details>
|
|
112
|
-
<summary><b>For LLM Agents</b></summary>
|
|
113
|
-
|
|
114
|
-
### Step-by-Step Instructions
|
|
115
|
-
|
|
116
|
-
1. Edit the OpenCode configuration file at `~/.config/opencode/opencode.json`
|
|
117
|
-
|
|
118
|
-
> **Note**: This path works on all platforms. On Windows, `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
|
|
119
|
-
|
|
120
|
-
2. Add the plugin to the `plugin` array
|
|
121
|
-
|
|
122
|
-
3. Add the model definitions from the [Full models configuration](#models) section
|
|
123
|
-
|
|
124
|
-
4. Set `provider` to `"google"` and choose a model
|
|
125
|
-
|
|
126
|
-
### Verification
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
</details>
|
|
133
|
-
|
|
134
|
-
---
|
|
135
|
-
|
|
136
|
-
## Models
|
|
137
|
-
|
|
138
|
-
### Model Reference
|
|
139
|
-
|
|
140
|
-
**Antigravity quota** (default routing for Claude and Gemini):
|
|
141
|
-
|
|
142
|
-
| Model | Variants | Notes |
|
|
143
|
-
|-------|----------|-------|
|
|
144
|
-
| `antigravity-gemini-3-pro` | low, high | Gemini 3 Pro with thinking |
|
|
145
|
-
| `antigravity-gemini-3.1-pro` | low, high | Gemini 3.1 Pro with thinking (rollout-dependent) |
|
|
146
|
-
| `antigravity-gemini-3-flash` | minimal, low, medium, high | Gemini 3 Flash with thinking |
|
|
147
|
-
| `antigravity-claude-sonnet-4-6` | — | Claude Sonnet 4.6 |
|
|
148
|
-
| `antigravity-claude-opus-4-6-thinking` | low, max | Claude Opus 4.6 with extended thinking |
|
|
149
|
-
|
|
150
|
-
**Gemini CLI quota** (separate from Antigravity; used when `cli_first` is true or as fallback):
|
|
151
|
-
|
|
152
|
-
| Model | Notes |
|
|
153
|
-
|-------|-------|
|
|
154
|
-
| `gemini-2.5-flash` | Gemini 2.5 Flash |
|
|
155
|
-
| `gemini-2.5-pro` | Gemini 2.5 Pro |
|
|
156
|
-
| `gemini-3-flash-preview` | Gemini 3 Flash (preview) |
|
|
157
|
-
| `gemini-3-pro-preview` | Gemini 3 Pro (preview) |
|
|
158
|
-
| `gemini-3.1-pro-preview` | Gemini 3.1 Pro (preview, rollout-dependent) |
|
|
159
|
-
| `gemini-3.1-pro-preview-customtools` | Gemini 3.1 Pro Preview Custom Tools (preview, rollout-dependent) |
|
|
160
|
-
|
|
161
|
-
> **Routing Behavior:**
|
|
162
|
-
> - **Antigravity-first (default):** Gemini models use Antigravity quota across accounts.
|
|
163
|
-
> - **CLI-first (`cli_first: true`):** Gemini models use Gemini CLI quota first.
|
|
164
|
-
> - When a Gemini quota pool is exhausted, the plugin automatically falls back to the other pool.
|
|
165
|
-
> - Claude and image models always use Antigravity.
|
|
166
|
-
> Model names are automatically transformed for the target API (e.g., `antigravity-gemini-3-flash` → `gemini-3-flash-preview` for CLI).
|
|
167
|
-
|
|
168
|
-
**Using variants:**
|
|
169
|
-
```bash
|
|
170
|
-
opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
For details on variant configuration and thinking levels, see [docs/MODEL-VARIANTS.md](docs/MODEL-VARIANTS.md).
|
|
174
|
-
|
|
175
|
-
<details>
|
|
176
|
-
<summary><b>Full models configuration (copy-paste ready)</b></summary>
|
|
177
|
-
|
|
178
|
-
Add this to your `~/.config/opencode/opencode.json`:
|
|
179
|
-
|
|
180
|
-
```json
|
|
181
|
-
{
|
|
182
|
-
"$schema": "https://opencode.ai/config.json",
|
|
183
|
-
"plugin": ["opencode-antigravity-auth@latest"],
|
|
184
|
-
"provider": {
|
|
185
|
-
"google": {
|
|
186
|
-
"models": {
|
|
187
|
-
"antigravity-gemini-3-pro": {
|
|
188
|
-
"name": "Gemini 3 Pro (Antigravity)",
|
|
189
|
-
"limit": { "context": 1048576, "output": 65535 },
|
|
190
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
191
|
-
"variants": {
|
|
192
|
-
"low": { "thinkingLevel": "low" },
|
|
193
|
-
"high": { "thinkingLevel": "high" }
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
"antigravity-gemini-3.1-pro": {
|
|
197
|
-
"name": "Gemini 3.1 Pro (Antigravity)",
|
|
198
|
-
"limit": { "context": 1048576, "output": 65535 },
|
|
199
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
200
|
-
"variants": {
|
|
201
|
-
"low": { "thinkingLevel": "low" },
|
|
202
|
-
"high": { "thinkingLevel": "high" }
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
"antigravity-gemini-3-flash": {
|
|
206
|
-
"name": "Gemini 3 Flash (Antigravity)",
|
|
207
|
-
"limit": { "context": 1048576, "output": 65536 },
|
|
208
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
209
|
-
"variants": {
|
|
210
|
-
"minimal": { "thinkingLevel": "minimal" },
|
|
211
|
-
"low": { "thinkingLevel": "low" },
|
|
212
|
-
"medium": { "thinkingLevel": "medium" },
|
|
213
|
-
"high": { "thinkingLevel": "high" }
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
"antigravity-claude-sonnet-4-6": {
|
|
217
|
-
"name": "Claude Sonnet 4.6 (Antigravity)",
|
|
218
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
219
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
220
|
-
},
|
|
221
|
-
"antigravity-claude-opus-4-6-thinking": {
|
|
222
|
-
"name": "Claude Opus 4.6 Thinking (Antigravity)",
|
|
223
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
224
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
|
|
225
|
-
"variants": {
|
|
226
|
-
"low": { "thinkingConfig": { "thinkingBudget": 8192 } },
|
|
227
|
-
"max": { "thinkingConfig": { "thinkingBudget": 32768 } }
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
"gemini-2.5-flash": {
|
|
231
|
-
"name": "Gemini 2.5 Flash (Gemini CLI)",
|
|
232
|
-
"limit": { "context": 1048576, "output": 65536 },
|
|
233
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
234
|
-
},
|
|
235
|
-
"gemini-2.5-pro": {
|
|
236
|
-
"name": "Gemini 2.5 Pro (Gemini CLI)",
|
|
237
|
-
"limit": { "context": 1048576, "output": 65536 },
|
|
238
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
239
|
-
},
|
|
240
|
-
"gemini-3-flash-preview": {
|
|
241
|
-
"name": "Gemini 3 Flash Preview (Gemini CLI)",
|
|
242
|
-
"limit": { "context": 1048576, "output": 65536 },
|
|
243
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
244
|
-
},
|
|
245
|
-
"gemini-3-pro-preview": {
|
|
246
|
-
"name": "Gemini 3 Pro Preview (Gemini CLI)",
|
|
247
|
-
"limit": { "context": 1048576, "output": 65535 },
|
|
248
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
249
|
-
},
|
|
250
|
-
"gemini-3.1-pro-preview": {
|
|
251
|
-
"name": "Gemini 3.1 Pro Preview (Gemini CLI)",
|
|
252
|
-
"limit": { "context": 1048576, "output": 65535 },
|
|
253
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
254
|
-
},
|
|
255
|
-
"gemini-3.1-pro-preview-customtools": {
|
|
256
|
-
"name": "Gemini 3.1 Pro Preview Custom Tools (Gemini CLI)",
|
|
257
|
-
"limit": { "context": 1048576, "output": 65535 },
|
|
258
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
> **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.
|
|
267
|
-
|
|
268
|
-
</details>
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## Multi-Account Setup
|
|
273
|
-
|
|
274
|
-
Add multiple Google accounts for a higher combined quota. The plugin automatically rotates between accounts when one is rate-limited.
|
|
275
|
-
|
|
276
|
-
```bash
|
|
277
|
-
opencode auth login # Run again to add more accounts
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
**Account management options (via `opencode auth login`):**
|
|
281
|
-
- **Configure models** — Auto-configure all plugin models in opencode.json
|
|
282
|
-
- **Check quotas** — View remaining API quota for each account
|
|
283
|
-
- **Manage accounts** — Enable/disable specific accounts for rotation
|
|
284
|
-
|
|
285
|
-
For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
## Troubleshooting
|
|
290
|
-
|
|
291
|
-
> **Quick Reset**: Most issues can be resolved by deleting `~/.config/opencode/antigravity-accounts.json` and running `opencode auth login` again.
|
|
292
|
-
|
|
293
|
-
### Configuration Path (All Platforms)
|
|
294
|
-
|
|
295
|
-
OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
|
|
296
|
-
|
|
297
|
-
| File | Path |
|
|
298
|
-
|------|------|
|
|
299
|
-
| Main config | `~/.config/opencode/opencode.json` |
|
|
300
|
-
| Accounts | `~/.config/opencode/antigravity-accounts.json` |
|
|
301
|
-
| Plugin config | `~/.config/opencode/antigravity.json` |
|
|
302
|
-
| Debug logs | `~/.config/opencode/antigravity-logs/` |
|
|
303
|
-
|
|
304
|
-
> **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`). Do NOT use `%APPDATA%`.
|
|
305
|
-
|
|
306
|
-
> **Custom path**: Set `OPENCODE_CONFIG_DIR` environment variable to use a custom location.
|
|
307
|
-
|
|
308
|
-
> **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/`.
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
### Multi-Account Auth Issues
|
|
313
|
-
|
|
314
|
-
If you encounter authentication issues with multiple accounts:
|
|
315
|
-
|
|
316
|
-
1. Delete the accounts file:
|
|
317
|
-
```bash
|
|
318
|
-
rm ~/.config/opencode/antigravity-accounts.json
|
|
319
|
-
```
|
|
320
|
-
2. Re-authenticate:
|
|
321
|
-
```bash
|
|
322
|
-
opencode auth login
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
---
|
|
326
|
-
|
|
327
|
-
### 403 Permission Denied (`rising-fact-p41fc`)
|
|
328
|
-
|
|
329
|
-
**Error:**
|
|
330
|
-
```
|
|
331
|
-
Permission 'cloudaicompanion.companions.generateChat' denied on resource
|
|
332
|
-
'//cloudaicompanion.googleapis.com/projects/rising-fact-p41fc/locations/global'
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
**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.
|
|
336
|
-
|
|
337
|
-
**Solution:**
|
|
338
|
-
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
|
|
339
|
-
2. Create or select a project
|
|
340
|
-
3. Enable the **Gemini for Google Cloud API** (`cloudaicompanion.googleapis.com`)
|
|
341
|
-
4. Add `projectId` to your accounts file:
|
|
342
|
-
```json
|
|
343
|
-
{
|
|
344
|
-
"accounts": [
|
|
345
|
-
{
|
|
346
|
-
"email": "your@email.com",
|
|
347
|
-
"refreshToken": "...",
|
|
348
|
-
"projectId": "your-project-id"
|
|
349
|
-
}
|
|
350
|
-
]
|
|
351
|
-
}
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
> **Note**: Do this for each account in a multi-account setup.
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
### Gemini Model Not Found
|
|
359
|
-
|
|
360
|
-
Add this to your `google` provider config:
|
|
361
|
-
|
|
362
|
-
```json
|
|
363
|
-
{
|
|
364
|
-
"provider": {
|
|
365
|
-
"google": {
|
|
366
|
-
"npm": "@ai-sdk/google",
|
|
367
|
-
"models": { ... }
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
---
|
|
374
|
-
|
|
375
|
-
### Gemini 3 Models 400 Error ("Unknown name 'parameters'")
|
|
376
|
-
|
|
377
|
-
**Error:**
|
|
378
|
-
```
|
|
379
|
-
Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]'
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
**Causes:**
|
|
383
|
-
- Tool schema incompatibility with Gemini's strict protobuf validation
|
|
384
|
-
- MCP servers with malformed schemas
|
|
385
|
-
- Plugin version regression
|
|
386
|
-
|
|
387
|
-
**Solutions:**
|
|
388
|
-
1. **Update to latest beta:**
|
|
389
|
-
```json
|
|
390
|
-
{ "plugin": ["opencode-antigravity-auth@beta"] }
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
2. **Disable MCP servers** one-by-one to find the problematic one
|
|
394
|
-
|
|
395
|
-
3. **Add npm override:**
|
|
396
|
-
```json
|
|
397
|
-
{ "provider": { "google": { "npm": "@ai-sdk/google" } } }
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
---
|
|
401
|
-
|
|
402
|
-
### MCP Servers Causing Errors
|
|
403
|
-
|
|
404
|
-
Some MCP servers have schemas incompatible with Antigravity's strict JSON format.
|
|
405
|
-
|
|
406
|
-
**Common symptom:**
|
|
407
|
-
```bash
|
|
408
|
-
Invalid function name must start with a letter or underscore
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
Sometimes it shows up as:
|
|
412
|
-
```bash
|
|
413
|
-
GenerateContentRequest.tools[0].function_declarations[12].name: Invalid function name must start with a letter or underscore
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
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.
|
|
417
|
-
|
|
418
|
-
**Diagnosis:**
|
|
419
|
-
1. Disable all MCP servers in your config
|
|
420
|
-
2. Enable one-by-one until error reappears
|
|
421
|
-
3. Report the specific MCP in a [GitHub issue](https://github.com/NoeFabris/opencode-antigravity-auth/issues)
|
|
422
|
-
|
|
423
|
-
---
|
|
424
|
-
|
|
425
|
-
### "All Accounts Rate-Limited" (But Quota Available)
|
|
426
|
-
|
|
427
|
-
**Cause:** Cascade bug in `clearExpiredRateLimits()` in hybrid mode (fixed in recent beta).
|
|
428
|
-
|
|
429
|
-
**Solutions:**
|
|
430
|
-
1. Update to latest beta version
|
|
431
|
-
2. If persists, delete accounts file and re-authenticate
|
|
432
|
-
3. Try switching `account_selection_strategy` to `"sticky"` in `antigravity.json`
|
|
433
|
-
|
|
434
|
-
---
|
|
435
|
-
|
|
436
|
-
### Session Recovery
|
|
437
|
-
|
|
438
|
-
If you encounter errors during a session:
|
|
439
|
-
1. Type `continue` to trigger the recovery mechanism
|
|
440
|
-
2. If blocked, use `/undo` to revert to pre-error state
|
|
441
|
-
3. Retry the operation
|
|
442
|
-
|
|
443
|
-
---
|
|
444
|
-
|
|
445
|
-
### Using with Oh-My-OpenCode
|
|
446
|
-
|
|
447
|
-
**Important:** Disable the built-in Google auth to prevent conflicts:
|
|
448
|
-
|
|
449
|
-
```json
|
|
450
|
-
// ~/.config/opencode/oh-my-opencode.json
|
|
451
|
-
{
|
|
452
|
-
"google_auth": false,
|
|
453
|
-
"agents": {
|
|
454
|
-
"frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3-pro" },
|
|
455
|
-
"document-writer": { "model": "google/antigravity-gemini-3-flash" }
|
|
456
|
-
}
|
|
16
|
+
"plugins": ["opencode-antigravity-auth@2.1.0"]
|
|
457
17
|
}
|
|
458
18
|
```
|
|
459
19
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
### Infinite `.tmp` Files Created
|
|
463
|
-
|
|
464
|
-
**Cause:** When account is rate-limited and plugin retries infinitely, it creates many temp files.
|
|
465
|
-
|
|
466
|
-
**Workaround:**
|
|
467
|
-
1. Stop OpenCode
|
|
468
|
-
2. Clean up: `rm ~/.config/opencode/*.tmp`
|
|
469
|
-
3. Add more accounts or wait for rate limit to expire
|
|
470
|
-
|
|
471
|
-
---
|
|
472
|
-
|
|
473
|
-
### OAuth Callback Issues
|
|
474
|
-
|
|
475
|
-
<details>
|
|
476
|
-
<summary><b>Safari OAuth Callback Fails (macOS)</b></summary>
|
|
477
|
-
|
|
478
|
-
**Symptoms:**
|
|
479
|
-
- "fail to authorize" after successful Google login
|
|
480
|
-
- Safari shows "Safari can't open the page"
|
|
481
|
-
|
|
482
|
-
**Cause:** Safari's "HTTPS-Only Mode" blocks `http://localhost` callback.
|
|
483
|
-
|
|
484
|
-
**Solutions:**
|
|
485
|
-
|
|
486
|
-
1. **Use Chrome or Firefox** (easiest):
|
|
487
|
-
Copy the OAuth URL and paste into a different browser.
|
|
488
|
-
|
|
489
|
-
2. **Disable HTTPS-Only Mode temporarily:**
|
|
490
|
-
- Safari > Settings (⌘,) > Privacy
|
|
491
|
-
- Uncheck "Enable HTTPS-Only Mode"
|
|
492
|
-
- Run `opencode auth login`
|
|
493
|
-
- Re-enable after authentication
|
|
494
|
-
|
|
495
|
-
</details>
|
|
496
|
-
|
|
497
|
-
<details>
|
|
498
|
-
<summary><b>Port Conflict (Address Already in Use)</b></summary>
|
|
499
|
-
|
|
500
|
-
**macOS / Linux:**
|
|
501
|
-
```bash
|
|
502
|
-
# Find process using the port
|
|
503
|
-
lsof -i :51121
|
|
504
|
-
|
|
505
|
-
# Kill if stale
|
|
506
|
-
kill -9 <PID>
|
|
507
|
-
|
|
508
|
-
# Retry
|
|
509
|
-
opencode auth login
|
|
510
|
-
```
|
|
511
|
-
|
|
512
|
-
**Windows (PowerShell):**
|
|
513
|
-
```powershell
|
|
514
|
-
netstat -ano | findstr :51121
|
|
515
|
-
taskkill /PID <PID> /F
|
|
516
|
-
opencode auth login
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
</details>
|
|
520
|
-
|
|
521
|
-
<details>
|
|
522
|
-
<summary><b>Docker / WSL2 / Remote Development</b></summary>
|
|
523
|
-
|
|
524
|
-
OAuth callback requires browser to reach `localhost` on the machine running OpenCode.
|
|
525
|
-
|
|
526
|
-
**WSL2:**
|
|
527
|
-
- Use VS Code's port forwarding, or
|
|
528
|
-
- Configure Windows → WSL port forwarding
|
|
529
|
-
|
|
530
|
-
**SSH / Remote:**
|
|
531
|
-
```bash
|
|
532
|
-
ssh -L 51121:localhost:51121 user@remote
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
**Docker / Containers:**
|
|
536
|
-
- OAuth with localhost redirect doesn't work in containers
|
|
537
|
-
- Wait 30s for manual URL flow, or use SSH port forwarding
|
|
538
|
-
|
|
539
|
-
</details>
|
|
540
|
-
|
|
541
|
-
---
|
|
20
|
+
Then run:
|
|
542
21
|
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
The correct key is `plugin` (singular):
|
|
546
|
-
|
|
547
|
-
```json
|
|
548
|
-
{
|
|
549
|
-
"plugin": ["opencode-antigravity-auth@beta"]
|
|
550
|
-
}
|
|
22
|
+
```sh
|
|
23
|
+
opencode auth login google
|
|
551
24
|
```
|
|
552
25
|
|
|
553
|
-
**
|
|
554
|
-
|
|
555
|
-
---
|
|
556
|
-
|
|
557
|
-
### Migrating Accounts Between Machines
|
|
558
|
-
|
|
559
|
-
When copying `antigravity-accounts.json` to a new machine:
|
|
560
|
-
1. Ensure the plugin is installed: `"plugin": ["opencode-antigravity-auth@beta"]`
|
|
561
|
-
2. Copy `~/.config/opencode/antigravity-accounts.json`
|
|
562
|
-
3. If you get "API key missing" error, the refresh token may be invalid — re-authenticate
|
|
563
|
-
|
|
564
|
-
## Known Plugin Interactions
|
|
565
|
-
For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
|
|
566
|
-
|
|
567
|
-
---
|
|
26
|
+
Choose **Google OAuth (Antigravity)**. Existing accounts are reused.
|
|
568
27
|
|
|
569
|
-
|
|
28
|
+
To use a local checkout, run `npm ci && npm run build` and replace the package name above with the checkout's absolute path.
|
|
570
29
|
|
|
571
|
-
|
|
30
|
+
## Use
|
|
572
31
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
"plugin": [
|
|
578
|
-
"opencode-antigravity-auth@latest",
|
|
579
|
-
"@tarquinen/opencode-dcp@latest"
|
|
580
|
-
]
|
|
581
|
-
}
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
### oh-my-opencode
|
|
585
|
-
|
|
586
|
-
Disable built-in auth and override agent models in `oh-my-opencode.json`:
|
|
587
|
-
|
|
588
|
-
```json
|
|
589
|
-
{
|
|
590
|
-
"google_auth": false,
|
|
591
|
-
"agents": {
|
|
592
|
-
"frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3-pro" },
|
|
593
|
-
"document-writer": { "model": "google/antigravity-gemini-3-flash" },
|
|
594
|
-
"multimodal-looker": { "model": "google/antigravity-gemini-3-flash" }
|
|
595
|
-
}
|
|
596
|
-
}
|
|
32
|
+
```sh
|
|
33
|
+
opencode models
|
|
34
|
+
opencode run --model=google/antigravity-gemini-3.8-flash-high "Hello"
|
|
35
|
+
opencode run --model=google/antigravity-claude-opus-4-6-thinking#max "Hello"
|
|
597
36
|
```
|
|
598
37
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
### Plugins you don't need
|
|
38
|
+
Models are discovered from your enabled accounts and cached for an hour. Availability depends on your Google plan. Disabled and internal models are excluded; native Google API-key models keep their own transport.
|
|
602
39
|
|
|
603
|
-
|
|
40
|
+
Inside OpenCode, open **`/antigravity`** (or **`/ag`**) to:
|
|
604
41
|
|
|
605
|
-
|
|
42
|
+
- See logged-in accounts and the current selection.
|
|
43
|
+
- Check Antigravity and Gemini CLI quotas and reset times.
|
|
44
|
+
- Add, select, enable, disable, re-authenticate, or delete an account.
|
|
45
|
+
- Refresh the model list.
|
|
606
46
|
|
|
607
|
-
|
|
47
|
+
Accounts are stored in `~/.config/opencode/antigravity-accounts.json`. Back up this file before moving machines; it contains credentials. Disabling an account excludes it from rotation and routine quota checks.
|
|
608
48
|
|
|
609
|
-
|
|
49
|
+
## Development
|
|
610
50
|
|
|
611
|
-
```
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
51
|
+
```sh
|
|
52
|
+
npm ci
|
|
53
|
+
npm run typecheck
|
|
54
|
+
npm test
|
|
55
|
+
npm run build
|
|
56
|
+
OPENCODE_BIN=/path/to/opencode npm run test:e2e:v2
|
|
615
57
|
```
|
|
616
58
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
### Model Behavior
|
|
620
|
-
|
|
621
|
-
| Option | Default | What it does |
|
|
622
|
-
|--------|---------|--------------
|
|
623
|
-
| `keep_thinking` | `false` | Preserve Claude's thinking across turns. **Warning:** enabling may degrade model stability. |
|
|
624
|
-
| `session_recovery` | `true` | Auto-recover from tool errors |
|
|
625
|
-
| `cli_first` | `false` | Route Gemini models to Gemini CLI first (Claude and image models stay on Antigravity). |
|
|
626
|
-
|
|
627
|
-
### Account Rotation
|
|
628
|
-
|
|
629
|
-
| Your Setup | Recommended Config |
|
|
630
|
-
|------------|-------------------|
|
|
631
|
-
| **1 account** | `"account_selection_strategy": "sticky"` |
|
|
632
|
-
| **2-5 accounts** | Default (`"hybrid"`) works great |
|
|
633
|
-
| **5+ accounts** | `"account_selection_strategy": "round-robin"` |
|
|
634
|
-
| **Parallel agents** | Add `"pid_offset_enabled": true` |
|
|
635
|
-
|
|
636
|
-
### Quota Protection
|
|
637
|
-
|
|
638
|
-
| Option | Default | What it does |
|
|
639
|
-
|--------|---------|--------------|
|
|
640
|
-
| `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. |
|
|
641
|
-
| `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. |
|
|
642
|
-
| `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. |
|
|
643
|
-
|
|
644
|
-
> **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.
|
|
645
|
-
|
|
646
|
-
### Rate Limit Scheduling
|
|
647
|
-
|
|
648
|
-
Control how the plugin handles rate limits:
|
|
649
|
-
|
|
650
|
-
| Option | Default | What it does |
|
|
651
|
-
|--------|---------|--------------|
|
|
652
|
-
| `scheduling_mode` | `"cache_first"` | `"cache_first"` = wait for same account (preserves prompt cache), `"balance"` = switch immediately, `"performance_first"` = round-robin |
|
|
653
|
-
| `max_cache_first_wait_seconds` | `60` | Max seconds to wait in cache_first mode before switching accounts |
|
|
654
|
-
| `failure_ttl_seconds` | `3600` | Reset failure count after this many seconds (prevents old failures from permanently penalizing accounts) |
|
|
655
|
-
|
|
656
|
-
**When to use each mode:**
|
|
657
|
-
- **cache_first** (default): Best for long conversations. Waits for the same account to recover, preserving your prompt cache.
|
|
658
|
-
- **balance**: Best for quick tasks. Switches accounts immediately when rate-limited for maximum availability.
|
|
659
|
-
- **performance_first**: Best for many short requests. Distributes load evenly across all accounts.
|
|
660
|
-
|
|
661
|
-
### App Behavior
|
|
662
|
-
|
|
663
|
-
| Option | Default | What it does |
|
|
664
|
-
|--------|---------|--------------|
|
|
665
|
-
| `quiet_mode` | `false` | Hide toast notifications |
|
|
666
|
-
| `debug` | `false` | Enable debug file logging (`~/.config/opencode/antigravity-logs/`) |
|
|
667
|
-
| `debug_tui` | `false` | Show debug logs in the TUI log panel (independent from `debug`) |
|
|
668
|
-
| `auto_update` | `true` | Auto-update plugin |
|
|
669
|
-
|
|
670
|
-
For all options, see [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
|
|
671
|
-
|
|
672
|
-
**Environment variables:**
|
|
673
|
-
```bash
|
|
674
|
-
OPENCODE_CONFIG_DIR=/path/to/config opencode # Custom config directory
|
|
675
|
-
OPENCODE_ANTIGRAVITY_DEBUG=1 opencode # Enable debug file logging
|
|
676
|
-
OPENCODE_ANTIGRAVITY_DEBUG=2 opencode # Verbose debug file logging
|
|
677
|
-
OPENCODE_ANTIGRAVITY_DEBUG_TUI=1 opencode # Enable TUI log panel debug output
|
|
678
|
-
```
|
|
679
|
-
|
|
680
|
-
---
|
|
681
|
-
|
|
682
|
-
## Troubleshooting
|
|
683
|
-
|
|
684
|
-
See the full [Troubleshooting Guide](docs/TROUBLESHOOTING.md) for solutions to common issues including:
|
|
685
|
-
|
|
686
|
-
- Auth problems and token refresh
|
|
687
|
-
- "Model not found" errors
|
|
688
|
-
- Session recovery
|
|
689
|
-
- Gemini CLI permission errors
|
|
690
|
-
- Safari OAuth issues
|
|
691
|
-
- Plugin compatibility
|
|
692
|
-
- Migration guides
|
|
693
|
-
|
|
694
|
-
---
|
|
695
|
-
|
|
696
|
-
## Documentation
|
|
697
|
-
|
|
698
|
-
- [Configuration](docs/CONFIGURATION.md) — All configuration options
|
|
699
|
-
- [Multi-Account](docs/MULTI-ACCOUNT.md) — Load balancing, dual quota pools, account storage
|
|
700
|
-
- [Model Variants](docs/MODEL-VARIANTS.md) — Thinking budgets and variant system
|
|
701
|
-
- [Troubleshooting](docs/TROUBLESHOOTING.md) — Common issues and fixes
|
|
702
|
-
- [Architecture](docs/ARCHITECTURE.md) — How the plugin works
|
|
703
|
-
- [API Spec](docs/ANTIGRAVITY_API_SPEC.md) — Antigravity API reference
|
|
704
|
-
|
|
705
|
-
---
|
|
706
|
-
|
|
707
|
-
## Support
|
|
708
|
-
|
|
709
|
-
If this plugin saves you time, consider supporting its development:
|
|
710
|
-
|
|
711
|
-
[](https://ko-fi.com/S6S81QBOIR)
|
|
712
|
-
|
|
713
|
-
---
|
|
714
|
-
|
|
715
|
-
## Credits
|
|
716
|
-
|
|
717
|
-
- [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) by [@jenslys](https://github.com/jenslys)
|
|
718
|
-
- [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)
|
|
719
|
-
|
|
720
|
-
## License
|
|
721
|
-
|
|
722
|
-
MIT License. See [LICENSE](LICENSE) for details.
|
|
723
|
-
|
|
724
|
-
<details>
|
|
725
|
-
<summary><b>Legal</b></summary>
|
|
726
|
-
|
|
727
|
-
### Intended Use
|
|
728
|
-
|
|
729
|
-
- Personal / internal development only
|
|
730
|
-
- Respect internal quotas and data handling policies
|
|
731
|
-
- Not for production services or bypassing intended limits
|
|
732
|
-
|
|
733
|
-
### Warning
|
|
734
|
-
|
|
735
|
-
By using this plugin, you acknowledge:
|
|
736
|
-
|
|
737
|
-
- **Terms of Service risk** — This approach may violate ToS of AI model providers
|
|
738
|
-
- **Account risk** — Providers may suspend or ban accounts
|
|
739
|
-
- **No guarantees** — APIs may change without notice
|
|
740
|
-
- **Assumption of risk** — You assume all legal, financial, and technical risks
|
|
741
|
-
|
|
742
|
-
### Disclaimer
|
|
59
|
+
The runtime test uses synthetic credentials. Authenticated model and menu checks require a logged-in Google account.
|
|
743
60
|
|
|
744
|
-
|
|
745
|
-
- "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
|
|
61
|
+
[V2 migration and verification](docs/OPENCODE-V2.md) · [Configuration](docs/CONFIGURATION.md) · [Troubleshooting](docs/TROUBLESHOOTING.md)
|
|
746
62
|
|
|
747
|
-
|
|
63
|
+
OpenCode 1.18.29+ remains supported through the legacy entrypoint; its account menu opens from `opencode auth login`.
|