opencode-antigravity-auth 1.2.7-beta.7 → 1.2.7
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 +307 -228
- package/dist/src/plugin/recovery.d.ts.map +1 -1
- package/dist/src/plugin/recovery.js +0 -1
- package/dist/src/plugin/recovery.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +6 -1
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/transform/model-resolver.d.ts +6 -3
- package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -1
- package/dist/src/plugin/transform/model-resolver.js +27 -4
- package/dist/src/plugin/transform/model-resolver.js.map +1 -1
- package/dist/src/plugin.d.ts.map +1 -1
- package/dist/src/plugin.js +3 -1
- package/dist/src/plugin.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,104 +1,94 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Antigravity + Gemini CLI OAuth Plugin for Opencode
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/opencode-antigravity-auth)
|
|
4
4
|
[](https://www.npmjs.com/package/opencode-antigravity-auth)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
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-high` and `claude-opus-4-5-thinking` with your Google credentials.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## What you get
|
|
10
10
|
|
|
11
|
+
- **Google OAuth sign-in** with automatic token refresh via `opencode auth login`
|
|
11
12
|
- **Dual Quota System** - Access both Antigravity quota (Claude, Gemini 3) and Gemini CLI quota from a single plugin
|
|
12
13
|
- **Multi-Account Rotation** - Add multiple Google accounts; automatically rotates when one is rate-limited
|
|
13
|
-
- **
|
|
14
|
+
- **Real-time SSE streaming** including thinking blocks and incremental output
|
|
14
15
|
- **Extended Thinking** - Native support for Claude thinking budgets and Gemini 3 thinking levels
|
|
15
16
|
- **Auto Recovery** - Automatic session recovery from Claude tool_result_missing errors
|
|
17
|
+
- **Plugin Compatible** - Works alongside other OpenCode plugins (opencodesync, etc.)
|
|
16
18
|
|
|
17
19
|
## Installation
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
npm install opencode-antigravity-auth
|
|
21
|
-
```
|
|
21
|
+
### For Humans
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
**Option A: Let an LLM do it**
|
|
24
|
+
|
|
25
|
+
Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
|
|
24
26
|
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
"plugin": ["opencode-antigravity-auth@beta"]
|
|
28
|
-
}
|
|
27
|
+
```
|
|
28
|
+
Install the opencode-antigravity-auth plugin and add the Antigravity model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/anthropics/opencode-antigravity-auth/dev/README.md
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
**Option B: Manual setup**
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
<summary>Installation Guide for LLM Agents</summary>
|
|
33
|
+
1. **Add the plugin to your config** (`~/.config/opencode/opencode.json`):
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"plugin": ["opencode-antigravity-auth@1.2.7"]
|
|
38
|
+
}
|
|
39
|
+
```
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
- Linux/Mac: `~/.config/opencode/opencode.json`
|
|
40
|
-
- Windows: `%APPDATA%\opencode\opencode.json`
|
|
41
|
+
2. **Authenticate:**
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
```bash
|
|
44
|
+
opencode auth login
|
|
45
|
+
```
|
|
43
46
|
|
|
44
|
-
3.
|
|
47
|
+
3. **Add models** (see [Available Models](#available-models) for full list):
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"plugin": ["opencode-antigravity-auth@1.2.7"],
|
|
52
|
+
"provider": {
|
|
53
|
+
"google": {
|
|
54
|
+
"models": {
|
|
55
|
+
"antigravity-claude-sonnet-4-5": {
|
|
56
|
+
"name": "Claude Sonnet 4.5 (Antigravity)",
|
|
57
|
+
"limit": { "context": 200000, "output": 64000 },
|
|
58
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
47
65
|
|
|
48
|
-
|
|
49
|
-
```jsonc
|
|
50
|
-
{
|
|
51
|
-
// JSON Schema for IDE autocompletion
|
|
52
|
-
"$schema": "https://raw.githubusercontent.com/anthropics/opencode-antigravity-auth/main/assets/antigravity.schema.json",
|
|
66
|
+
4. **Use it:**
|
|
53
67
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"log_dir": "/custom/log/path", // Custom debug log directory (optional)
|
|
58
|
-
"auto_update": true, // Auto-update plugin
|
|
68
|
+
```bash
|
|
69
|
+
opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5
|
|
70
|
+
```
|
|
59
71
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// === Session Recovery ===
|
|
64
|
-
"session_recovery": true, // Auto-recover from tool_result_missing errors
|
|
65
|
-
"auto_resume": true, // Auto-send "continue" after recovery
|
|
66
|
-
"resume_text": "continue", // Custom resume prompt text
|
|
72
|
+
<details>
|
|
73
|
+
<summary><b>Installation Guide for LLM Agents</b></summary>
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
"empty_response_max_attempts": 4, // Max retries for empty responses
|
|
70
|
-
"empty_response_retry_delay_ms": 2000, // Delay between retries (ms)
|
|
75
|
+
### Step-by-Step Instructions
|
|
71
76
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
1. Edit the OpenCode configuration file:
|
|
78
|
+
- Linux/Mac: `~/.config/opencode/opencode.json`
|
|
79
|
+
- Windows: `%APPDATA%\opencode\opencode.json`
|
|
75
80
|
|
|
76
|
-
|
|
77
|
-
"proactive_token_refresh": true, // Background token refresh
|
|
78
|
-
"proactive_refresh_buffer_seconds": 1800, // Refresh 30min before expiry
|
|
79
|
-
"proactive_refresh_check_interval_seconds": 300, // Check every 5min
|
|
81
|
+
2. Add the plugin to the `plugins` array
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
"max_rate_limit_wait_seconds": 300, // Max wait time when rate limited (0=unlimited)
|
|
83
|
-
"quota_fallback": false, // Try alternate quota when rate limited
|
|
83
|
+
3. Set `provider` to `"google"` and choose a model
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
"signature_cache": {
|
|
87
|
-
"enabled": true,
|
|
88
|
-
"memory_ttl_seconds": 3600, // 1 hour in-memory
|
|
89
|
-
"disk_ttl_seconds": 172800, // 48 hours on disk
|
|
90
|
-
"write_interval_seconds": 60 // Background write interval
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
```
|
|
85
|
+
### Complete Configuration Example
|
|
94
86
|
|
|
95
|
-
Create `~/.config/opencode/opencode.json
|
|
96
|
-
```
|
|
87
|
+
Create `~/.config/opencode/opencode.json`:
|
|
88
|
+
```json
|
|
97
89
|
{
|
|
98
90
|
"$schema": "https://opencode.ai/config.json",
|
|
99
|
-
"plugin": [
|
|
100
|
-
"opencode-antigravity-auth@beta"
|
|
101
|
-
],
|
|
91
|
+
"plugin": ["opencode-antigravity-auth@1.2.7"],
|
|
102
92
|
"provider": {
|
|
103
93
|
"google": {
|
|
104
94
|
"models": {
|
|
@@ -117,6 +107,21 @@ Create `~/.config/opencode/opencode.json`
|
|
|
117
107
|
"limit": { "context": 1048576, "output": 65536 },
|
|
118
108
|
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
119
109
|
},
|
|
110
|
+
"gemini-3-pro-low": {
|
|
111
|
+
"name": "Gemini 3 Pro Low (Antigravity)",
|
|
112
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
113
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
114
|
+
},
|
|
115
|
+
"gemini-3-pro-high": {
|
|
116
|
+
"name": "Gemini 3 Pro High (Antigravity)",
|
|
117
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
118
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
119
|
+
},
|
|
120
|
+
"gemini-3-flash": {
|
|
121
|
+
"name": "Gemini 3 Flash (Antigravity)",
|
|
122
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
123
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
124
|
+
},
|
|
120
125
|
"antigravity-claude-sonnet-4-5": {
|
|
121
126
|
"name": "Claude Sonnet 4.5 (Antigravity)",
|
|
122
127
|
"limit": { "context": 200000, "output": 64000 },
|
|
@@ -158,9 +163,11 @@ Create `~/.config/opencode/opencode.json`
|
|
|
158
163
|
}
|
|
159
164
|
```
|
|
160
165
|
|
|
161
|
-
###
|
|
166
|
+
### Verification
|
|
162
167
|
|
|
163
|
-
|
|
168
|
+
```bash
|
|
169
|
+
opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5
|
|
170
|
+
```
|
|
164
171
|
|
|
165
172
|
</details>
|
|
166
173
|
|
|
@@ -183,27 +190,26 @@ Models with `antigravity-` prefix use Antigravity quota:
|
|
|
183
190
|
| `google/antigravity-claude-opus-4-5-thinking-medium` | Opus with 16K thinking budget |
|
|
184
191
|
| `google/antigravity-claude-opus-4-5-thinking-high` | Opus with 32K thinking budget |
|
|
185
192
|
|
|
193
|
+
> **Backward compatibility:** Old model names (`gemini-3-pro-low`, `gemini-3-pro-high`, `gemini-3-flash`) still work as a fallback. However, you should update to the `antigravity-` prefix for stability. See [Migration Guide](#migration-guide-v127).
|
|
194
|
+
|
|
186
195
|
### Gemini CLI Quota
|
|
187
196
|
|
|
188
|
-
Models
|
|
197
|
+
Models with `-preview` suffix use Gemini CLI quota:
|
|
189
198
|
|
|
190
199
|
| Model | Description |
|
|
191
200
|
|-------|-------------|
|
|
192
201
|
| `google/gemini-2.5-flash` | Gemini 2.5 Flash |
|
|
193
202
|
| `google/gemini-2.5-pro` | Gemini 2.5 Pro |
|
|
194
|
-
| `google/gemini-3-flash` | Gemini 3 Flash |
|
|
195
|
-
| `google/gemini-3-pro-
|
|
196
|
-
| `google/gemini-3-pro-high` | Gemini 3 Pro with high thinking |
|
|
203
|
+
| `google/gemini-3-flash-preview` | Gemini 3 Flash (preview) |
|
|
204
|
+
| `google/gemini-3-pro-preview` | Gemini 3 Pro (preview) |
|
|
197
205
|
|
|
198
206
|
<details>
|
|
199
|
-
<summary>Full models configuration</summary>
|
|
207
|
+
<summary><b>Full models configuration</b></summary>
|
|
200
208
|
|
|
201
|
-
```
|
|
209
|
+
```json
|
|
202
210
|
{
|
|
203
211
|
"$schema": "https://opencode.ai/config.json",
|
|
204
|
-
"plugin": [
|
|
205
|
-
"opencode-antigravity-auth@latest"
|
|
206
|
-
],
|
|
212
|
+
"plugin": ["opencode-antigravity-auth@1.2.7"],
|
|
207
213
|
"provider": {
|
|
208
214
|
"google": {
|
|
209
215
|
"models": {
|
|
@@ -222,6 +228,21 @@ Models without `antigravity-` prefix use Gemini CLI quota:
|
|
|
222
228
|
"limit": { "context": 1048576, "output": 65536 },
|
|
223
229
|
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
224
230
|
},
|
|
231
|
+
"gemini-3-pro-low": {
|
|
232
|
+
"name": "Gemini 3 Pro Low (Antigravity)",
|
|
233
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
234
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
235
|
+
},
|
|
236
|
+
"gemini-3-pro-high": {
|
|
237
|
+
"name": "Gemini 3 Pro High (Antigravity)",
|
|
238
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
239
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
240
|
+
},
|
|
241
|
+
"gemini-3-flash": {
|
|
242
|
+
"name": "Gemini 3 Flash (Antigravity)",
|
|
243
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
244
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
245
|
+
},
|
|
225
246
|
"antigravity-claude-sonnet-4-5": {
|
|
226
247
|
"name": "Claude Sonnet 4.5 (Antigravity)",
|
|
227
248
|
"limit": { "context": 200000, "output": 64000 },
|
|
@@ -256,194 +277,231 @@ Models without `antigravity-` prefix use Gemini CLI quota:
|
|
|
256
277
|
"name": "Claude Opus 4.5 Think High (Antigravity)",
|
|
257
278
|
"limit": { "context": 200000, "output": 64000 },
|
|
258
279
|
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
280
|
+
},
|
|
281
|
+
"gemini-2.5-flash": {
|
|
282
|
+
"name": "Gemini 2.5 Flash (CLI)",
|
|
283
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
284
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
285
|
+
},
|
|
286
|
+
"gemini-2.5-pro": {
|
|
287
|
+
"name": "Gemini 2.5 Pro (CLI)",
|
|
288
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
289
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
290
|
+
},
|
|
291
|
+
"gemini-3-flash-preview": {
|
|
292
|
+
"name": "Gemini 3 Flash Preview (CLI)",
|
|
293
|
+
"limit": { "context": 1048576, "output": 65536 },
|
|
294
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
295
|
+
},
|
|
296
|
+
"gemini-3-pro-preview": {
|
|
297
|
+
"name": "Gemini 3 Pro Preview (CLI)",
|
|
298
|
+
"limit": { "context": 1048576, "output": 65535 },
|
|
299
|
+
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
259
300
|
}
|
|
260
301
|
}
|
|
261
302
|
}
|
|
262
303
|
}
|
|
263
304
|
}
|
|
264
305
|
```
|
|
265
|
-
</details>
|
|
266
306
|
|
|
267
|
-
|
|
307
|
+
</details>
|
|
268
308
|
|
|
309
|
+
## Multi-Account Setup
|
|
269
310
|
|
|
270
|
-
|
|
311
|
+
Add multiple Google accounts for higher combined quotas. The plugin automatically rotates between accounts when one is rate-limited.
|
|
271
312
|
|
|
272
313
|
```bash
|
|
273
|
-
|
|
274
|
-
OPENCODE_ANTIGRAVITY_DEBUG=1 # debug
|
|
275
|
-
OPENCODE_ANTIGRAVITY_LOG_DIR=/path # log_dir
|
|
276
|
-
OPENCODE_ANTIGRAVITY_KEEP_THINKING=1 # keep_thinking
|
|
314
|
+
opencode auth login
|
|
277
315
|
```
|
|
278
316
|
|
|
279
317
|
<details>
|
|
280
|
-
<summary>
|
|
318
|
+
<summary><b>How multi-account works</b></summary>
|
|
281
319
|
|
|
282
|
-
|
|
283
|
-
{
|
|
284
|
-
// JSON Schema for IDE autocompletion
|
|
285
|
-
"$schema": "https://raw.githubusercontent.com/anthropics/opencode-antigravity-auth/main/assets/antigravity.schema.json",
|
|
320
|
+
### Load Balancing Behavior
|
|
286
321
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
322
|
+
- **Sticky account selection** - Sticks to the same account until rate-limited (preserves Anthropic's prompt cache)
|
|
323
|
+
- **Per-model-family limits** - Rate limits tracked separately for Claude and Gemini models
|
|
324
|
+
- **Dual quota pools for Gemini** - Automatic fallback between Antigravity quota and Gemini CLI quota before switching accounts
|
|
325
|
+
- **Smart retry threshold** - Short rate limits (≤5s) are retried on same account
|
|
326
|
+
- **Exponential backoff** - Increasing delays for consecutive rate limits
|
|
292
327
|
|
|
293
|
-
|
|
294
|
-
"keep_thinking": false, // Preserve thinking blocks (may cause signature errors)
|
|
328
|
+
### Dual Quota Pools (Gemini only)
|
|
295
329
|
|
|
296
|
-
|
|
297
|
-
"session_recovery": true, // Auto-recover from tool_result_missing errors
|
|
298
|
-
"auto_resume": true, // Auto-send "continue" after recovery
|
|
299
|
-
"resume_text": "continue", // Custom resume prompt text
|
|
330
|
+
For Gemini models, the plugin accesses **two independent quota pools** per account:
|
|
300
331
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
332
|
+
| Quota Pool | When Used |
|
|
333
|
+
|------------|-----------|
|
|
334
|
+
| **Antigravity** | Primary (tried first) |
|
|
335
|
+
| **Gemini CLI** | Fallback when Antigravity is rate-limited |
|
|
304
336
|
|
|
305
|
-
|
|
306
|
-
"tool_id_recovery": true, // Fix mismatched tool IDs from context compaction
|
|
307
|
-
"claude_tool_hardening": true, // Prevent Claude tool hallucinations
|
|
337
|
+
This effectively **doubles your Gemini quota** per account.
|
|
308
338
|
|
|
309
|
-
|
|
310
|
-
"proactive_token_refresh": true, // Background token refresh
|
|
311
|
-
"proactive_refresh_buffer_seconds": 1800, // Refresh 30min before expiry
|
|
312
|
-
"proactive_refresh_check_interval_seconds": 300, // Check every 5min
|
|
339
|
+
### Adding Accounts
|
|
313
340
|
|
|
314
|
-
|
|
315
|
-
"max_rate_limit_wait_seconds": 300, // Max wait time when rate limited (0=unlimited)
|
|
316
|
-
"quota_fallback": false, // Try alternate quota when rate limited
|
|
341
|
+
When running `opencode auth login` with existing accounts:
|
|
317
342
|
|
|
318
|
-
// === Signature Cache (for keep_thinking=true) ===
|
|
319
|
-
"signature_cache": {
|
|
320
|
-
"enabled": true,
|
|
321
|
-
"memory_ttl_seconds": 3600, // 1 hour in-memory
|
|
322
|
-
"disk_ttl_seconds": 172800, // 48 hours on disk
|
|
323
|
-
"write_interval_seconds": 60 // Background write interval
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
343
|
```
|
|
344
|
+
2 account(s) saved:
|
|
345
|
+
1. user1@gmail.com
|
|
346
|
+
2. user2@gmail.com
|
|
347
|
+
|
|
348
|
+
(a)dd new account(s) or (f)resh start? [a/f]:
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Account Storage
|
|
352
|
+
|
|
353
|
+
- Stored in `~/.config/opencode/antigravity-accounts.json`
|
|
354
|
+
- Contains OAuth refresh tokens - **treat like a password**
|
|
355
|
+
- If Google revokes a token (`invalid_grant`), that account is automatically removed
|
|
327
356
|
|
|
328
357
|
</details>
|
|
329
358
|
|
|
330
|
-
##
|
|
359
|
+
## Configuration
|
|
331
360
|
|
|
332
|
-
|
|
361
|
+
Create `~/.config/opencode/antigravity.json` (or `.opencode/antigravity.json` in project root):
|
|
362
|
+
|
|
363
|
+
### General Settings
|
|
364
|
+
|
|
365
|
+
| Option | Default | Description |
|
|
366
|
+
|--------|---------|-------------|
|
|
367
|
+
| `quiet_mode` | `false` | Suppress toast notifications (except recovery) |
|
|
368
|
+
| `debug` | `false` | Enable debug logging to file |
|
|
369
|
+
| `log_dir` | OS default | Custom directory for debug logs |
|
|
370
|
+
| `auto_update` | `true` | Enable automatic plugin updates |
|
|
371
|
+
|
|
372
|
+
### Session Recovery
|
|
373
|
+
|
|
374
|
+
| Option | Default | Description |
|
|
375
|
+
|--------|---------|-------------|
|
|
376
|
+
| `session_recovery` | `true` | Auto-recover from tool_result_missing errors |
|
|
377
|
+
| `auto_resume` | `true` | Auto-send resume prompt after recovery |
|
|
378
|
+
| `resume_text` | `"continue"` | Text to send when auto-resuming |
|
|
379
|
+
|
|
380
|
+
### Error Recovery
|
|
381
|
+
|
|
382
|
+
| Option | Default | Description |
|
|
383
|
+
|--------|---------|-------------|
|
|
384
|
+
| `empty_response_max_attempts` | `4` | Retries for empty API responses |
|
|
385
|
+
| `empty_response_retry_delay_ms` | `2000` | Delay between retries |
|
|
386
|
+
| `tool_id_recovery` | `true` | Fix mismatched tool IDs from context compaction |
|
|
387
|
+
| `claude_tool_hardening` | `true` | Prevent tool parameter hallucination |
|
|
388
|
+
|
|
389
|
+
### Token Management
|
|
390
|
+
|
|
391
|
+
| Option | Default | Description |
|
|
392
|
+
|--------|---------|-------------|
|
|
393
|
+
| `proactive_token_refresh` | `true` | Refresh tokens before expiry |
|
|
394
|
+
| `proactive_refresh_buffer_seconds` | `1800` | Refresh 30min before expiry |
|
|
395
|
+
| `max_rate_limit_wait_seconds` | `300` | Max wait time when rate limited (0=unlimited) |
|
|
396
|
+
| `quota_fallback` | `false` | Try alternate quota when rate limited |
|
|
397
|
+
|
|
398
|
+
### Environment Overrides
|
|
333
399
|
|
|
334
400
|
```bash
|
|
335
|
-
#
|
|
336
|
-
|
|
401
|
+
OPENCODE_ANTIGRAVITY_QUIET=1 # quiet_mode
|
|
402
|
+
OPENCODE_ANTIGRAVITY_DEBUG=1 # debug
|
|
403
|
+
OPENCODE_ANTIGRAVITY_LOG_DIR=/path # log_dir
|
|
404
|
+
OPENCODE_ANTIGRAVITY_KEEP_THINKING=1 # keep_thinking
|
|
337
405
|
```
|
|
338
406
|
|
|
339
|
-
|
|
407
|
+
<details>
|
|
408
|
+
<summary><b>Full configuration example</b></summary>
|
|
340
409
|
|
|
341
|
-
|
|
410
|
+
```json
|
|
411
|
+
{
|
|
412
|
+
"$schema": "https://raw.githubusercontent.com/anthropics/opencode-antigravity-auth/main/assets/antigravity.schema.json",
|
|
413
|
+
"quiet_mode": false,
|
|
414
|
+
"debug": false,
|
|
415
|
+
"log_dir": "/custom/log/path",
|
|
416
|
+
"auto_update": true,
|
|
417
|
+
"keep_thinking": false,
|
|
418
|
+
"session_recovery": true,
|
|
419
|
+
"auto_resume": true,
|
|
420
|
+
"resume_text": "continue",
|
|
421
|
+
"empty_response_max_attempts": 4,
|
|
422
|
+
"empty_response_retry_delay_ms": 2000,
|
|
423
|
+
"tool_id_recovery": true,
|
|
424
|
+
"claude_tool_hardening": true,
|
|
425
|
+
"proactive_token_refresh": true,
|
|
426
|
+
"proactive_refresh_buffer_seconds": 1800,
|
|
427
|
+
"proactive_refresh_check_interval_seconds": 300,
|
|
428
|
+
"max_rate_limit_wait_seconds": 300,
|
|
429
|
+
"quota_fallback": false,
|
|
430
|
+
"signature_cache": {
|
|
431
|
+
"enabled": true,
|
|
432
|
+
"memory_ttl_seconds": 3600,
|
|
433
|
+
"disk_ttl_seconds": 172800,
|
|
434
|
+
"write_interval_seconds": 60
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
```
|
|
342
438
|
|
|
343
|
-
|
|
439
|
+
</details>
|
|
344
440
|
|
|
345
|
-
|
|
441
|
+
## Known Plugin Interactions
|
|
442
|
+
|
|
443
|
+
### @tarquinen/opencode-dcp
|
|
444
|
+
|
|
445
|
+
DCP creates synthetic assistant messages that lack thinking blocks. **Our plugin must be listed BEFORE DCP:**
|
|
346
446
|
|
|
347
447
|
```json
|
|
348
448
|
{
|
|
349
449
|
"plugin": [
|
|
350
450
|
"opencode-antigravity-auth@beta",
|
|
351
|
-
"@tarquinen/opencode-dcp@
|
|
451
|
+
"@tarquinen/opencode-dcp@latest",
|
|
352
452
|
]
|
|
353
453
|
}
|
|
354
454
|
```
|
|
355
455
|
|
|
456
|
+
### oh-my-opencode
|
|
457
|
+
|
|
458
|
+
When spawning parallel subagents, multiple processes may select the same account causing rate limit errors. **Workaround:** Add more accounts via `opencode auth login`.
|
|
459
|
+
|
|
356
460
|
### Plugins You Don't Need
|
|
357
461
|
|
|
358
462
|
- **gemini-auth plugins** - Not needed. This plugin handles all Google OAuth authentication.
|
|
359
463
|
|
|
360
|
-
|
|
464
|
+
<details>
|
|
465
|
+
<summary><b>Migration Guide (v1.2.7+)</b></summary>
|
|
361
466
|
|
|
362
|
-
|
|
467
|
+
If upgrading from v1.2.6 or earlier:
|
|
363
468
|
|
|
364
|
-
|
|
469
|
+
### What Changed
|
|
365
470
|
|
|
366
|
-
|
|
367
|
-
<summary>If upgrading from v1.2.6 or earlier, follow these steps:</summary>
|
|
471
|
+
v1.2.7+ uses explicit prefixes to distinguish quota sources:
|
|
368
472
|
|
|
369
|
-
|
|
473
|
+
| Model Type | New Name (Recommended) | Old Name (Still Works) |
|
|
474
|
+
|------------|------------------------|------------------------|
|
|
475
|
+
| Gemini 3 (Antigravity) | `antigravity-gemini-3-pro-low` | `gemini-3-pro-low` |
|
|
476
|
+
| Gemini 3 (Antigravity) | `antigravity-gemini-3-pro-high` | `gemini-3-pro-high` |
|
|
477
|
+
| Gemini 3 (Antigravity) | `antigravity-gemini-3-flash` | `gemini-3-flash` |
|
|
478
|
+
| Gemini 3 (CLI) | `gemini-3-pro-preview` | N/A |
|
|
479
|
+
| Claude | `antigravity-claude-sonnet-4-5` | `claude-sonnet-4-5` |
|
|
370
480
|
|
|
371
|
-
|
|
372
|
-
|
|
481
|
+
### Action Required
|
|
482
|
+
|
|
483
|
+
**Update your config to use `antigravity-` prefix:**
|
|
484
|
+
|
|
485
|
+
```diff
|
|
486
|
+
- "gemini-3-pro-low": { ... }
|
|
487
|
+
+ "antigravity-gemini-3-pro-low": { ... }
|
|
373
488
|
```
|
|
374
489
|
|
|
375
|
-
|
|
490
|
+
> **Why update?** Old names work now as a fallback, but this depends on Gemini CLI using `-preview` suffix. If Google removes `-preview` in the future, old names may route to the wrong quota. The `antigravity-` prefix is explicit and stable.
|
|
491
|
+
|
|
492
|
+
### Step 1: Clear Old Tokens (Optional - do this if you have issues calling models)
|
|
493
|
+
|
|
376
494
|
```bash
|
|
495
|
+
rm -rf ~/.config/opencode/antigravity-account.json
|
|
377
496
|
opencode auth login
|
|
378
497
|
```
|
|
379
498
|
|
|
380
499
|
### Step 2: Update opencode.json
|
|
381
500
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
```json
|
|
385
|
-
"provider": {
|
|
386
|
-
"google": {
|
|
387
|
-
"models": {
|
|
388
|
-
"antigravity-gemini-3-pro-low": {
|
|
389
|
-
"name": "Gemini 3 Pro Low (Antigravity)",
|
|
390
|
-
"limit": { "context": 1048576, "output": 65535 },
|
|
391
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
392
|
-
},
|
|
393
|
-
"antigravity-gemini-3-pro-high": {
|
|
394
|
-
"name": "Gemini 3 Pro High (Antigravity)",
|
|
395
|
-
"limit": { "context": 1048576, "output": 65535 },
|
|
396
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
397
|
-
},
|
|
398
|
-
"antigravity-gemini-3-flash": {
|
|
399
|
-
"name": "Gemini 3 Flash (Antigravity)",
|
|
400
|
-
"limit": { "context": 1048576, "output": 65536 },
|
|
401
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
402
|
-
},
|
|
403
|
-
"antigravity-claude-sonnet-4-5": {
|
|
404
|
-
"name": "Claude Sonnet 4.5 (Antigravity)",
|
|
405
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
406
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
407
|
-
},
|
|
408
|
-
"antigravity-claude-sonnet-4-5-thinking-low": {
|
|
409
|
-
"name": "Claude Sonnet 4.5 Think Low (Antigravity)",
|
|
410
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
411
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
412
|
-
},
|
|
413
|
-
"antigravity-claude-sonnet-4-5-thinking-medium": {
|
|
414
|
-
"name": "Claude Sonnet 4.5 Think Medium (Antigravity)",
|
|
415
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
416
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
417
|
-
},
|
|
418
|
-
"antigravity-claude-sonnet-4-5-thinking-high": {
|
|
419
|
-
"name": "Claude Sonnet 4.5 Think High (Antigravity)",
|
|
420
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
421
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
422
|
-
},
|
|
423
|
-
"antigravity-claude-opus-4-5-thinking-low": {
|
|
424
|
-
"name": "Claude Opus 4.5 Think Low (Antigravity)",
|
|
425
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
426
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
427
|
-
},
|
|
428
|
-
"antigravity-claude-opus-4-5-thinking-medium": {
|
|
429
|
-
"name": "Claude Opus 4.5 Think Medium (Antigravity)",
|
|
430
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
431
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
432
|
-
},
|
|
433
|
-
"antigravity-claude-opus-4-5-thinking-high": {
|
|
434
|
-
"name": "Claude Opus 4.5 Think High (Antigravity)",
|
|
435
|
-
"limit": { "context": 200000, "output": 64000 },
|
|
436
|
-
"modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
```
|
|
501
|
+
Models now use `antigravity-` prefix for Antigravity quota. See [Available Models](#available-models).
|
|
442
502
|
|
|
443
503
|
### Step 3: Create antigravity.json (Optional)
|
|
444
504
|
|
|
445
|
-
If you had custom settings, migrate them to `~/.config/opencode/antigravity.json`:
|
|
446
|
-
|
|
447
505
|
```json
|
|
448
506
|
{
|
|
449
507
|
"$schema": "https://raw.githubusercontent.com/anthropics/opencode-antigravity-auth/main/assets/antigravity.schema.json",
|
|
@@ -452,25 +510,10 @@ If you had custom settings, migrate them to `~/.config/opencode/antigravity.json
|
|
|
452
510
|
}
|
|
453
511
|
```
|
|
454
512
|
|
|
455
|
-
### Step 4: Re-authenticate
|
|
456
|
-
|
|
457
|
-
Run OpenCode once. A browser window will open for Google OAuth:
|
|
458
|
-
|
|
459
|
-
```bash
|
|
460
|
-
opencode
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
### Breaking Changes
|
|
464
|
-
|
|
465
|
-
| Old (v1.2.6) | New (v1.2.7+) |
|
|
466
|
-
|--------------|---------------|
|
|
467
|
-
| `OPENCODE_ANTIGRAVITY_*` env vars | `~/.config/opencode/antigravity.json` |
|
|
468
|
-
| `gemini-3-pro` | `google/antigravity-gemini-3-pro-low` |
|
|
469
|
-
| `claude-sonnet-4-5` | `google/antigravity-claude-sonnet-4-5` |
|
|
470
|
-
|
|
471
513
|
</details>
|
|
472
514
|
|
|
473
|
-
|
|
515
|
+
<details>
|
|
516
|
+
<summary><b>E2E Testing</b></summary>
|
|
474
517
|
|
|
475
518
|
The plugin includes regression tests for stability verification. Tests consume API quota.
|
|
476
519
|
|
|
@@ -478,10 +521,10 @@ The plugin includes regression tests for stability verification. Tests consume A
|
|
|
478
521
|
# Sanity tests (7 tests, ~5 min)
|
|
479
522
|
npx tsx script/test-regression.ts --sanity
|
|
480
523
|
|
|
481
|
-
# Heavy tests (4 tests, ~30 min)
|
|
524
|
+
# Heavy tests (4 tests, ~30 min)
|
|
482
525
|
npx tsx script/test-regression.ts --heavy
|
|
483
526
|
|
|
484
|
-
# Concurrent tests (3 tests)
|
|
527
|
+
# Concurrent tests (3 tests)
|
|
485
528
|
npx tsx script/test-regression.ts --category concurrency
|
|
486
529
|
|
|
487
530
|
# Run specific test
|
|
@@ -491,25 +534,61 @@ npx tsx script/test-regression.ts --test thinking-tool-use
|
|
|
491
534
|
npx tsx script/test-regression.ts --dry-run
|
|
492
535
|
```
|
|
493
536
|
|
|
494
|
-
|
|
537
|
+
</details>
|
|
495
538
|
|
|
496
|
-
|
|
539
|
+
## Debugging
|
|
497
540
|
|
|
498
541
|
```bash
|
|
499
|
-
#
|
|
500
|
-
OPENCODE_ANTIGRAVITY_DEBUG=
|
|
501
|
-
|
|
502
|
-
# Via config
|
|
503
|
-
echo '{"debug": true}' > ~/.config/opencode/antigravity.json
|
|
542
|
+
OPENCODE_ANTIGRAVITY_DEBUG=1 opencode # Basic logging
|
|
543
|
+
OPENCODE_ANTIGRAVITY_DEBUG=2 opencode # Verbose (full request/response bodies)
|
|
504
544
|
```
|
|
505
545
|
|
|
506
|
-
Logs are written to `~/.config/opencode/antigravity-logs
|
|
546
|
+
Logs are written to `~/.config/opencode/antigravity-logs/`.
|
|
507
547
|
|
|
508
548
|
## Documentation
|
|
509
549
|
|
|
510
550
|
- [Architecture](docs/ARCHITECTURE.md) - Plugin internals and request flow
|
|
511
551
|
- [API Spec](docs/ANTIGRAVITY_API_SPEC.md) - Antigravity API reference
|
|
512
552
|
|
|
553
|
+
<details>
|
|
554
|
+
<summary><b>Safety, Usage & Legal</b></summary>
|
|
555
|
+
|
|
556
|
+
### Intended Use
|
|
557
|
+
|
|
558
|
+
- Personal / internal development only
|
|
559
|
+
- Respect internal quotas and data handling policies
|
|
560
|
+
- Not for production services or bypassing intended limits
|
|
561
|
+
|
|
562
|
+
### Warning (Assumption of Risk)
|
|
563
|
+
|
|
564
|
+
By using this plugin, you acknowledge:
|
|
565
|
+
|
|
566
|
+
- **Terms of Service risk** - This approach may violate ToS of AI model providers
|
|
567
|
+
- **Account risk** - Providers may suspend or ban accounts
|
|
568
|
+
- **No guarantees** - APIs may change without notice
|
|
569
|
+
- **Assumption of risk** - You assume all legal, financial, and technical risks
|
|
570
|
+
|
|
571
|
+
### Legal
|
|
572
|
+
|
|
573
|
+
- Not affiliated with Google. This is an independent open-source project.
|
|
574
|
+
- "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
|
|
575
|
+
- Software is provided "as is", without warranty.
|
|
576
|
+
|
|
577
|
+
</details>
|
|
578
|
+
|
|
579
|
+
## Credits
|
|
580
|
+
|
|
581
|
+
Built with help from:
|
|
582
|
+
|
|
583
|
+
- [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) - Gemini OAuth groundwork by [@jenslys](https://github.com/jenslys)
|
|
584
|
+
- [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) - Antigravity API reference
|
|
585
|
+
|
|
586
|
+
## Support
|
|
587
|
+
|
|
588
|
+
If this plugin helps you, consider supporting its continued maintenance:
|
|
589
|
+
|
|
590
|
+
[](https://ko-fi.com/S6S81QBOIR)
|
|
591
|
+
|
|
513
592
|
## License
|
|
514
593
|
|
|
515
594
|
MIT
|