opencode-antigravity-auth 1.2.7-beta.0 → 1.2.7-beta.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.
Files changed (75) hide show
  1. package/README.md +295 -536
  2. package/dist/src/antigravity/oauth.d.ts.map +1 -1
  3. package/dist/src/antigravity/oauth.js +3 -1
  4. package/dist/src/antigravity/oauth.js.map +1 -1
  5. package/dist/src/constants.d.ts +8 -0
  6. package/dist/src/constants.d.ts.map +1 -1
  7. package/dist/src/constants.js +8 -0
  8. package/dist/src/constants.js.map +1 -1
  9. package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -1
  10. package/dist/src/hooks/auto-update-checker/index.js +4 -0
  11. package/dist/src/hooks/auto-update-checker/index.js.map +1 -1
  12. package/dist/src/plugin/accounts.d.ts +8 -2
  13. package/dist/src/plugin/accounts.d.ts.map +1 -1
  14. package/dist/src/plugin/accounts.js +23 -2
  15. package/dist/src/plugin/accounts.js.map +1 -1
  16. package/dist/src/plugin/auth.d.ts +6 -0
  17. package/dist/src/plugin/auth.d.ts.map +1 -1
  18. package/dist/src/plugin/auth.js +13 -0
  19. package/dist/src/plugin/auth.js.map +1 -1
  20. package/dist/src/plugin/config/schema.d.ts +26 -0
  21. package/dist/src/plugin/config/schema.d.ts.map +1 -1
  22. package/dist/src/plugin/config/schema.js +27 -0
  23. package/dist/src/plugin/config/schema.js.map +1 -1
  24. package/dist/src/plugin/core/streaming/index.d.ts +3 -0
  25. package/dist/src/plugin/core/streaming/index.d.ts.map +1 -0
  26. package/dist/src/plugin/core/streaming/index.js +3 -0
  27. package/dist/src/plugin/core/streaming/index.js.map +1 -0
  28. package/dist/src/plugin/core/streaming/transformer.d.ts +9 -0
  29. package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -0
  30. package/dist/src/plugin/core/streaming/transformer.js +134 -0
  31. package/dist/src/plugin/core/streaming/transformer.js.map +1 -0
  32. package/dist/src/plugin/core/streaming/types.d.ts +26 -0
  33. package/dist/src/plugin/core/streaming/types.d.ts.map +1 -0
  34. package/dist/src/plugin/core/streaming/types.js +1 -0
  35. package/dist/src/plugin/core/streaming/types.js.map +1 -0
  36. package/dist/src/plugin/logger.d.ts.map +1 -1
  37. package/dist/src/plugin/logger.js +3 -2
  38. package/dist/src/plugin/logger.js.map +1 -1
  39. package/dist/src/plugin/recovery.d.ts.map +1 -1
  40. package/dist/src/plugin/recovery.js +42 -14
  41. package/dist/src/plugin/recovery.js.map +1 -1
  42. package/dist/src/plugin/request-helpers.d.ts +51 -0
  43. package/dist/src/plugin/request-helpers.d.ts.map +1 -1
  44. package/dist/src/plugin/request-helpers.js +341 -19
  45. package/dist/src/plugin/request-helpers.js.map +1 -1
  46. package/dist/src/plugin/request.d.ts +50 -3
  47. package/dist/src/plugin/request.d.ts.map +1 -1
  48. package/dist/src/plugin/request.js +89 -177
  49. package/dist/src/plugin/request.js.map +1 -1
  50. package/dist/src/plugin/storage.d.ts +4 -0
  51. package/dist/src/plugin/storage.d.ts.map +1 -1
  52. package/dist/src/plugin/storage.js +70 -5
  53. package/dist/src/plugin/storage.js.map +1 -1
  54. package/dist/src/plugin/stores/signature-store.d.ts +5 -0
  55. package/dist/src/plugin/stores/signature-store.d.ts.map +1 -0
  56. package/dist/src/plugin/stores/signature-store.js +25 -0
  57. package/dist/src/plugin/stores/signature-store.js.map +1 -0
  58. package/dist/src/plugin/token.d.ts.map +1 -1
  59. package/dist/src/plugin/token.js +3 -2
  60. package/dist/src/plugin/token.js.map +1 -1
  61. package/dist/src/plugin/transform/claude.d.ts.map +1 -1
  62. package/dist/src/plugin/transform/claude.js +30 -8
  63. package/dist/src/plugin/transform/claude.js.map +1 -1
  64. package/dist/src/plugin/transform/model-resolver.d.ts +11 -4
  65. package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -1
  66. package/dist/src/plugin/transform/model-resolver.js +76 -19
  67. package/dist/src/plugin/transform/model-resolver.js.map +1 -1
  68. package/dist/src/plugin/transform/types.d.ts +5 -5
  69. package/dist/src/plugin/transform/types.d.ts.map +1 -1
  70. package/dist/src/plugin/transform/types.js +0 -5
  71. package/dist/src/plugin/transform/types.js.map +1 -1
  72. package/dist/src/plugin.d.ts.map +1 -1
  73. package/dist/src/plugin.js +230 -59
  74. package/dist/src/plugin.js.map +1 -1
  75. package/package.json +7 -3
