opencode-antigravity-auth-remix 1.0.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.
Files changed (187) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +723 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +3 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/src/antigravity/oauth.d.ts +31 -0
  8. package/dist/src/antigravity/oauth.d.ts.map +1 -0
  9. package/dist/src/antigravity/oauth.js +168 -0
  10. package/dist/src/antigravity/oauth.js.map +1 -0
  11. package/dist/src/constants.d.ts +107 -0
  12. package/dist/src/constants.d.ts.map +1 -0
  13. package/dist/src/constants.js +138 -0
  14. package/dist/src/constants.js.map +1 -0
  15. package/dist/src/hooks/auto-update-checker/cache.d.ts +3 -0
  16. package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
  17. package/dist/src/hooks/auto-update-checker/cache.js +71 -0
  18. package/dist/src/hooks/auto-update-checker/cache.js.map +1 -0
  19. package/dist/src/hooks/auto-update-checker/checker.d.ts +16 -0
  20. package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
  21. package/dist/src/hooks/auto-update-checker/checker.js +237 -0
  22. package/dist/src/hooks/auto-update-checker/checker.js.map +1 -0
  23. package/dist/src/hooks/auto-update-checker/constants.d.ts +9 -0
  24. package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
  25. package/dist/src/hooks/auto-update-checker/constants.js +23 -0
  26. package/dist/src/hooks/auto-update-checker/constants.js.map +1 -0
  27. package/dist/src/hooks/auto-update-checker/index.d.ts +34 -0
  28. package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -0
  29. package/dist/src/hooks/auto-update-checker/index.js +125 -0
  30. package/dist/src/hooks/auto-update-checker/index.js.map +1 -0
  31. package/dist/src/hooks/auto-update-checker/types.d.ts +25 -0
  32. package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -0
  33. package/dist/src/hooks/auto-update-checker/types.js +1 -0
  34. package/dist/src/hooks/auto-update-checker/types.js.map +1 -0
  35. package/dist/src/plugin/accounts.d.ts +58 -0
  36. package/dist/src/plugin/accounts.d.ts.map +1 -0
  37. package/dist/src/plugin/accounts.js +350 -0
  38. package/dist/src/plugin/accounts.js.map +1 -0
  39. package/dist/src/plugin/auth.d.ts +21 -0
  40. package/dist/src/plugin/auth.d.ts.map +1 -0
  41. package/dist/src/plugin/auth.js +46 -0
  42. package/dist/src/plugin/auth.js.map +1 -0
  43. package/dist/src/plugin/cache/index.d.ts +5 -0
  44. package/dist/src/plugin/cache/index.d.ts.map +1 -0
  45. package/dist/src/plugin/cache/index.js +5 -0
  46. package/dist/src/plugin/cache/index.js.map +1 -0
  47. package/dist/src/plugin/cache/signature-cache.d.ts +111 -0
  48. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -0
  49. package/dist/src/plugin/cache/signature-cache.js +373 -0
  50. package/dist/src/plugin/cache/signature-cache.js.map +1 -0
  51. package/dist/src/plugin/cache.d.ts +44 -0
  52. package/dist/src/plugin/cache.d.ts.map +1 -0
  53. package/dist/src/plugin/cache.js +200 -0
  54. package/dist/src/plugin/cache.js.map +1 -0
  55. package/dist/src/plugin/cli.d.ts +19 -0
  56. package/dist/src/plugin/cli.d.ts.map +1 -0
  57. package/dist/src/plugin/cli.js +59 -0
  58. package/dist/src/plugin/cli.js.map +1 -0
  59. package/dist/src/plugin/config/index.d.ts +16 -0
  60. package/dist/src/plugin/config/index.d.ts.map +1 -0
  61. package/dist/src/plugin/config/index.js +16 -0
  62. package/dist/src/plugin/config/index.js.map +1 -0
  63. package/dist/src/plugin/config/loader.d.ts +35 -0
  64. package/dist/src/plugin/config/loader.d.ts.map +1 -0
  65. package/dist/src/plugin/config/loader.js +178 -0
  66. package/dist/src/plugin/config/loader.js.map +1 -0
  67. package/dist/src/plugin/config/schema.d.ts +257 -0
  68. package/dist/src/plugin/config/schema.d.ts.map +1 -0
  69. package/dist/src/plugin/config/schema.js +229 -0
  70. package/dist/src/plugin/config/schema.js.map +1 -0
  71. package/dist/src/plugin/core/streaming/index.d.ts +3 -0
  72. package/dist/src/plugin/core/streaming/index.d.ts.map +1 -0
  73. package/dist/src/plugin/core/streaming/index.js +3 -0
  74. package/dist/src/plugin/core/streaming/index.js.map +1 -0
  75. package/dist/src/plugin/core/streaming/transformer.d.ts +9 -0
  76. package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -0
  77. package/dist/src/plugin/core/streaming/transformer.js +134 -0
  78. package/dist/src/plugin/core/streaming/transformer.js.map +1 -0
  79. package/dist/src/plugin/core/streaming/types.d.ts +26 -0
  80. package/dist/src/plugin/core/streaming/types.d.ts.map +1 -0
  81. package/dist/src/plugin/core/streaming/types.js +1 -0
  82. package/dist/src/plugin/core/streaming/types.js.map +1 -0
  83. package/dist/src/plugin/debug.d.ts +68 -0
  84. package/dist/src/plugin/debug.d.ts.map +1 -0
  85. package/dist/src/plugin/debug.js +321 -0
  86. package/dist/src/plugin/debug.js.map +1 -0
  87. package/dist/src/plugin/errors.d.ts +28 -0
  88. package/dist/src/plugin/errors.d.ts.map +1 -0
  89. package/dist/src/plugin/errors.js +42 -0
  90. package/dist/src/plugin/errors.js.map +1 -0
  91. package/dist/src/plugin/logger.d.ts +54 -0
  92. package/dist/src/plugin/logger.d.ts.map +1 -0
  93. package/dist/src/plugin/logger.js +120 -0
  94. package/dist/src/plugin/logger.js.map +1 -0
  95. package/dist/src/plugin/project.d.ts +33 -0
  96. package/dist/src/plugin/project.d.ts.map +1 -0
  97. package/dist/src/plugin/project.js +239 -0
  98. package/dist/src/plugin/project.js.map +1 -0
  99. package/dist/src/plugin/recovery/constants.d.ts +22 -0
  100. package/dist/src/plugin/recovery/constants.d.ts.map +1 -0
  101. package/dist/src/plugin/recovery/constants.js +43 -0
  102. package/dist/src/plugin/recovery/constants.js.map +1 -0
  103. package/dist/src/plugin/recovery/index.d.ts +12 -0
  104. package/dist/src/plugin/recovery/index.d.ts.map +1 -0
  105. package/dist/src/plugin/recovery/index.js +12 -0
  106. package/dist/src/plugin/recovery/index.js.map +1 -0
  107. package/dist/src/plugin/recovery/storage.d.ts +24 -0
  108. package/dist/src/plugin/recovery/storage.d.ts.map +1 -0
  109. package/dist/src/plugin/recovery/storage.js +354 -0
  110. package/dist/src/plugin/recovery/storage.js.map +1 -0
  111. package/dist/src/plugin/recovery/types.d.ts +116 -0
  112. package/dist/src/plugin/recovery/types.d.ts.map +1 -0
  113. package/dist/src/plugin/recovery/types.js +6 -0
  114. package/dist/src/plugin/recovery/types.js.map +1 -0
  115. package/dist/src/plugin/recovery.d.ts +61 -0
  116. package/dist/src/plugin/recovery.d.ts.map +1 -0
  117. package/dist/src/plugin/recovery.js +376 -0
  118. package/dist/src/plugin/recovery.js.map +1 -0
  119. package/dist/src/plugin/refresh-queue.d.ts +101 -0
  120. package/dist/src/plugin/refresh-queue.d.ts.map +1 -0
  121. package/dist/src/plugin/refresh-queue.js +244 -0
  122. package/dist/src/plugin/refresh-queue.js.map +1 -0
  123. package/dist/src/plugin/request-helpers.d.ts +270 -0
  124. package/dist/src/plugin/request-helpers.d.ts.map +1 -0
  125. package/dist/src/plugin/request-helpers.js +2158 -0
  126. package/dist/src/plugin/request-helpers.js.map +1 -0
  127. package/dist/src/plugin/request.d.ts +87 -0
  128. package/dist/src/plugin/request.d.ts.map +1 -0
  129. package/dist/src/plugin/request.js +1233 -0
  130. package/dist/src/plugin/request.js.map +1 -0
  131. package/dist/src/plugin/search.d.ts +19 -0
  132. package/dist/src/plugin/search.d.ts.map +1 -0
  133. package/dist/src/plugin/search.js +191 -0
  134. package/dist/src/plugin/search.js.map +1 -0
  135. package/dist/src/plugin/server.d.ts +23 -0
  136. package/dist/src/plugin/server.d.ts.map +1 -0
  137. package/dist/src/plugin/server.js +222 -0
  138. package/dist/src/plugin/server.js.map +1 -0
  139. package/dist/src/plugin/storage.d.ts +77 -0
  140. package/dist/src/plugin/storage.d.ts.map +1 -0
  141. package/dist/src/plugin/storage.js +207 -0
  142. package/dist/src/plugin/storage.js.map +1 -0
  143. package/dist/src/plugin/stores/signature-store.d.ts +5 -0
  144. package/dist/src/plugin/stores/signature-store.d.ts.map +1 -0
  145. package/dist/src/plugin/stores/signature-store.js +25 -0
  146. package/dist/src/plugin/stores/signature-store.js.map +1 -0
  147. package/dist/src/plugin/thinking-recovery.d.ts +90 -0
  148. package/dist/src/plugin/thinking-recovery.d.ts.map +1 -0
  149. package/dist/src/plugin/thinking-recovery.js +316 -0
  150. package/dist/src/plugin/thinking-recovery.js.map +1 -0
  151. package/dist/src/plugin/token.d.ts +19 -0
  152. package/dist/src/plugin/token.d.ts.map +1 -0
  153. package/dist/src/plugin/token.js +128 -0
  154. package/dist/src/plugin/token.js.map +1 -0
  155. package/dist/src/plugin/transform/claude.d.ts +80 -0
  156. package/dist/src/plugin/transform/claude.d.ts.map +1 -0
  157. package/dist/src/plugin/transform/claude.js +265 -0
  158. package/dist/src/plugin/transform/claude.js.map +1 -0
  159. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +35 -0
  160. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
  161. package/dist/src/plugin/transform/cross-model-sanitizer.js +225 -0
  162. package/dist/src/plugin/transform/cross-model-sanitizer.js.map +1 -0
  163. package/dist/src/plugin/transform/gemini.d.ts +63 -0
  164. package/dist/src/plugin/transform/gemini.d.ts.map +1 -0
  165. package/dist/src/plugin/transform/gemini.js +142 -0
  166. package/dist/src/plugin/transform/gemini.js.map +1 -0
  167. package/dist/src/plugin/transform/index.d.ts +14 -0
  168. package/dist/src/plugin/transform/index.d.ts.map +1 -0
  169. package/dist/src/plugin/transform/index.js +14 -0
  170. package/dist/src/plugin/transform/index.js.map +1 -0
  171. package/dist/src/plugin/transform/model-resolver.d.ts +78 -0
  172. package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -0
  173. package/dist/src/plugin/transform/model-resolver.js +221 -0
  174. package/dist/src/plugin/transform/model-resolver.js.map +1 -0
  175. package/dist/src/plugin/transform/types.d.ts +93 -0
  176. package/dist/src/plugin/transform/types.d.ts.map +1 -0
  177. package/dist/src/plugin/transform/types.js +1 -0
  178. package/dist/src/plugin/transform/types.js.map +1 -0
  179. package/dist/src/plugin/types.d.ts +97 -0
  180. package/dist/src/plugin/types.d.ts.map +1 -0
  181. package/dist/src/plugin/types.js +1 -0
  182. package/dist/src/plugin/types.js.map +1 -0
  183. package/dist/src/plugin.d.ts +8 -0
  184. package/dist/src/plugin.d.ts.map +1 -0
  185. package/dist/src/plugin.js +1845 -0
  186. package/dist/src/plugin.js.map +1 -0
  187. package/package.json +65 -0
package/README.md ADDED
@@ -0,0 +1,723 @@
1
+ # Antigravity + Gemini CLI OAuth Plugin for Opencode (Enhanced Fork)
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
4
+
5
+ > **This is an enhanced fork** that merges the best features from two excellent projects:
6
+ >
7
+ > | Feature | Source |
8
+ > | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
9
+ > | Dual Quota System, Multi-Account Rotation, Session Recovery, Thinking Recovery | [NoeFabris/opencode-antigravity-auth](https://github.com/NoeFabris/opencode-antigravity-auth) |
10
+ > | `google_search` Tool (Web Search & URL Analysis) | [shekohex/opencode-google-antigravity-auth](https://github.com/shekohex/opencode-google-antigravity-auth) |
11
+ >
12
+ > **Credits:** Thanks to [@NoeFabris](https://github.com/NoeFabris) and [@shekohex](https://github.com/shekohex) for their original work!
13
+
14
+ ---
15
+
16
+ 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.
17
+
18
+ ## What you get
19
+
20
+ - **Google OAuth sign-in** with automatic token refresh via `opencode auth login`
21
+ - **Dual Quota System** - Access both Antigravity quota (Claude, Gemini 3) and Gemini CLI quota from a single plugin
22
+ - **Multi-Account Rotation** - Add multiple Google accounts; automatically rotates when one is rate-limited
23
+ - **Real-time SSE streaming** including thinking blocks and incremental output
24
+ - **Extended Thinking** - Native support for Claude thinking budgets and Gemini 3 thinking levels
25
+ - **Auto Recovery** - Automatic session recovery from Claude tool_result_missing errors
26
+ - **Plugin Compatible** - Works alongside other OpenCode plugins (opencodesync, etc.)
27
+ - **google_search Tool** - (NEW) Built-in web search and URL analysis powered by Antigravity API
28
+
29
+ ## Installation
30
+
31
+ ### For Humans
32
+
33
+ **Option A: Let an LLM do it**
34
+
35
+ Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
36
+
37
+ ```
38
+ Install the opencode-antigravity-auth plugin and add the Antigravity model definitions to ~/.config/opencode/opencode.json by following: https://raw.githubusercontent.com/Darkstarrd-dev/opencode-antigravity-auth/main/README.md
39
+ ```
40
+
41
+ **Option B: Manual setup**
42
+
43
+ 1. **Add the plugin to your config** (`~/.config/opencode/opencode.json`):
44
+
45
+ ```json
46
+ {
47
+ "plugin": ["opencode-antigravity-auth-remix@1.0.7"]
48
+ }
49
+ ```
50
+
51
+ 2. **Authenticate:**
52
+
53
+ ```bash
54
+ opencode auth login
55
+ ```
56
+
57
+ 3. **Add models** (see [Available Models](#available-models) for full list):
58
+
59
+ ```json
60
+ {
61
+ "plugin": ["opencode-antigravity-auth-remix@1.0.7"],
62
+ "provider": {
63
+ "google": {
64
+ "models": {
65
+ "antigravity-claude-sonnet-4-5": {
66
+ "name": "Claude Sonnet 4.5 (Antigravity)",
67
+ "limit": { "context": 200000, "output": 64000 },
68
+ "modalities": {
69
+ "input": ["text", "image", "pdf"],
70
+ "output": ["text"]
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ 4. **Use it:**
80
+
81
+ ```bash
82
+ opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5
83
+ ```
84
+
85
+ <details>
86
+ <summary><b>Installation Guide for LLM Agents</b></summary>
87
+
88
+ ### Step-by-Step Instructions
89
+
90
+ 1. Edit the OpenCode configuration file:
91
+ - Linux/Mac: `~/.config/opencode/opencode.json`
92
+ - Windows: `%APPDATA%\opencode\opencode.json`
93
+
94
+ 2. Add the plugin to the `plugins` array
95
+
96
+ 3. Set `provider` to `"google"` and choose a model
97
+
98
+ ### Complete Configuration Example
99
+
100
+ Create `~/.config/opencode/opencode.json`:
101
+
102
+ ```json
103
+ {
104
+ "$schema": "https://opencode.ai/config.json",
105
+ "plugin": ["opencode-antigravity-auth-remix@1.0.7"],
106
+ "provider": {
107
+ "google": {
108
+ "models": {
109
+ "antigravity-gemini-3-pro-low": {
110
+ "name": "Gemini 3 Pro Low (Antigravity)",
111
+ "limit": { "context": 1048576, "output": 65535 },
112
+ "modalities": {
113
+ "input": ["text", "image", "pdf"],
114
+ "output": ["text"]
115
+ }
116
+ },
117
+ "antigravity-gemini-3-pro-high": {
118
+ "name": "Gemini 3 Pro High (Antigravity)",
119
+ "limit": { "context": 1048576, "output": 65535 },
120
+ "modalities": {
121
+ "input": ["text", "image", "pdf"],
122
+ "output": ["text"]
123
+ }
124
+ },
125
+ "antigravity-gemini-3-flash": {
126
+ "name": "Gemini 3 Flash (Antigravity)",
127
+ "limit": { "context": 1048576, "output": 65536 },
128
+ "modalities": {
129
+ "input": ["text", "image", "pdf"],
130
+ "output": ["text"]
131
+ }
132
+ },
133
+ "gemini-3-pro-low": {
134
+ "name": "Gemini 3 Pro Low (Gemini)",
135
+ "limit": { "context": 1048576, "output": 65535 },
136
+ "modalities": {
137
+ "input": ["text", "image", "pdf"],
138
+ "output": ["text"]
139
+ }
140
+ },
141
+ "gemini-3-pro-high": {
142
+ "name": "Gemini 3 Pro High (Gemini)",
143
+ "limit": { "context": 1048576, "output": 65535 },
144
+ "modalities": {
145
+ "input": ["text", "image", "pdf"],
146
+ "output": ["text"]
147
+ }
148
+ },
149
+ "gemini-3-flash": {
150
+ "name": "Gemini 3 Flash (Gemini)",
151
+ "limit": { "context": 1048576, "output": 65536 },
152
+ "modalities": {
153
+ "input": ["text", "image", "pdf"],
154
+ "output": ["text"]
155
+ }
156
+ },
157
+ "antigravity-claude-sonnet-4-5": {
158
+ "name": "Claude Sonnet 4.5 (Antigravity)",
159
+ "limit": { "context": 200000, "output": 64000 },
160
+ "modalities": {
161
+ "input": ["text", "image", "pdf"],
162
+ "output": ["text"]
163
+ }
164
+ },
165
+ "antigravity-claude-sonnet-4-5-thinking-low": {
166
+ "name": "Claude Sonnet 4.5 Low (Antigravity)",
167
+ "limit": { "context": 200000, "output": 64000 },
168
+ "modalities": {
169
+ "input": ["text", "image", "pdf"],
170
+ "output": ["text"]
171
+ }
172
+ },
173
+ "antigravity-claude-sonnet-4-5-thinking-medium": {
174
+ "name": "Claude Sonnet 4.5 Medium (Antigravity)",
175
+ "limit": { "context": 200000, "output": 64000 },
176
+ "modalities": {
177
+ "input": ["text", "image", "pdf"],
178
+ "output": ["text"]
179
+ }
180
+ },
181
+ "antigravity-claude-sonnet-4-5-thinking-high": {
182
+ "name": "Claude Sonnet 4.5 High (Antigravity)",
183
+ "limit": { "context": 200000, "output": 64000 },
184
+ "modalities": {
185
+ "input": ["text", "image", "pdf"],
186
+ "output": ["text"]
187
+ }
188
+ },
189
+ "antigravity-claude-opus-4-5-thinking-low": {
190
+ "name": "Claude Opus 4.5 Low (Antigravity)",
191
+ "limit": { "context": 200000, "output": 64000 },
192
+ "modalities": {
193
+ "input": ["text", "image", "pdf"],
194
+ "output": ["text"]
195
+ }
196
+ },
197
+ "antigravity-claude-opus-4-5-thinking-medium": {
198
+ "name": "Claude Opus 4.5 Medium (Antigravity)",
199
+ "limit": { "context": 200000, "output": 64000 },
200
+ "modalities": {
201
+ "input": ["text", "image", "pdf"],
202
+ "output": ["text"]
203
+ }
204
+ },
205
+ "antigravity-claude-opus-4-5-thinking-high": {
206
+ "name": "Claude Opus 4.5 High (Antigravity)",
207
+ "limit": { "context": 200000, "output": 64000 },
208
+ "modalities": {
209
+ "input": ["text", "image", "pdf"],
210
+ "output": ["text"]
211
+ }
212
+ }
213
+ }
214
+ }
215
+ }
216
+ }
217
+ ```
218
+
219
+ ### Verification
220
+
221
+ ```bash
222
+ opencode run "Hello" --model=google/antigravity-claude-sonnet-4-5
223
+ ```
224
+
225
+ </details>
226
+
227
+ ## Available Models
228
+
229
+ ### Antigravity Quota
230
+
231
+ Models with `antigravity-` prefix use Antigravity quota:
232
+
233
+ | Model | Description |
234
+ | ------------------------------------------------------ | --------------------------------- |
235
+ | `google/antigravity-gemini-3-flash` | Gemini 3 Flash (minimal thinking) |
236
+ | `google/antigravity-gemini-3-pro-low` | Gemini 3 Pro with low thinking |
237
+ | `google/antigravity-gemini-3-pro-high` | Gemini 3 Pro with high thinking |
238
+ | `google/antigravity-claude-sonnet-4-5` | Claude Sonnet 4.5 (no thinking) |
239
+ | `google/antigravity-claude-sonnet-4-5-thinking-low` | Sonnet with 8K thinking budget |
240
+ | `google/antigravity-claude-sonnet-4-5-thinking-medium` | Sonnet with 16K thinking budget |
241
+ | `google/antigravity-claude-sonnet-4-5-thinking-high` | Sonnet with 32K thinking budget |
242
+ | `google/antigravity-claude-opus-4-5-thinking-low` | Opus with 8K thinking budget |
243
+ | `google/antigravity-claude-opus-4-5-thinking-medium` | Opus with 16K thinking budget |
244
+ | `google/antigravity-claude-opus-4-5-thinking-high` | Opus with 32K thinking budget |
245
+
246
+ > **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).
247
+
248
+ ### Gemini CLI Quota
249
+
250
+ Models with `-preview` suffix use Gemini CLI quota:
251
+
252
+ | Model | Description |
253
+ | ------------------------------- | ------------------------ |
254
+ | `google/gemini-2.5-flash` | Gemini 2.5 Flash |
255
+ | `google/gemini-2.5-pro` | Gemini 2.5 Pro |
256
+ | `google/gemini-3-flash-preview` | Gemini 3 Flash (preview) |
257
+ | `google/gemini-3-pro-preview` | Gemini 3 Pro (preview) |
258
+
259
+ <details>
260
+ <summary><b>Full models configuration</b></summary>
261
+
262
+ ```json
263
+ {
264
+ "$schema": "https://opencode.ai/config.json",
265
+ "plugin": ["opencode-antigravity-auth-remix@1.0.7"],
266
+ "provider": {
267
+ "google": {
268
+ "models": {
269
+ "antigravity-gemini-3-pro-low": {
270
+ "name": "Gemini 3 Pro Low (Antigravity)",
271
+ "limit": { "context": 1048576, "output": 65535 },
272
+ "modalities": {
273
+ "input": ["text", "image", "pdf"],
274
+ "output": ["text"]
275
+ }
276
+ },
277
+ "antigravity-gemini-3-pro-high": {
278
+ "name": "Gemini 3 Pro High (Antigravity)",
279
+ "limit": { "context": 1048576, "output": 65535 },
280
+ "modalities": {
281
+ "input": ["text", "image", "pdf"],
282
+ "output": ["text"]
283
+ }
284
+ },
285
+ "antigravity-gemini-3-flash": {
286
+ "name": "Gemini 3 Flash (Antigravity)",
287
+ "limit": { "context": 1048576, "output": 65536 },
288
+ "modalities": {
289
+ "input": ["text", "image", "pdf"],
290
+ "output": ["text"]
291
+ }
292
+ },
293
+ "gemini-3-pro-low": {
294
+ "name": "Gemini 3 Pro Low (Antigravity)",
295
+ "limit": { "context": 1048576, "output": 65535 },
296
+ "modalities": {
297
+ "input": ["text", "image", "pdf"],
298
+ "output": ["text"]
299
+ }
300
+ },
301
+ "gemini-3-pro-high": {
302
+ "name": "Gemini 3 Pro High (Antigravity)",
303
+ "limit": { "context": 1048576, "output": 65535 },
304
+ "modalities": {
305
+ "input": ["text", "image", "pdf"],
306
+ "output": ["text"]
307
+ }
308
+ },
309
+ "gemini-3-flash": {
310
+ "name": "Gemini 3 Flash (Antigravity)",
311
+ "limit": { "context": 1048576, "output": 65536 },
312
+ "modalities": {
313
+ "input": ["text", "image", "pdf"],
314
+ "output": ["text"]
315
+ }
316
+ },
317
+ "antigravity-claude-sonnet-4-5": {
318
+ "name": "Claude Sonnet 4.5 (Antigravity)",
319
+ "limit": { "context": 200000, "output": 64000 },
320
+ "modalities": {
321
+ "input": ["text", "image", "pdf"],
322
+ "output": ["text"]
323
+ }
324
+ },
325
+ "antigravity-claude-sonnet-4-5-thinking-low": {
326
+ "name": "Claude Sonnet 4.5 Think Low (Antigravity)",
327
+ "limit": { "context": 200000, "output": 64000 },
328
+ "modalities": {
329
+ "input": ["text", "image", "pdf"],
330
+ "output": ["text"]
331
+ }
332
+ },
333
+ "antigravity-claude-sonnet-4-5-thinking-medium": {
334
+ "name": "Claude Sonnet 4.5 Think Medium (Antigravity)",
335
+ "limit": { "context": 200000, "output": 64000 },
336
+ "modalities": {
337
+ "input": ["text", "image", "pdf"],
338
+ "output": ["text"]
339
+ }
340
+ },
341
+ "antigravity-claude-sonnet-4-5-thinking-high": {
342
+ "name": "Claude Sonnet 4.5 Think High (Antigravity)",
343
+ "limit": { "context": 200000, "output": 64000 },
344
+ "modalities": {
345
+ "input": ["text", "image", "pdf"],
346
+ "output": ["text"]
347
+ }
348
+ },
349
+ "antigravity-claude-opus-4-5-thinking-low": {
350
+ "name": "Claude Opus 4.5 Think Low (Antigravity)",
351
+ "limit": { "context": 200000, "output": 64000 },
352
+ "modalities": {
353
+ "input": ["text", "image", "pdf"],
354
+ "output": ["text"]
355
+ }
356
+ },
357
+ "antigravity-claude-opus-4-5-thinking-medium": {
358
+ "name": "Claude Opus 4.5 Think Medium (Antigravity)",
359
+ "limit": { "context": 200000, "output": 64000 },
360
+ "modalities": {
361
+ "input": ["text", "image", "pdf"],
362
+ "output": ["text"]
363
+ }
364
+ },
365
+ "antigravity-claude-opus-4-5-thinking-high": {
366
+ "name": "Claude Opus 4.5 Think High (Antigravity)",
367
+ "limit": { "context": 200000, "output": 64000 },
368
+ "modalities": {
369
+ "input": ["text", "image", "pdf"],
370
+ "output": ["text"]
371
+ }
372
+ },
373
+ "gemini-2.5-flash": {
374
+ "name": "Gemini 2.5 Flash (CLI)",
375
+ "limit": { "context": 1048576, "output": 65536 },
376
+ "modalities": {
377
+ "input": ["text", "image", "pdf"],
378
+ "output": ["text"]
379
+ }
380
+ },
381
+ "gemini-2.5-pro": {
382
+ "name": "Gemini 2.5 Pro (CLI)",
383
+ "limit": { "context": 1048576, "output": 65536 },
384
+ "modalities": {
385
+ "input": ["text", "image", "pdf"],
386
+ "output": ["text"]
387
+ }
388
+ },
389
+ "gemini-3-flash-preview": {
390
+ "name": "Gemini 3 Flash Preview (CLI)",
391
+ "limit": { "context": 1048576, "output": 65536 },
392
+ "modalities": {
393
+ "input": ["text", "image", "pdf"],
394
+ "output": ["text"]
395
+ }
396
+ },
397
+ "gemini-3-pro-preview": {
398
+ "name": "Gemini 3 Pro Preview (CLI)",
399
+ "limit": { "context": 1048576, "output": 65535 },
400
+ "modalities": {
401
+ "input": ["text", "image", "pdf"],
402
+ "output": ["text"]
403
+ }
404
+ }
405
+ }
406
+ }
407
+ }
408
+ }
409
+ ```
410
+
411
+ </details>
412
+
413
+ ## Multi-Account Setup
414
+
415
+ Add multiple Google accounts for higher combined quotas. The plugin automatically rotates between accounts when one is rate-limited.
416
+
417
+ ```bash
418
+ opencode auth login
419
+ ```
420
+
421
+ <details>
422
+ <summary><b>How multi-account works</b></summary>
423
+
424
+ ### Load Balancing Behavior
425
+
426
+ - **Sticky account selection** - Sticks to the same account until rate-limited (preserves Anthropic's prompt cache)
427
+ - **Per-model-family limits** - Rate limits tracked separately for Claude and Gemini models
428
+ - **Dual quota pools for Gemini** - Automatic fallback between Antigravity quota and Gemini CLI quota before switching accounts
429
+ - **Smart retry threshold** - Short rate limits (≤5s) are retried on same account
430
+ - **Exponential backoff** - Increasing delays for consecutive rate limits
431
+
432
+ ### Dual Quota Pools (Gemini only)
433
+
434
+ For Gemini models, the plugin accesses **two independent quota pools** per account:
435
+
436
+ | Quota Pool | When Used |
437
+ | --------------- | ----------------------------------------- |
438
+ | **Antigravity** | Primary (tried first) |
439
+ | **Gemini CLI** | Fallback when Antigravity is rate-limited |
440
+
441
+ This effectively **doubles your Gemini quota** per account.
442
+
443
+ ### Adding Accounts
444
+
445
+ When running `opencode auth login` with existing accounts:
446
+
447
+ ```
448
+ 2 account(s) saved:
449
+ 1. user1@gmail.com
450
+ 2. user2@gmail.com
451
+
452
+ (a)dd new account(s) or (f)resh start? [a/f]:
453
+ ```
454
+
455
+ ### Account Storage
456
+
457
+ - Stored in `~/.config/opencode/antigravity-accounts.json`
458
+ - Contains OAuth refresh tokens - **treat like a password**
459
+ - If Google revokes a token (`invalid_grant`), that account is automatically removed
460
+
461
+ </details>
462
+
463
+ ## Configuration
464
+
465
+ Create `~/.config/opencode/antigravity.json` (or `.opencode/antigravity.json` in project root):
466
+
467
+ ### General Settings
468
+
469
+ | Option | Default | Description |
470
+ | ------------- | ---------- | ---------------------------------------------- |
471
+ | `quiet_mode` | `false` | Suppress toast notifications (except recovery) |
472
+ | `debug` | `false` | Enable debug logging to file |
473
+ | `log_dir` | OS default | Custom directory for debug logs |
474
+ | `auto_update` | `true` | Enable automatic plugin updates |
475
+
476
+ ### Session Recovery
477
+
478
+ | Option | Default | Description |
479
+ | ------------------ | ------------ | -------------------------------------------- |
480
+ | `session_recovery` | `true` | Auto-recover from tool_result_missing errors |
481
+ | `auto_resume` | `true` | Auto-send resume prompt after recovery |
482
+ | `resume_text` | `"continue"` | Text to send when auto-resuming |
483
+
484
+ ### Error Recovery
485
+
486
+ | Option | Default | Description |
487
+ | ------------------------------- | ------- | ----------------------------------------------- |
488
+ | `empty_response_max_attempts` | `4` | Retries for empty API responses |
489
+ | `empty_response_retry_delay_ms` | `2000` | Delay between retries |
490
+ | `tool_id_recovery` | `true` | Fix mismatched tool IDs from context compaction |
491
+ | `claude_tool_hardening` | `true` | Prevent tool parameter hallucination |
492
+
493
+ ### Token Management
494
+
495
+ | Option | Default | Description |
496
+ | ---------------------------------- | ------- | --------------------------------------------- |
497
+ | `proactive_token_refresh` | `true` | Refresh tokens before expiry |
498
+ | `proactive_refresh_buffer_seconds` | `1800` | Refresh 30min before expiry |
499
+ | `max_rate_limit_wait_seconds` | `300` | Max wait time when rate limited (0=unlimited) |
500
+ | `quota_fallback` | `false` | Try alternate quota when rate limited |
501
+
502
+ ### Environment Overrides
503
+
504
+ ```bash
505
+ OPENCODE_ANTIGRAVITY_QUIET=1 # quiet_mode
506
+ OPENCODE_ANTIGRAVITY_DEBUG=1 # debug
507
+ OPENCODE_ANTIGRAVITY_LOG_DIR=/path # log_dir
508
+ OPENCODE_ANTIGRAVITY_KEEP_THINKING=1 # keep_thinking
509
+ ```
510
+
511
+ <details>
512
+ <summary><b>Full configuration example</b></summary>
513
+
514
+ ```json
515
+ {
516
+ "$schema": "https://raw.githubusercontent.com/Darkstarrd-dev/opencode-antigravity-auth/main/assets/antigravity.schema.json",
517
+ "quiet_mode": false,
518
+ "debug": false,
519
+ "log_dir": "/custom/log/path",
520
+ "auto_update": true,
521
+ "keep_thinking": false,
522
+ "session_recovery": true,
523
+ "auto_resume": true,
524
+ "resume_text": "continue",
525
+ "empty_response_max_attempts": 4,
526
+ "empty_response_retry_delay_ms": 2000,
527
+ "tool_id_recovery": true,
528
+ "claude_tool_hardening": true,
529
+ "proactive_token_refresh": true,
530
+ "proactive_refresh_buffer_seconds": 1800,
531
+ "proactive_refresh_check_interval_seconds": 300,
532
+ "max_rate_limit_wait_seconds": 300,
533
+ "quota_fallback": false,
534
+ "signature_cache": {
535
+ "enabled": true,
536
+ "memory_ttl_seconds": 3600,
537
+ "disk_ttl_seconds": 172800,
538
+ "write_interval_seconds": 60
539
+ }
540
+ }
541
+ ```
542
+
543
+ </details>
544
+
545
+ ## Troubleshoot
546
+
547
+ ### Multi account auth issues
548
+
549
+ If you encounter auth issue please try remove `antigravity-account.json` and auth again
550
+
551
+ ### Gemini model not found
552
+
553
+ Try add this line to in `google` field under `provider`
554
+ `"npm": "@ai-sdk/google"`
555
+
556
+ ### Error during the session
557
+
558
+ If you encounter error during the session, try chat `continue` the recover session mechanism should be trigger and you can continue the session, if the error blocked the session please workaround by use command `/undo` to revert to the state before the error and try again it should work
559
+
560
+ ## Known Plugin Interactions
561
+
562
+ ### @tarquinen/opencode-dcp
563
+
564
+ DCP creates synthetic assistant messages that lack thinking blocks. **Our plugin must be listed BEFORE DCP:**
565
+
566
+ ```json
567
+ {
568
+ "plugin": ["opencode-antigravity-auth@beta", "@tarquinen/opencode-dcp@latest"]
569
+ }
570
+ ```
571
+
572
+ ### oh-my-opencode
573
+
574
+ When using opencode-antigravity-auth, disable the built-in auth and override agent models in oh-my-opencode.json:
575
+
576
+ ```json
577
+ {
578
+ "google_auth": false,
579
+ "agents": {
580
+ "frontend-ui-ux-engineer": { "model": "google/gemini-3-pro-high" },
581
+ "document-writer": { "model": "google/gemini-3-flash" },
582
+ "multimodal-looker": { "model": "google/gemini-3-flash" }
583
+ }
584
+ }
585
+ ```
586
+
587
+ When spawning parallel subagents, multiple processes may select the same account causing rate limit errors. **Workaround:** Add more accounts via `opencode auth login`.
588
+
589
+ ### Plugins You Don't Need
590
+
591
+ - **gemini-auth plugins** - Not needed. This plugin handles all Google OAuth authentication.
592
+
593
+ <details>
594
+ <summary><b>Migration Guide (v1.2.7+)</b></summary>
595
+
596
+ If upgrading from v1.2.6 or earlier:
597
+
598
+ ### What Changed
599
+
600
+ v1.2.7+ uses explicit prefixes to distinguish quota sources:
601
+
602
+ | Model Type | New Name (Recommended) | Old Name (Still Works) |
603
+ | ---------------------- | ------------------------------- | ---------------------- |
604
+ | Gemini 3 (Antigravity) | `antigravity-gemini-3-pro-low` | `gemini-3-pro-low` |
605
+ | Gemini 3 (Antigravity) | `antigravity-gemini-3-pro-high` | `gemini-3-pro-high` |
606
+ | Gemini 3 (Antigravity) | `antigravity-gemini-3-flash` | `gemini-3-flash` |
607
+ | Gemini 3 (CLI) | `gemini-3-pro-preview` | N/A |
608
+ | Claude | `antigravity-claude-sonnet-4-5` | `claude-sonnet-4-5` |
609
+
610
+ ### Action Required
611
+
612
+ **Update your config to use `antigravity-` prefix:**
613
+
614
+ ```diff
615
+ - "gemini-3-pro-low": { ... }
616
+ + "antigravity-gemini-3-pro-low": { ... }
617
+ ```
618
+
619
+ > **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.
620
+
621
+ ### Step 1: Clear Old Tokens (Optional - do this if you have issues calling models)
622
+
623
+ ```bash
624
+ rm -rf ~/.config/opencode/antigravity-account.json
625
+ opencode auth login
626
+ ```
627
+
628
+ ### Step 2: Update opencode.json
629
+
630
+ Models now use `antigravity-` prefix for Antigravity quota. See [Available Models](#available-models).
631
+
632
+ ### Step 3: Create antigravity.json (Optional)
633
+
634
+ ```json
635
+ {
636
+ "$schema": "https://raw.githubusercontent.com/Darkstarrd-dev/opencode-antigravity-auth/main/assets/antigravity.schema.json",
637
+ "quiet_mode": false,
638
+ "debug": false
639
+ }
640
+ ```
641
+
642
+ </details>
643
+
644
+ <details>
645
+ <summary><b>E2E Testing</b></summary>
646
+
647
+ The plugin includes regression tests for stability verification. Tests consume API quota.
648
+
649
+ ```bash
650
+ # Sanity tests (7 tests, ~5 min)
651
+ npx tsx script/test-regression.ts --sanity
652
+
653
+ # Heavy tests (4 tests, ~30 min)
654
+ npx tsx script/test-regression.ts --heavy
655
+
656
+ # Concurrent tests (3 tests)
657
+ npx tsx script/test-regression.ts --category concurrency
658
+
659
+ # Run specific test
660
+ npx tsx script/test-regression.ts --test thinking-tool-use
661
+
662
+ # List tests without running
663
+ npx tsx script/test-regression.ts --dry-run
664
+ ```
665
+
666
+ </details>
667
+
668
+ ## Debugging
669
+
670
+ ```bash
671
+ OPENCODE_ANTIGRAVITY_DEBUG=1 opencode # Basic logging
672
+ OPENCODE_ANTIGRAVITY_DEBUG=2 opencode # Verbose (full request/response bodies)
673
+ ```
674
+
675
+ Logs are written to `~/.config/opencode/antigravity-logs/`.
676
+
677
+ ## Documentation
678
+
679
+ - [Architecture](docs/ARCHITECTURE.md) - Plugin internals and request flow
680
+ - [API Spec](docs/ANTIGRAVITY_API_SPEC.md) - Antigravity API reference
681
+
682
+ <details>
683
+ <summary><b>Safety, Usage & Legal</b></summary>
684
+
685
+ ### Intended Use
686
+
687
+ - Personal / internal development only
688
+ - Respect internal quotas and data handling policies
689
+ - Not for production services or bypassing intended limits
690
+
691
+ ### Warning (Assumption of Risk)
692
+
693
+ By using this plugin, you acknowledge:
694
+
695
+ - **Terms of Service risk** - This approach may violate ToS of AI model providers
696
+ - **Account risk** - Providers may suspend or ban accounts
697
+ - **No guarantees** - APIs may change without notice
698
+ - **Assumption of risk** - You assume all legal, financial, and technical risks
699
+
700
+ ### Legal
701
+
702
+ - Not affiliated with Google. This is an independent open-source project.
703
+ - "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
704
+ - Software is provided "as is", without warranty.
705
+
706
+ </details>
707
+
708
+ ## Credits
709
+
710
+ Built with help from:
711
+
712
+ - [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) - Gemini OAuth groundwork by [@jenslys](https://github.com/jenslys)
713
+ - [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) - Antigravity API reference
714
+
715
+ ## Support
716
+
717
+ If this plugin helps you, consider supporting its continued maintenance:
718
+
719
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/S6S81QBOIR)
720
+
721
+ ## License
722
+
723
+ MIT