package/README.md CHANGED
@@ -1,702 +1,461 @@
1
- # Antigravity + Gemini CLI OAuth Plugin for Opencode
1
+ # opencode-antigravity-auth
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/opencode-antigravity-auth.svg)](https://www.npmjs.com/package/opencode-antigravity-auth)
4
4
  [![npm beta](https://img.shields.io/npm/v/opencode-antigravity-auth/beta.svg?label=beta)](https://www.npmjs.com/package/opencode-antigravity-auth)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
6
 
6
- 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.
7
+ OpenCode plugin for Google Antigravity OAuth authentication.
7
8
 
8
- ## What you get
9
+ ## Features
9
10
 
10
- - **Google OAuth sign-in** (multi-account via `opencode auth login`) with automatic token refresh
11
- - **Multi-account load balancing** Automatically cycle through multiple Google accounts to maximize throughput
12
- - **Two quota sources for Gemini** Automatic fallback between **Antigravity quota** and **Gemini CLI quota** (same account) before switching accounts
13
- - **Real-time SSE streaming** including thinking blocks and incremental output
14
- - **Advanced Claude support** Interleaved thinking, stable multi-turn signatures, and validated tool calling
15
- - **Automatic endpoint fallback** between Antigravity API endpoints (daily → autopush → prod)
16
- - **Antigravity API compatibility** for OpenAI-style requests
17
- - **Debug logging** for requests and responses
18
- - **Drop-in setup** Opencode auto-installs the plugin from config
11
+ - **Dual Quota System** - Access both Antigravity quota (Claude, Gemini 3) and Gemini CLI quota from a single plugin
12
+ - **Multi-Account Rotation** - Add multiple Google accounts; automatically rotates when one is rate-limited
13
+ - **Plugin Compatible** - Works alongside other OpenCode plugins (opencodesync, etc.)
14
+ - **Extended Thinking** - Native support for Claude thinking budgets and Gemini 3 thinking levels
15
+ - **Auto Recovery** - Automatic session recovery from Claude tool_result_missing errors
19
16
 
20
17
  ## Installation
21
18
 
22
- ### For Humans
23
-
24
- **Option A: Let an LLM do it for you**
25
-
26
- Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
27
-
28
- ```
29
- Install the opencode-antigravity-auth plugin and add the Antigravity model definitions (see "Available models") to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/README.md
19
+ ```bash
20
+ npm install opencode-antigravity-auth
30
21
  ```
31
22
 
32
- If the agent only installs the plugin, ask it to also add models under `provider.google.models`.
33
-
34
- **Option B: Do it yourself**
35
-
36
- 1. **Add the plugin to your config:**
37
-
38
- ```bash
39
- mkdir -p ~/.config/opencode
40
- ```
41
-
42
- Create or edit `~/.config/opencode/opencode.json`:
43
-
44
- ```json
45
- {
46
- "plugin": ["opencode-antigravity-auth@1.2.4"]
47
- }
48
- ```
49
-
50
- 2. **Authenticate:**
51
-
52
- ```bash
53
- opencode auth login
54
- ```
23
+ Add to your OpenCode config (`~/.config/opencode/opencode.json`):
55
24
 
56
- Select **Google** → **OAuth with Google (Antigravity)** → Press Enter to skip Project ID → Sign in via browser.
57
-
58
- 3. **Add models to your config:**
59
-
60
- Add the models you want to use to the same config file:
61
-
62
- ```json
63
- {
64
- "plugin": ["opencode-antigravity-auth@1.2.4"],
65
- "provider": {
66
- "google": {
67
- "models": {
68
- "gemini-3-pro-high": {
69
- "name": "Gemini 3 Pro High (Antigravity)",
70
- "limit": { "context": 1048576, "output": 65535 },
71
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
72
- },
73
- "claude-sonnet-4-5": {
74
- "name": "Claude Sonnet 4.5 (Antigravity)",
75
- "limit": { "context": 200000, "output": 64000 },
76
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
77
- }
78
- }
79
- }
80
- }
81
- }
82
- ```
83
-
84
- > See [Available models](#available-models) for the full list.
85
-
86
- 4. **Use it:**
87
-
88
- ```bash
89
- opencode run "Hello" --model=google/gemini-3-pro-high
90
- ```
91
-
92
- ---
25
+ ```json
26
+ {
27
+ "plugins": ["opencode-antigravity-auth@latest"],
28
+ "provider": "google",
29
+ "model": "google/antigravity-gemini-3-flash"
30
+ }
31
+ ```
93
32
 
94
- ### For LLMs
33
+ On first run, a browser window opens for Google OAuth. Tokens are stored securely and refresh automatically.
95
34
 
96
35
  <details>
97
- <summary><b>🤖 Detailed Installation Guide for LLM Agents</b> (click to expand)</summary>
36
+ <summary>Installation Guide for LLM Agents</summary>
98
37
 
99
- If you're an LLM agent helping a user set up this plugin, follow these steps:
38
+ ### Step-by-Step Instructions
100
39
 
101
- #### Step 1: Verify OpenCode is installed
40
+ 1. Edit the OpenCode configuration file:
41
+ - Linux/Mac: `~/.config/opencode/opencode.json`
42
+ - Windows: `%APPDATA%\opencode\opencode.json`
102
43
 
103
- ```bash
104
- command -v opencode && opencode --version || echo "OpenCode not installed - see https://opencode.ai/docs"
105
- ```
106
-
107
- #### Step 2: Create or update the config
108
-
109
- ```bash
110
- mkdir -p ~/.config/opencode
111
-
112
- if [ -f ~/.config/opencode/opencode.json ]; then
113
- if command -v jq &> /dev/null; then
114
- jq '.plugin = ((.plugin // []) + ["opencode-antigravity-auth@1.2.4"] | unique)' \
115
- ~/.config/opencode/opencode.json > /tmp/oc.json && \
116
- mv /tmp/oc.json ~/.config/opencode/opencode.json
117
- else
118
- echo "Add \"opencode-antigravity-auth@1.2.4\" to the plugin array manually"
119
- fi
120
- else
121
- echo '{"plugin":["opencode-antigravity-auth@1.2.4"]}' > ~/.config/opencode/opencode.json
122
- fi
123
- ```
44
+ 2. Add the plugin to the `plugins` array
124
45
 
125
- #### Step 3: Ask user about multi-account setup
46
+ 3. Set `provider` to `"google"` and choose a model
126
47
 
127
- Before running `opencode auth login`, ask the user:
48
+ ### Complete Configuration Example
128
49
 
129
- > **Do you want to add multiple Google accounts for load balancing?**
130
- > - Adding 2-10 accounts maximizes rate limits and provides automatic failover
131
- > - You can always add more accounts later
50
+ Create `~/.config/opencode/antigravity.json`
51
+ ```jsonc
52
+ {
53
+ // JSON Schema for IDE autocompletion
54
+ "$schema": "https://raw.githubusercontent.com/anthropics/opencode-antigravity-auth/main/assets/antigravity.schema.json",
132
55
 
133
- Based on their answer:
134
- - **Yes, multiple accounts** After first login, prompt: "Sign in complete. Add another account? (up to 10 supported)"
135
- - **No, just one** Single account is fine, they can add more later with `opencode auth login`
56
+ // === General ===
57
+ "quiet_mode": false, // Suppress toast notifications (except recovery)
58
+ "debug": false, // Enable debug logging to file
59
+ "log_dir": "/custom/log/path", // Custom debug log directory (optional)
60
+ "auto_update": true, // Auto-update plugin
136
61
 
137
- #### Step 4: Run authentication
62
+ // === Thinking Blocks ===
63
+ "keep_thinking": false, // Preserve thinking blocks (may cause signature errors)
138
64
 
139
- Tell the user to run:
65
+ // === Session Recovery ===
66
+ "session_recovery": true, // Auto-recover from tool_result_missing errors
67
+ "auto_resume": true, // Auto-send "continue" after recovery
68
+ "resume_text": "continue", // Custom resume prompt text
140
69
 
141
- ```bash
142
- opencode auth login
143
- ```
70
+ // === Empty Response Handling ===
71
+ "empty_response_max_attempts": 4, // Max retries for empty responses
72
+ "empty_response_retry_delay_ms": 2000, // Delay between retries (ms)
144
73
 
145
- Guide them through the prompts:
146
- 1. Select **Google** as the provider
147
- 2. Select **OAuth with Google (Antigravity)**
148
- 3. **Project ID prompt** → Tell user: "Press Enter to skip (most users don't need this)"
149
- 4. Browser opens for Google sign-in
150
- 5. If multi-account: repeat for additional accounts, or press Enter to finish
74
+ // === Tool Handling ===
75
+ "tool_id_recovery": true, // Fix mismatched tool IDs from context compaction
76
+ "claude_tool_hardening": true, // Prevent Claude tool hallucinations
151
77
 
152
- #### Step 5: Add models to config
78
+ // === Token Refresh ===
79
+ "proactive_token_refresh": true, // Background token refresh
80
+ "proactive_refresh_buffer_seconds": 1800, // Refresh 30min before expiry
81
+ "proactive_refresh_check_interval_seconds": 300, // Check every 5min
153
82
 
154
- Merge model definitions into the user's config file (`~/.config/opencode/opencode.json`):
83
+ // === Rate Limiting ===
84
+ "max_rate_limit_wait_seconds": 300, // Max wait time when rate limited (0=unlimited)
85
+ "quota_fallback": false, // Try alternate quota when rate limited
155
86
 
156
- ```bash
157
- # If jq is available, merge models programmatically
158
- if command -v jq &> /dev/null; then
159
- jq '.provider.google.models = {
160
- "gemini-3-pro-low": {"name": "Gemini 3 Pro Low (Antigravity)", "limit": {"context": 1048576, "output": 65535}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
161
- "gemini-3-pro-high": {"name": "Gemini 3 Pro High (Antigravity)", "limit": {"context": 1048576, "output": 65535}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
162
- "gemini-3-flash": {"name": "Gemini 3 Flash (Antigravity)", "limit": {"context": 1048576, "output": 65536}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
163
- "claude-sonnet-4-5": {"name": "Claude Sonnet 4.5 (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
164
- "claude-sonnet-4-5-thinking-low": {"name": "Claude Sonnet 4.5 Thinking Low (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
165
- "claude-sonnet-4-5-thinking-medium": {"name": "Claude Sonnet 4.5 Thinking Medium (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
166
- "claude-sonnet-4-5-thinking-high": {"name": "Claude Sonnet 4.5 Thinking High (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
167
- "claude-opus-4-5-thinking-low": {"name": "Claude Opus 4.5 Thinking Low (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
168
- "claude-opus-4-5-thinking-medium": {"name": "Claude Opus 4.5 Thinking Medium (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
169
- "claude-opus-4-5-thinking-high": {"name": "Claude Opus 4.5 Thinking High (Antigravity)", "limit": {"context": 200000, "output": 64000}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}},
170
- "gpt-oss-120b-medium": {"name": "GPT-OSS 120B Medium (Antigravity)", "limit": {"context": 131072, "output": 32768}, "modalities": {"input": ["text", "image", "pdf"], "output": ["text"]}}
171
- } + (.provider.google.models // {})' ~/.config/opencode/opencode.json > /tmp/oc.json && mv /tmp/oc.json ~/.config/opencode/opencode.json
172
- fi
87
+ // === Signature Cache (for keep_thinking=true) ===
88
+ "signature_cache": {
89
+ "enabled": true,
90
+ "memory_ttl_seconds": 3600, // 1 hour in-memory
91
+ "disk_ttl_seconds": 172800, // 48 hours on disk
92
+ "write_interval_seconds": 60 // Background write interval
93
+ }
94
+ }
173
95
  ```
174
96
 
175
- Or edit the file manually and add the models from the [Available models](#available-models) section.
176
-
177
- #### Step 6: Verify setup
178
-
179
- ```bash
180
- opencode run "Hello" --model=google/gemini-3-pro-high
97
+ Create `~/.config/opencode/opencode.json`
98
+ ```jsonc
99
+ {
100
+ "$schema": "https://opencode.ai/config.json",
101
+ "plugin": [
102
+ "opencode-antigravity-auth@latest"
103
+ ],
104
+ "provider": {
105
+ "google": {
106
+ "models": {
107
+ "antigravity-gemini-3-pro-low": {
108
+ "name": "Gemini 3 Pro Low (Antigravity)",
109
+ "limit": { "context": 1048576, "output": 65535 },
110
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
111
+ },
112
+ "antigravity-gemini-3-pro-high": {
113
+ "name": "Gemini 3 Pro High (Antigravity)",
114
+ "limit": { "context": 1048576, "output": 65535 },
115
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
116
+ },
117
+ "antigravity-gemini-3-flash": {
118
+ "name": "Gemini 3 Flash (Antigravity)",
119
+ "limit": { "context": 1048576, "output": 65536 },
120
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
121
+ },
122
+ "antigravity-claude-sonnet-4-5": {
123
+ "name": "Claude Sonnet 4.5 (Antigravity)",
124
+ "limit": { "context": 200000, "output": 64000 },
125
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
126
+ },
127
+ "antigravity-claude-sonnet-4-5-thinking-low": {
128
+ "name": "Claude Sonnet 4.5 Think Low (Antigravity)",
129
+ "limit": { "context": 200000, "output": 64000 },
130
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
131
+ },
132
+ "antigravity-claude-sonnet-4-5-thinking-medium": {
133
+ "name": "Claude Sonnet 4.5 Think Medium (Antigravity)",
134
+ "limit": { "context": 200000, "output": 64000 },
135
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
136
+ },
137
+ "antigravity-claude-sonnet-4-5-thinking-high": {
138
+ "name": "Claude Sonnet 4.5 Think High (Antigravity)",
139
+ "limit": { "context": 200000, "output": 64000 },
140
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
141
+ },
142
+ "antigravity-claude-opus-4-5-thinking-low": {
143
+ "name": "Claude Opus 4.5 Think Low (Antigravity)",
144
+ "limit": { "context": 200000, "output": 64000 },
145
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
146
+ },
147
+ "antigravity-claude-opus-4-5-thinking-medium": {
148
+ "name": "Claude Opus 4.5 Think Medium (Antigravity)",
149
+ "limit": { "context": 200000, "output": 64000 },
150
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
151
+ },
152
+ "antigravity-claude-opus-4-5-thinking-high": {
153
+ "name": "Claude Opus 4.5 Think High (Antigravity)",
154
+ "limit": { "context": 200000, "output": 64000 },
155
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }
181
161
  ```
182
162
 
183
- If successful, tell the user: **"Setup complete! You can now use Antigravity models in OpenCode."**
184
-
185
- </details>
186
-
187
- ---
188
-
189
- ## Migration Guide
190
-
191
- ### Upgrading to v1.2.5
192
-
193
- Version 1.2.5 introduces significant reliability improvements for Claude models. No breaking changes—existing configurations continue to work.
194
-
195
- #### What's New
196
-
197
- | Feature | Description |
198
- |---------|-------------|
199
- | **Session Recovery** | Auto-recovers from `tool_result_missing` errors |
200
- | **Defense-in-Depth Tool Pairing** | Multi-layer fix for "Could not process tool results" errors |
201
- | **Proactive Token Refresh** | Refreshes tokens 30min before expiry to prevent mid-session failures |
202
- | **Signature Caching** | Persistent disk cache for thinking block signatures |
163
+ ### Beta Versions
203
164
 
204
- #### Upgrade Steps
165
+ For the latest development features, check the [dev branch README](https://github.com/anthropics/opencode-antigravity-auth/tree/dev) for beta installation instructions.
205
166
 
206
- 1. **Update the plugin version** in `~/.config/opencode/opencode.json`:
207
-
208
- ```json
209
- {
210
- "plugin": ["opencode-antigravity-auth@1.2.5"]
211
- }
212
- ```
213
-
214
- 2. **Update model names to new thinking budget format** (REQUIRED for thinking models):
215
-
216
- The old generic `-thinking` suffix is now replaced with explicit budget tiers:
217
-
218
- | Old Model ID (deprecated) | New Model ID | Thinking Budget |
219
- |---------------------------|--------------|-----------------|
220
- | `claude-sonnet-4-5-thinking` | `claude-sonnet-4-5-thinking-low` | 8,192 tokens |
221
- | `claude-sonnet-4-5-thinking` | `claude-sonnet-4-5-thinking-medium` | 16,384 tokens |
222
- | `claude-sonnet-4-5-thinking` | `claude-sonnet-4-5-thinking-high` | 32,768 tokens |
223
- | `claude-opus-4-5-thinking` | `claude-opus-4-5-thinking-low` | 8,192 tokens |
224
- | `claude-opus-4-5-thinking` | `claude-opus-4-5-thinking-medium` | 16,384 tokens |
225
- | `claude-opus-4-5-thinking` | `claude-opus-4-5-thinking-high` | 32,768 tokens |
226
-
227
- Update your `~/.config/opencode/opencode.json`:
228
-
229
- ```diff
230
- {
231
- "provider": {
232
- "google": {
233
- "models": {
234
- - "claude-sonnet-4-5-thinking": {
235
- - "name": "Claude Sonnet 4.5 Thinking (Antigravity)",
236
- + "claude-sonnet-4-5-thinking-medium": {
237
- + "name": "Claude Sonnet 4.5 Thinking Medium (Antigravity)",
238
- "limit": { "context": 200000, "output": 64000 },
239
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
240
- }
241
- }
242
- }
243
- }
244
- }
245
- ```
246
-
247
- > **Tip:** Use `-medium` as a balanced default. Use `-high` for complex reasoning tasks, `-low` for faster responses.
248
-
249
- 3. **Restart OpenCode** to load the new version:
250
-
251
- ```bash
252
- # If OpenCode is running, exit and restart
253
- opencode
254
- ```
255
-
256
- 4. **(Optional) Review new config options** in `~/.config/opencode/antigravity.json`:
257
-
258
- ```json
259
- {
260
- "session_recovery": true,
261
- "auto_resume": true,
262
- "resume_text": "continue",
263
- "tool_id_recovery": true,
264
- "claude_tool_hardening": true,
265
- "proactive_token_refresh": true,
266
- "signature_cache": {
267
- "enabled": true,
268
- "memory_ttl_seconds": 3600,
269
- "disk_ttl_seconds": 172800
270
- }
271
- }
272
- ```
273
-
274
- All new options are **enabled by default**—no action required for most users.
275
-
276
- #### Breaking Changes
277
-
278
- **None.** v1.2.5 is fully backward compatible.
279
-
280
- #### Troubleshooting
167
+ </details>
281
168
 
282
- | Issue | Solution |
283
- |-------|----------|
284
- | Signature errors after upgrade | Delete `~/.config/opencode/antigravity-signature-cache.json` and restart |
285
- | Recovery not triggering | Ensure `session_recovery: true` in config (default) |
286
- | Old version still loading | Clear npm cache: `npm cache clean --force` and restart OpenCode |
169
+ ## Available Models
287
170
 
288
- For detailed changes, see [docs/MILESTONE_v1.2.5.md](docs/MILESTONE_v1.2.5.md).
171
+ ### Antigravity Quota
289
172
 
290
- ---
173
+ Models with `antigravity-` prefix use Antigravity quota:
291
174
 
292
- ## Available models
175
+ | Model | Description |
176
+ |-------|-------------|
177
+ | `google/antigravity-gemini-3-flash` | Gemini 3 Flash (minimal thinking) |
178
+ | `google/antigravity-gemini-3-pro-low` | Gemini 3 Pro with low thinking |
179
+ | `google/antigravity-gemini-3-pro-high` | Gemini 3 Pro with high thinking |
180
+ | `google/antigravity-claude-sonnet-4-5` | Claude Sonnet 4.5 (no thinking) |
181
+ | `google/antigravity-claude-sonnet-4-5-thinking-low` | Sonnet with 8K thinking budget |
182
+ | `google/antigravity-claude-sonnet-4-5-thinking-medium` | Sonnet with 16K thinking budget |
183
+ | `google/antigravity-claude-sonnet-4-5-thinking-high` | Sonnet with 32K thinking budget |
184
+ | `google/antigravity-claude-opus-4-5-thinking-low` | Opus with 8K thinking budget |
185
+ | `google/antigravity-claude-opus-4-5-thinking-medium` | Opus with 16K thinking budget |
186
+ | `google/antigravity-claude-opus-4-5-thinking-high` | Opus with 32K thinking budget |
293
187
 
294
- Add these models to your `~/.config/opencode/opencode.json` under `provider.google.models`:
295
-
296
- ### Gemini Models
297
-
298
- | Model ID | Description | Thinking |
299
- |----------|-------------|----------|
300
- | `gemini-3-pro-low` | Gemini 3 Pro (low thinking) | thinkingLevel: "low" |
301
- | `gemini-3-pro-high` | Gemini 3 Pro (high thinking) | thinkingLevel: "high" |
302
- | `gemini-3-flash` | Gemini 3 Flash | Default |
188
+ ### Gemini CLI Quota
303
189
 
304
- ### Claude Models
190
+ Models without `antigravity-` prefix use Gemini CLI quota:
305
191
 
306
- | Model ID | Description | Thinking Budget |
307
- |----------|-------------|-----------------|
308
- | `claude-sonnet-4-5` | Claude Sonnet 4.5 (no thinking) | None |
309
- | `claude-sonnet-4-5-thinking-low` | Claude Sonnet 4.5 Thinking | 8,192 tokens |
310
- | `claude-sonnet-4-5-thinking-medium` | Claude Sonnet 4.5 Thinking | 16,384 tokens |
311
- | `claude-sonnet-4-5-thinking-high` | Claude Sonnet 4.5 Thinking | 32,768 tokens |
312
- | `claude-opus-4-5-thinking-low` | Claude Opus 4.5 Thinking | 8,192 tokens |
313
- | `claude-opus-4-5-thinking-medium` | Claude Opus 4.5 Thinking | 16,384 tokens |
314
- | `claude-opus-4-5-thinking-high` | Claude Opus 4.5 Thinking | 32,768 tokens |
315
-
316
- ### Other Models
317
-
318
- | Model ID | Description |
319
- |----------|-------------|
320
- | `gpt-oss-120b-medium` | GPT-OSS 120B Medium |
321
-
322
- > **Tier suffixes:** Use `-low`, `-medium`, or `-high` to control thinking budget. Higher tiers = more reasoning tokens.
192
+ | Model | Description |
193
+ |-------|-------------|
194
+ | `google/gemini-2.5-flash` | Gemini 2.5 Flash |
195
+ | `google/gemini-2.5-pro` | Gemini 2.5 Pro |
196
+ | `google/gemini-3-flash` | Gemini 3 Flash |
197
+ | `google/gemini-3-pro-low` | Gemini 3 Pro with low thinking |
198
+ | `google/gemini-3-pro-high` | Gemini 3 Pro with high thinking |
323
199
 
324
200
  <details>
325
- <summary><b>Full model configuration</b> (click to expand)</summary>
201
+ <summary>Full models configuration</summary>
326
202
 
327
- ```json
203
+ ```jsonc
328
204
  {
205
+ "$schema": "https://opencode.ai/config.json",
206
+ "plugin": [
207
+ "opencode-antigravity-auth@latest"
208
+ ],
329
209
  "provider": {
330
210
  "google": {
331
211
  "models": {
332
- "gemini-3-pro-low": {
212
+ "antigravity-gemini-3-pro-low": {
333
213
  "name": "Gemini 3 Pro Low (Antigravity)",
334
214
  "limit": { "context": 1048576, "output": 65535 },
335
215
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
336
216
  },
337
- "gemini-3-pro-high": {
217
+ "antigravity-gemini-3-pro-high": {
338
218
  "name": "Gemini 3 Pro High (Antigravity)",
339
219
  "limit": { "context": 1048576, "output": 65535 },
340
220
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
341
221
  },
342
- "gemini-3-flash": {
222
+ "antigravity-gemini-3-flash": {
343
223
  "name": "Gemini 3 Flash (Antigravity)",
344
224
  "limit": { "context": 1048576, "output": 65536 },
345
225
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
346
226
  },
347
- "claude-sonnet-4-5": {
227
+ "antigravity-claude-sonnet-4-5": {
348
228
  "name": "Claude Sonnet 4.5 (Antigravity)",
349
229
  "limit": { "context": 200000, "output": 64000 },
350
230
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
351
231
  },
352
- "claude-sonnet-4-5-thinking-low": {
353
- "name": "Claude Sonnet 4.5 Thinking Low (Antigravity)",
232
+ "antigravity-claude-sonnet-4-5-thinking-low": {
233
+ "name": "Claude Sonnet 4.5 Think Low (Antigravity)",
354
234
  "limit": { "context": 200000, "output": 64000 },
355
235
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
356
236
  },
357
- "claude-sonnet-4-5-thinking-medium": {
358
- "name": "Claude Sonnet 4.5 Thinking Medium (Antigravity)",
237
+ "antigravity-claude-sonnet-4-5-thinking-medium": {
238
+ "name": "Claude Sonnet 4.5 Think Medium (Antigravity)",
359
239
  "limit": { "context": 200000, "output": 64000 },
360
240
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
361
241
  },
362
- "claude-sonnet-4-5-thinking-high": {
363
- "name": "Claude Sonnet 4.5 Thinking High (Antigravity)",
242
+ "antigravity-claude-sonnet-4-5-thinking-high": {
243
+ "name": "Claude Sonnet 4.5 Think High (Antigravity)",
364
244
  "limit": { "context": 200000, "output": 64000 },
365
245
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
366
246
  },
367
- "claude-opus-4-5-thinking-low": {
368
- "name": "Claude Opus 4.5 Thinking Low (Antigravity)",
247
+ "antigravity-claude-opus-4-5-thinking-low": {
248
+ "name": "Claude Opus 4.5 Think Low (Antigravity)",
369
249
  "limit": { "context": 200000, "output": 64000 },
370
250
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
371
251
  },
372
- "claude-opus-4-5-thinking-medium": {
373
- "name": "Claude Opus 4.5 Thinking Medium (Antigravity)",
252
+ "antigravity-claude-opus-4-5-thinking-medium": {
253
+ "name": "Claude Opus 4.5 Think Medium (Antigravity)",
374
254
  "limit": { "context": 200000, "output": 64000 },
375
255
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
376
256
  },
377
- "claude-opus-4-5-thinking-high": {
378
- "name": "Claude Opus 4.5 Thinking High (Antigravity)",
257
+ "antigravity-claude-opus-4-5-thinking-high": {
258
+ "name": "Claude Opus 4.5 Think High (Antigravity)",
379
259
  "limit": { "context": 200000, "output": 64000 },
380
260
  "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
381
- },
382
- "gpt-oss-120b-medium": {
383
- "name": "GPT-OSS 120B Medium (Antigravity)",
384
- "limit": { "context": 131072, "output": 32768 },
385
- "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
386
261
  }
387
262
  }
388
263
  }
389
264
  }
390
265
  }
391
266
  ```
392
-
393
267
  </details>
394
268
 
395
- ## Multi-account load balancing
396
-
397
- The plugin supports multiple Google accounts to maximize rate limits and provide automatic failover.
398
-
399
- ### How it works
400
-
401
- - **Sticky account selection:** The plugin sticks to the same account for all requests until it hits a rate limit. This preserves Anthropic's prompt cache, which is organization-scoped.
402
- - **Per-model-family rate limits:** Rate limits are tracked separately for Claude and Gemini models. If an account is rate-limited for Claude, it can still be used for Gemini requests.
403
- - **Dual quota pools for Gemini:** Gemini models have access to two separate quota pools (Antigravity and Gemini CLI). When one pool is exhausted, the plugin automatically switches to the other before trying a different account.
404
- - **Smart retry threshold:** Short rate limits (≤5s) are retried on the same account to avoid unnecessary switching.
405
- - **Exponential backoff:** Consecutive rate limits trigger exponential backoff with increasing delays.
406
- - **Quota-aware messages:** Rate limit toasts show quota reset times when available from the API.
407
- - **Automatic failover:** On HTTP `429` (rate limit), the plugin automatically switches to the next available account for that model family.
408
- - **Smart cooldown:** Rate-limited accounts are temporarily cooled down and automatically become available again after the cooldown expires.
409
- - **Single-account retry:** If you only have one account, the plugin waits for the rate limit to reset and retries automatically.
410
- - **Debounced notifications:** Toast notifications are debounced to avoid spam during streaming responses.
411
-
412
- ### Dual quota pools (Gemini only)
413
-
414
- For Gemini models, the plugin can access **two independent quota pools** using the same Google account:
415
-
416
- | Quota Pool | Headers Used | When Used |
417
- |------------|--------------|-----------|
418
- | **Antigravity** | Antigravity headers | Primary (tried first) |
419
- | **Gemini CLI** | Gemini CLI headers | Fallback when Antigravity is rate-limited |
420
-
421
- This effectively **doubles your Gemini quota** per account.
422
-
423
- **How it works:**
424
- 1. Plugin tries Antigravity quota first
425
- 2. If rate-limited (429), it automatically retries using Gemini CLI headers
426
- 3. Only if **both** pools are exhausted does it switch to the next account
427
- 4. This happens seamlessly — conversation context is preserved when switching between quota pools.
428
-
429
- > **Note:** Claude models only work with Antigravity headers, so this dual-pool fallback only applies to Gemini models.
269
+ ## Configuration
430
270
 
431
- ### Quiet mode
432
271
 
433
- To suppress account-related toast notifications (useful for streaming/recording):
272
+ ### Environment Overrides
434
273
 
435
274
  ```bash
436
- export OPENCODE_ANTIGRAVITY_QUIET=1
275
+ OPENCODE_ANTIGRAVITY_QUIET=1 # quiet_mode
276
+ OPENCODE_ANTIGRAVITY_DEBUG=1 # debug
277
+ OPENCODE_ANTIGRAVITY_LOG_DIR=/path # log_dir
278
+ OPENCODE_ANTIGRAVITY_KEEP_THINKING=1 # keep_thinking
437
279
  ```
438
280
 
439
- ### Adding accounts
440
-
441
- **CLI flow (`opencode auth login`):**
442
-
443
- When you run `opencode auth login` and already have accounts saved, you'll be prompted:
444
-
445
- ```
446
- 2 account(s) saved:
447
- 1. user1@gmail.com
448
- 2. user2@gmail.com
449
-
450
- (a)dd new account(s) or (f)resh start? [a/f]:
451
- ```
452
-
453
- - Press `a` to add more accounts to your existing pool
454
- - Press `f` to clear all existing accounts and start fresh
455
-
456
- **TUI flow (`/connect`):**
281
+ <details>
282
+ <summary>Create `~/.config/opencode/antigravity.json` (or `.opencode/antigravity.json` in project root):</summary>
457
283
 
458
- The `/connect` command in the TUI adds accounts non-destructively — it will never clear your existing accounts. To start fresh via TUI, run `opencode auth logout` first, then `/connect`.
284
+ ```jsonc
285
+ {
286
+ // JSON Schema for IDE autocompletion
287
+ "$schema": "https://raw.githubusercontent.com/anthropics/opencode-antigravity-auth/main/assets/antigravity.schema.json",
459
288
 
460
- ### Account storage
289
+ // === General ===
290
+ "quiet_mode": false, // Suppress toast notifications (except recovery)
291
+ "debug": false, // Enable debug logging to file
292
+ "log_dir": "/custom/log/path", // Custom debug log directory (optional)
293
+ "auto_update": true, // Auto-update plugin
461
294
 
462
- - Account pool is stored in `~/.config/opencode/antigravity-accounts.json` (or `%APPDATA%\opencode\antigravity-accounts.json` on Windows)
463
- - This file contains OAuth refresh tokens; **treat it like a password** and don't share or commit it
464
- - The plugin automatically syncs with OpenCode's auth state — if you log out via OpenCode, stale account storage is cleared automatically
295
+ // === Thinking Blocks ===
296
+ "keep_thinking": false, // Preserve thinking blocks (may cause signature errors)
465
297
 
466
- ### Automatic account recovery
298
+ // === Session Recovery ===
299
+ "session_recovery": true, // Auto-recover from tool_result_missing errors
300
+ "auto_resume": true, // Auto-send "continue" after recovery
301
+ "resume_text": "continue", // Custom resume prompt text
467
302
 
468
- - If Google revokes a refresh token (`invalid_grant`), that account is automatically removed from the pool
469
- - Rerun `opencode auth login` to re-add the account
303
+ // === Empty Response Handling ===
304
+ "empty_response_max_attempts": 4, // Max retries for empty responses
305
+ "empty_response_retry_delay_ms": 2000, // Delay between retries (ms)
470
306
 
471
- ## Configuration
307
+ // === Tool Handling ===
308
+ "tool_id_recovery": true, // Fix mismatched tool IDs from context compaction
309
+ "claude_tool_hardening": true, // Prevent Claude tool hallucinations
472
310
 
473
- ### Config file
311
+ // === Token Refresh ===
312
+ "proactive_token_refresh": true, // Background token refresh
313
+ "proactive_refresh_buffer_seconds": 1800, // Refresh 30min before expiry
314
+ "proactive_refresh_check_interval_seconds": 300, // Check every 5min
474
315
 
475
- Create `~/.config/opencode/antigravity.json` (or `.opencode/antigravity.json` for project-specific settings):
316
+ // === Rate Limiting ===
317
+ "max_rate_limit_wait_seconds": 300, // Max wait time when rate limited (0=unlimited)
318
+ "quota_fallback": false, // Try alternate quota when rate limited
476
319
 
477
- ```json
478
- {
479
- "$schema": "https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/assets/antigravity.schema.json",
480
- "quiet_mode": false,
481
- "debug": false,
482
- "log_dir": null,
483
- "keep_thinking": false,
484
- "session_recovery": true,
485
- "auto_resume": true,
486
- "resume_text": "continue",
487
- "empty_response_max_attempts": 4,
488
- "empty_response_retry_delay_ms": 2000,
489
- "tool_id_recovery": true,
490
- "claude_tool_hardening": true,
491
- "proactive_token_refresh": true,
492
- "proactive_refresh_buffer_seconds": 1800,
493
- "proactive_refresh_check_interval_seconds": 300,
494
- "auto_update": true,
320
+ // === Signature Cache (for keep_thinking=true) ===
495
321
  "signature_cache": {
496
322
  "enabled": true,
497
- "memory_ttl_seconds": 3600,
498
- "disk_ttl_seconds": 172800,
499
- "write_interval_seconds": 60
323
+ "memory_ttl_seconds": 3600, // 1 hour in-memory
324
+ "disk_ttl_seconds": 172800, // 48 hours on disk
325
+ "write_interval_seconds": 60 // Background write interval
500
326
  }
501
327
  }
502
328
  ```
503
329
 
504
- #### General Settings
330
+ </details>
505
331
 
506
- | Option | Default | Description |
507
- |--------|---------|-------------|
508
- | `quiet_mode` | `false` | Suppress toast notifications (except recovery) |
509
- | `debug` | `false` | Enable debug logging to file |
510
- | `log_dir` | OS default | Custom directory for debug logs |
511
- | `auto_update` | `true` | Enable automatic plugin updates |
332
+ ## Multi-Account Setup
512
333
 
513
- #### Session Recovery
334
+ Add multiple Google accounts for higher combined quotas. The plugin automatically rotates between accounts when one is rate-limited.
514
335
 
515
- | Option | Default | Description |
516
- |--------|---------|-------------|
517
- | `session_recovery` | `true` | Auto-recover from tool_result_missing errors |
518
- | `auto_resume` | `true` | Auto-send resume prompt after recovery |
519
- | `resume_text` | `"continue"` | Text to send when auto-resuming |
336
+ ```bash
337
+ # Add accounts
338
+ opencode auth login
339
+ ```
520
340
 
521
- #### Thinking Blocks (Claude)
341
+ ## Compatible Plugins
522
342
 
523
- | Option | Default | Description |
524
- |--------|---------|-------------|
525
- | `keep_thinking` | `false` | Preserve thinking blocks (may cause signature errors) |
526
- | `signature_cache.enabled` | `true` | Cache signatures to disk |
527
- | `signature_cache.memory_ttl_seconds` | `3600` | In-memory cache TTL |
528
- | `signature_cache.disk_ttl_seconds` | `172800` | Disk cache TTL (48h) |
343
+ This plugin works alongside other OpenCode plugins. Some important notes:
529
344
 
530
- #### Error Recovery
345
+ ### Plugin Ordering
531
346
 
532
- | Option | Default | Description |
533
- |--------|---------|-------------|
534
- | `empty_response_max_attempts` | `4` | Retries for empty API responses |
535
- | `empty_response_retry_delay_ms` | `2000` | Delay between retries |
536
- | `tool_id_recovery` | `true` | Fix mismatched tool IDs from context compaction |
537
- | `claude_tool_hardening` | `true` | Prevent tool parameter hallucination |
347
+ If using `@tarquinen/opencode-dcp` (Dynamic Context Protocol), **our plugin must be listed first**:
538
348
 
539
- #### Token Management
349
+ ```json
350
+ {
351
+ "plugins": [
352
+ "opencode-antigravity-auth@latest",
353
+ "@tarquinen/opencode-dcp@1.1.2"
354
+ ]
355
+ }
356
+ ```
540
357
 
541
- | Option | Default | Description |
542
- |--------|---------|-------------|
543
- | `proactive_token_refresh` | `true` | Refresh tokens before expiry |
544
- | `proactive_refresh_buffer_seconds` | `1800` | Refresh 30min before expiry |
545
- | `proactive_refresh_check_interval_seconds` | `300` | Check interval (5min) |
358
+ ### Plugins You Don't Need
546
359
 
547
- ### Environment variables
360
+ - **gemini-auth plugins** - Not needed. This plugin handles all Google OAuth authentication.
548
361
 
549
- Environment variables override config file values.
362
+ ### Rate Limit Considerations
550
363
 
551
- | Variable | Values | Description |
552
- |----------|--------|-------------|
553
- | `OPENCODE_ANTIGRAVITY_QUIET` | `1` | Suppress toast notifications |
554
- | `OPENCODE_ANTIGRAVITY_DEBUG` | `1`, `2` | Debug logging level (2 = verbose) |
555
- | `OPENCODE_ANTIGRAVITY_LOG_DIR` | path | Custom log directory |
556
- | `OPENCODE_ANTIGRAVITY_KEEP_THINKING` | `1` | Preserve thinking blocks |
557
- | `OPENCODE_ANTIGRAVITY_SESSION_RECOVERY` | `0`/`1` | Enable/disable session recovery |
558
- | `OPENCODE_ANTIGRAVITY_AUTO_RESUME` | `0`/`1` | Enable/disable auto-resume |
559
- | `OPENCODE_ANTIGRAVITY_RESUME_TEXT` | string | Custom resume text |
560
- | `OPENCODE_ANTIGRAVITY_AUTO_UPDATE` | `0`/`1` | Enable/disable auto-updates |
364
+ - **oh-my-opencode** - This plugin may make background API calls that consume your quota. If you're hitting rate limits unexpectedly, check if oh-my-opencode is making requests.
561
365
 
562
- ## Known plugin interactions
366
+ ## Migration Guide (v1.2.7+)
563
367
 
564
- ### @tarquinen/opencode-dcp (Dynamic Context Pruning)
368
+ <details>
369
+ <summary>If upgrading from v1.2.6 or earlier, follow these steps:</summary>
565
370
 
566
- **Issue:** DCP creates synthetic assistant messages to summarize pruned tool outputs. These synthetic messages lack the thinking block that Claude's API requires for thinking-enabled models.
371
+ ### Step 1: Clear Old Tokens
567
372
 
568
- **Error you'll see:**
569
- ```
570
- Expected 'thinking' or 'redacted_thinking', but found 'text'
373
+ ```bash
374
+ rm -rf ~/.config/opencode/antigravity-tokens/
571
375
  ```
572
376
 
573
- **Solution:** Ensure DCP loads **before** this plugin. We inject `redacted_thinking` blocks into any assistant message that lacks one.
377
+ ### Step 2: Update opencode.json
574
378
 
575
- | Order | Result |
576
- |-------|--------|
577
- | DCP → antigravity | Works - we fix DCP's synthetic messages |
578
- | antigravity → DCP | Broken - DCP creates messages after our fix runs |
379
+ Replace your old config with:
579
380
 
580
- **Correct:**
581
381
  ```json
582
382
  {
583
- "plugin": [
584
- "@tarquinen/opencode-dcp@latest",
585
- "opencode-antigravity-auth@latest"
586
- ]
383
+ "plugins": ["opencode-antigravity-auth@latest"],
384
+ "provider": "google",
385
+ "model": "google/antigravity-gemini-3-flash"
587
386
  }
588
387
  ```
589
388
 
590
- **Incorrect:**
389
+ ### Step 3: Create antigravity.json (Optional)
390
+
391
+ If you had custom settings, migrate them to `~/.config/opencode/antigravity.json`:
392
+
591
393
  ```json
592
394
  {
593
- "plugin": [
594
- "opencode-antigravity-auth@latest",
595
- "@tarquinen/opencode-dcp@latest"
596
- ]
395
+ "$schema": "https://raw.githubusercontent.com/anthropics/opencode-antigravity-auth/main/assets/antigravity.schema.json",
396
+ "quiet_mode": false,
397
+ "debug": false
597
398
  }
598
399
  ```
599
400
 
600
- ### oh-my-opencode (Subagent Orchestration)
401
+ ### Step 4: Re-authenticate
601
402
 
602
- **Issue:** When oh-my-opencode spawns multiple subagents in parallel, each subagent runs as a separate OpenCode process. Without coordination, multiple processes may select the same Antigravity account simultaneously, causing rate limit errors.
403
+ Run OpenCode once. A browser window will open for Google OAuth:
603
404
 
604
- **Error you'll see:**
605
- ```
606
- 429 Too Many Requests
405
+ ```bash
406
+ opencode
607
407
  ```
608
408
 
609
- **Current workaround:**
610
- - Increase your account pool (add more OAuth accounts via `opencode auth login`)
611
- - Reduce parallel subagent count in your configuration
612
-
613
- **Status:** A file-based reservation system to coordinate account selection across processes is planned but not yet implemented.
409
+ ### Breaking Changes
614
410
 
615
- ## Architecture & Flow
411
+ | Old (v1.2.6) | New (v1.2.7+) |
412
+ |--------------|---------------|
413
+ | `OPENCODE_ANTIGRAVITY_*` env vars | `~/.config/opencode/antigravity.json` |
414
+ | `gemini-3-pro` | `google/antigravity-gemini-3-pro-low` |
415
+ | `claude-sonnet-4-5` | `google/antigravity-claude-sonnet-4-5` |
616
416
 
617
- For contributors and advanced users, see the detailed documentation:
417
+ </details>
618
418
 
619
- - **[Architecture Guide](docs/ARCHITECTURE.md)** - Full request/response flow, module structure, and troubleshooting
620
- - **[Antigravity API Spec](docs/ANTIGRAVITY_API_SPEC.md)** - API reference and schema support matrix
419
+ ## E2E Testing
621
420
 
622
- ## Streaming & thinking
421
+ The plugin includes regression tests for stability verification. Tests consume API quota.
623
422
 
624
- This plugin supports **real-time SSE streaming**, meaning you see thinking blocks and text output incrementally as they are generated.
423
+ ```bash
424
+ # Sanity tests (7 tests, ~5 min)
425
+ npx tsx script/test-regression.ts --sanity
625
426
 
626
- ### Claude Thinking & Tools
427
+ # Heavy tests (4 tests, ~30 min) - stress testing with 8-50 turn conversations
428
+ npx tsx script/test-regression.ts --heavy
627
429
 
628
- For models like `claude-opus-4-5-thinking`:
430
+ # Concurrent tests (3 tests) - rate limit handling with 5-10 parallel requests
431
+ npx tsx script/test-regression.ts --category concurrency
629
432
 
630
- - **Interleaved Thinking:** The plugin automatically enables `anthropic-beta: interleaved-thinking-2025-05-14`. This allows Claude to think *between* tool calls and after tool results, improving complex reasoning.
631
- - **Smart System Hints:** A system instruction is silently added to encourage the model to "think" before and during tool use.
632
- - **Multi-turn Stability:** Thinking signatures are cached and restored using a stable `sessionId`, preventing "invalid signature" errors in long conversations.
633
- - **Thinking Budget Safety:** If a thinking budget is enabled, the plugin ensures output token limits are high enough to avoid budget-related errors.
634
- - **Tool Use:** Tool calls and responses are assigned proper IDs, and tool calling is set to validated mode for better Claude compatibility.
433
+ # Run specific test
434
+ npx tsx script/test-regression.ts --test thinking-tool-use
635
435
 
636
- **Troubleshooting:** If you see signature errors in multi-turn tool loops, restart `opencode` to reset the plugin session/signature cache.
436
+ # List tests without running
437
+ npx tsx script/test-regression.ts --dry-run
438
+ ```
637
439
 
638
440
  ## Debugging
639
441
 
640
- Enable debug logging via environment variable:
442
+ Enable debug logging:
641
443
 
642
444
  ```bash
643
- export OPENCODE_ANTIGRAVITY_DEBUG=1
644
- ```
445
+ # Via environment
446
+ OPENCODE_ANTIGRAVITY_DEBUG=1 opencode
645
447
 
646
- - **Level 1 (`1` or `true`):** Basic logging of URLs, headers, status codes, and request/response previews.
647
- - **Level 2 (`2` or `verbose`):** Verbose logging including full request and response bodies (up to 50KB).
648
- - **TUI Reasoning View:** Debug logs are injected into the model's "thinking/reasoning" blocks in the Opencode TUI (requires thinking-capable models).
649
- - **Log Files:** Logs are written to `~/.config/opencode/antigravity-logs/antigravity-debug-<timestamp>.log`. Override with `OPENCODE_ANTIGRAVITY_LOG_DIR`.
650
- - **Auto-Stripping:** Injected debug blocks are automatically stripped from outgoing requests to prevent leaking into conversation history.
651
-
652
- ## Development
653
-
654
- ```bash
655
- npm install
448
+ # Via config
449
+ echo '{"debug": true}' > ~/.config/opencode/antigravity.json
656
450
  ```
657
451
 
658
- ## Safety, usage, and risk notices
659
-
660
- ### Intended use
661
-
662
- - Personal / internal development only
663
- - Respect internal quotas and data handling policies
664
- - Not for production services or bypassing intended limits
665
-
666
- ### Not suitable for
667
-
668
- - Production application traffic
669
- - High-volume automated extraction
670
- - Any use that violates Acceptable Use Policies
671
-
672
- ### ⚠️ Warning (assumption of risk)
673
-
674
- By using this plugin, you acknowledge and accept the following:
675
-
676
- - **Terms of Service risk:** This approach may violate the Terms of Service of AI model providers (Anthropic, OpenAI, etc.). You are solely responsible for ensuring compliance with all applicable terms and policies.
677
- - **Account risk:** Providers may detect this usage pattern and take punitive action, including suspension, permanent ban, or loss of access to paid subscriptions.
678
- - **No guarantees:** Providers may change APIs, authentication, or policies at any time, which can break this method without notice.
679
- - **Assumption of risk:** You assume all legal, financial, and technical risks. The authors and contributors of this project bear no responsibility for any consequences arising from your use.
680
-
681
- Use at your own risk. Proceed only if you understand and accept these risks.
682
-
683
- ## Legal
684
-
685
- - Not affiliated with Google. This is an independent open-source project and is not endorsed by, sponsored by, or affiliated with Google LLC.
686
- - "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
687
- - Software is provided "as is", without warranty. You are responsible for complying with Google's Terms of Service and Acceptable Use Policy.
688
-
689
- ## Credits
690
-
691
- Built with help and inspiration from:
692
-
693
- - [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) — Gemini OAuth groundwork by [@jenslys](https://github.com/jenslys)
694
- - [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) — Helpful reference for Antigravity API
695
-
696
- ## Support
452
+ Logs are written to `~/.config/opencode/antigravity-logs/` (or `log_dir` if configured).
697
453
 
698
- If this plugin helps you, consider supporting its continued maintenance:
454
+ ## Documentation
699
455
 
700
- [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/S6S81QBOIR)
456
+ - [Architecture](docs/ARCHITECTURE.md) - Plugin internals and request flow
457
+ - [API Spec](docs/ANTIGRAVITY_API_SPEC.md) - Antigravity API reference
701
458
 
459
+ ## License
702
460
 
461
+ MIT