@percygfx/opencode-antigravity-auth 0.0.0-stage → 2.0.1

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 (312) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +896 -3
  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/rpc.d.ts +176 -0
  8. package/dist/rpc.d.ts.map +1 -0
  9. package/dist/rpc.js +91 -0
  10. package/dist/rpc.js.map +1 -0
  11. package/dist/server.d.ts +3 -0
  12. package/dist/server.d.ts.map +1 -0
  13. package/dist/server.js +5 -0
  14. package/dist/server.js.map +1 -0
  15. package/dist/src/antigravity/oauth.d.ts +31 -0
  16. package/dist/src/antigravity/oauth.d.ts.map +1 -0
  17. package/dist/src/antigravity/oauth.js +171 -0
  18. package/dist/src/antigravity/oauth.js.map +1 -0
  19. package/dist/src/constants.d.ts +153 -0
  20. package/dist/src/constants.d.ts.map +1 -0
  21. package/dist/src/constants.js +238 -0
  22. package/dist/src/constants.js.map +1 -0
  23. package/dist/src/core/gateway.d.ts +43 -0
  24. package/dist/src/core/gateway.d.ts.map +1 -0
  25. package/dist/src/core/gateway.js +241 -0
  26. package/dist/src/core/gateway.js.map +1 -0
  27. package/dist/src/core/index.d.ts +8 -0
  28. package/dist/src/core/index.d.ts.map +1 -0
  29. package/dist/src/core/index.js +8 -0
  30. package/dist/src/core/index.js.map +1 -0
  31. package/dist/src/core/types.d.ts +60 -0
  32. package/dist/src/core/types.d.ts.map +1 -0
  33. package/dist/src/core/types.js +5 -0
  34. package/dist/src/core/types.js.map +1 -0
  35. package/dist/src/hooks/auto-update-checker/cache.d.ts +3 -0
  36. package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
  37. package/dist/src/hooks/auto-update-checker/cache.js +71 -0
  38. package/dist/src/hooks/auto-update-checker/cache.js.map +1 -0
  39. package/dist/src/hooks/auto-update-checker/checker.d.ts +16 -0
  40. package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
  41. package/dist/src/hooks/auto-update-checker/checker.js +234 -0
  42. package/dist/src/hooks/auto-update-checker/checker.js.map +1 -0
  43. package/dist/src/hooks/auto-update-checker/constants.d.ts +11 -0
  44. package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
  45. package/dist/src/hooks/auto-update-checker/constants.js +26 -0
  46. package/dist/src/hooks/auto-update-checker/constants.js.map +1 -0
  47. package/dist/src/hooks/auto-update-checker/index.d.ts +34 -0
  48. package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -0
  49. package/dist/src/hooks/auto-update-checker/index.js +122 -0
  50. package/dist/src/hooks/auto-update-checker/index.js.map +1 -0
  51. package/dist/src/hooks/auto-update-checker/logging.d.ts +3 -0
  52. package/dist/src/hooks/auto-update-checker/logging.d.ts.map +1 -0
  53. package/dist/src/hooks/auto-update-checker/logging.js +9 -0
  54. package/dist/src/hooks/auto-update-checker/logging.js.map +1 -0
  55. package/dist/src/hooks/auto-update-checker/types.d.ts +25 -0
  56. package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -0
  57. package/dist/src/hooks/auto-update-checker/types.js +1 -0
  58. package/dist/src/hooks/auto-update-checker/types.js.map +1 -0
  59. package/dist/src/opencode-v2/accounts.d.ts +24 -0
  60. package/dist/src/opencode-v2/accounts.d.ts.map +1 -0
  61. package/dist/src/opencode-v2/accounts.js +109 -0
  62. package/dist/src/opencode-v2/accounts.js.map +1 -0
  63. package/dist/src/opencode-v2/catalog.d.ts +31 -0
  64. package/dist/src/opencode-v2/catalog.d.ts.map +1 -0
  65. package/dist/src/opencode-v2/catalog.js +68 -0
  66. package/dist/src/opencode-v2/catalog.js.map +1 -0
  67. package/dist/src/opencode-v2/client-shim.d.ts +9 -0
  68. package/dist/src/opencode-v2/client-shim.d.ts.map +1 -0
  69. package/dist/src/opencode-v2/client-shim.js +42 -0
  70. package/dist/src/opencode-v2/client-shim.js.map +1 -0
  71. package/dist/src/opencode-v2/clipboard.d.ts +7 -0
  72. package/dist/src/opencode-v2/clipboard.d.ts.map +1 -0
  73. package/dist/src/opencode-v2/clipboard.js +54 -0
  74. package/dist/src/opencode-v2/clipboard.js.map +1 -0
  75. package/dist/src/opencode-v2/index.d.ts +5 -0
  76. package/dist/src/opencode-v2/index.d.ts.map +1 -0
  77. package/dist/src/opencode-v2/index.js +4 -0
  78. package/dist/src/opencode-v2/index.js.map +1 -0
  79. package/dist/src/opencode-v2/plugin.d.ts +23 -0
  80. package/dist/src/opencode-v2/plugin.d.ts.map +1 -0
  81. package/dist/src/opencode-v2/plugin.js +466 -0
  82. package/dist/src/opencode-v2/plugin.js.map +1 -0
  83. package/dist/src/opencode-v2/proxy.d.ts +23 -0
  84. package/dist/src/opencode-v2/proxy.d.ts.map +1 -0
  85. package/dist/src/opencode-v2/proxy.js +148 -0
  86. package/dist/src/opencode-v2/proxy.js.map +1 -0
  87. package/dist/src/opencode-v2/quota-format.d.ts +19 -0
  88. package/dist/src/opencode-v2/quota-format.d.ts.map +1 -0
  89. package/dist/src/opencode-v2/quota-format.js +71 -0
  90. package/dist/src/opencode-v2/quota-format.js.map +1 -0
  91. package/dist/src/opencode-v2/quota.d.ts +18 -0
  92. package/dist/src/opencode-v2/quota.d.ts.map +1 -0
  93. package/dist/src/opencode-v2/quota.js +118 -0
  94. package/dist/src/opencode-v2/quota.js.map +1 -0
  95. package/dist/src/opencode-v2/sign-in-attempts.d.ts +52 -0
  96. package/dist/src/opencode-v2/sign-in-attempts.d.ts.map +1 -0
  97. package/dist/src/opencode-v2/sign-in-attempts.js +81 -0
  98. package/dist/src/opencode-v2/sign-in-attempts.js.map +1 -0
  99. package/dist/src/plugin/account-models.d.ts +38 -0
  100. package/dist/src/plugin/account-models.d.ts.map +1 -0
  101. package/dist/src/plugin/account-models.js +78 -0
  102. package/dist/src/plugin/account-models.js.map +1 -0
  103. package/dist/src/plugin/accounts.d.ts +186 -0
  104. package/dist/src/plugin/accounts.d.ts.map +1 -0
  105. package/dist/src/plugin/accounts.js +1045 -0
  106. package/dist/src/plugin/accounts.js.map +1 -0
  107. package/dist/src/plugin/auth.d.ts +21 -0
  108. package/dist/src/plugin/auth.d.ts.map +1 -0
  109. package/dist/src/plugin/auth.js +46 -0
  110. package/dist/src/plugin/auth.js.map +1 -0
  111. package/dist/src/plugin/cache/index.d.ts +5 -0
  112. package/dist/src/plugin/cache/index.d.ts.map +1 -0
  113. package/dist/src/plugin/cache/index.js +5 -0
  114. package/dist/src/plugin/cache/index.js.map +1 -0
  115. package/dist/src/plugin/cache/signature-cache.d.ts +111 -0
  116. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -0
  117. package/dist/src/plugin/cache/signature-cache.js +375 -0
  118. package/dist/src/plugin/cache/signature-cache.js.map +1 -0
  119. package/dist/src/plugin/cache.d.ts +44 -0
  120. package/dist/src/plugin/cache.d.ts.map +1 -0
  121. package/dist/src/plugin/cache.js +200 -0
  122. package/dist/src/plugin/cache.js.map +1 -0
  123. package/dist/src/plugin/cli.d.ts +26 -0
  124. package/dist/src/plugin/cli.d.ts.map +1 -0
  125. package/dist/src/plugin/cli.js +119 -0
  126. package/dist/src/plugin/cli.js.map +1 -0
  127. package/dist/src/plugin/config/index.d.ts +16 -0
  128. package/dist/src/plugin/config/index.d.ts.map +1 -0
  129. package/dist/src/plugin/config/index.js +16 -0
  130. package/dist/src/plugin/config/index.js.map +1 -0
  131. package/dist/src/plugin/config/loader.d.ts +36 -0
  132. package/dist/src/plugin/config/loader.d.ts.map +1 -0
  133. package/dist/src/plugin/config/loader.js +140 -0
  134. package/dist/src/plugin/config/loader.js.map +1 -0
  135. package/dist/src/plugin/config/models.d.ts +41 -0
  136. package/dist/src/plugin/config/models.d.ts.map +1 -0
  137. package/dist/src/plugin/config/models.js +46 -0
  138. package/dist/src/plugin/config/models.js.map +1 -0
  139. package/dist/src/plugin/config/schema.d.ts +135 -0
  140. package/dist/src/plugin/config/schema.d.ts.map +1 -0
  141. package/dist/src/plugin/config/schema.js +438 -0
  142. package/dist/src/plugin/config/schema.js.map +1 -0
  143. package/dist/src/plugin/config/updater.d.ts +55 -0
  144. package/dist/src/plugin/config/updater.d.ts.map +1 -0
  145. package/dist/src/plugin/config/updater.js +125 -0
  146. package/dist/src/plugin/config/updater.js.map +1 -0
  147. package/dist/src/plugin/core/streaming/index.d.ts +3 -0
  148. package/dist/src/plugin/core/streaming/index.d.ts.map +1 -0
  149. package/dist/src/plugin/core/streaming/index.js +3 -0
  150. package/dist/src/plugin/core/streaming/index.js.map +1 -0
  151. package/dist/src/plugin/core/streaming/transformer.d.ts +10 -0
  152. package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -0
  153. package/dist/src/plugin/core/streaming/transformer.js +271 -0
  154. package/dist/src/plugin/core/streaming/transformer.js.map +1 -0
  155. package/dist/src/plugin/core/streaming/types.d.ts +27 -0
  156. package/dist/src/plugin/core/streaming/types.d.ts.map +1 -0
  157. package/dist/src/plugin/core/streaming/types.js +1 -0
  158. package/dist/src/plugin/core/streaming/types.js.map +1 -0
  159. package/dist/src/plugin/debug.d.ts +94 -0
  160. package/dist/src/plugin/debug.d.ts.map +1 -0
  161. package/dist/src/plugin/debug.js +382 -0
  162. package/dist/src/plugin/debug.js.map +1 -0
  163. package/dist/src/plugin/errors.d.ts +28 -0
  164. package/dist/src/plugin/errors.d.ts.map +1 -0
  165. package/dist/src/plugin/errors.js +42 -0
  166. package/dist/src/plugin/errors.js.map +1 -0
  167. package/dist/src/plugin/fingerprint.d.ts +70 -0
  168. package/dist/src/plugin/fingerprint.d.ts.map +1 -0
  169. package/dist/src/plugin/fingerprint.js +138 -0
  170. package/dist/src/plugin/fingerprint.js.map +1 -0
  171. package/dist/src/plugin/image-saver.d.ts +25 -0
  172. package/dist/src/plugin/image-saver.d.ts.map +1 -0
  173. package/dist/src/plugin/image-saver.js +86 -0
  174. package/dist/src/plugin/image-saver.js.map +1 -0
  175. package/dist/src/plugin/logger.d.ts +36 -0
  176. package/dist/src/plugin/logger.d.ts.map +1 -0
  177. package/dist/src/plugin/logger.js +71 -0
  178. package/dist/src/plugin/logger.js.map +1 -0
  179. package/dist/src/plugin/logging-utils.d.ts +23 -0
  180. package/dist/src/plugin/logging-utils.d.ts.map +1 -0
  181. package/dist/src/plugin/logging-utils.js +92 -0
  182. package/dist/src/plugin/logging-utils.js.map +1 -0
  183. package/dist/src/plugin/model-discovery.d.ts +28 -0
  184. package/dist/src/plugin/model-discovery.d.ts.map +1 -0
  185. package/dist/src/plugin/model-discovery.js +59 -0
  186. package/dist/src/plugin/model-discovery.js.map +1 -0
  187. package/dist/src/plugin/model-registry.d.ts +108 -0
  188. package/dist/src/plugin/model-registry.d.ts.map +1 -0
  189. package/dist/src/plugin/model-registry.js +304 -0
  190. package/dist/src/plugin/model-registry.js.map +1 -0
  191. package/dist/src/plugin/project.d.ts +33 -0
  192. package/dist/src/plugin/project.d.ts.map +1 -0
  193. package/dist/src/plugin/project.js +235 -0
  194. package/dist/src/plugin/project.js.map +1 -0
  195. package/dist/src/plugin/quota.d.ts +58 -0
  196. package/dist/src/plugin/quota.d.ts.map +1 -0
  197. package/dist/src/plugin/quota.js +296 -0
  198. package/dist/src/plugin/quota.js.map +1 -0
  199. package/dist/src/plugin/recovery/constants.d.ts +22 -0
  200. package/dist/src/plugin/recovery/constants.d.ts.map +1 -0
  201. package/dist/src/plugin/recovery/constants.js +43 -0
  202. package/dist/src/plugin/recovery/constants.js.map +1 -0
  203. package/dist/src/plugin/recovery/index.d.ts +12 -0
  204. package/dist/src/plugin/recovery/index.d.ts.map +1 -0
  205. package/dist/src/plugin/recovery/index.js +12 -0
  206. package/dist/src/plugin/recovery/index.js.map +1 -0
  207. package/dist/src/plugin/recovery/storage.d.ts +24 -0
  208. package/dist/src/plugin/recovery/storage.d.ts.map +1 -0
  209. package/dist/src/plugin/recovery/storage.js +354 -0
  210. package/dist/src/plugin/recovery/storage.js.map +1 -0
  211. package/dist/src/plugin/recovery/types.d.ts +116 -0
  212. package/dist/src/plugin/recovery/types.d.ts.map +1 -0
  213. package/dist/src/plugin/recovery/types.js +6 -0
  214. package/dist/src/plugin/recovery/types.js.map +1 -0
  215. package/dist/src/plugin/recovery.d.ts +61 -0
  216. package/dist/src/plugin/recovery.d.ts.map +1 -0
  217. package/dist/src/plugin/recovery.js +381 -0
  218. package/dist/src/plugin/recovery.js.map +1 -0
  219. package/dist/src/plugin/refresh-queue.d.ts +100 -0
  220. package/dist/src/plugin/refresh-queue.d.ts.map +1 -0
  221. package/dist/src/plugin/refresh-queue.js +247 -0
  222. package/dist/src/plugin/refresh-queue.js.map +1 -0
  223. package/dist/src/plugin/request-helpers.d.ts +282 -0
  224. package/dist/src/plugin/request-helpers.d.ts.map +1 -0
  225. package/dist/src/plugin/request-helpers.js +2343 -0
  226. package/dist/src/plugin/request-helpers.js.map +1 -0
  227. package/dist/src/plugin/request.d.ts +95 -0
  228. package/dist/src/plugin/request.d.ts.map +1 -0
  229. package/dist/src/plugin/request.js +1491 -0
  230. package/dist/src/plugin/request.js.map +1 -0
  231. package/dist/src/plugin/rotation.d.ts +169 -0
  232. package/dist/src/plugin/rotation.d.ts.map +1 -0
  233. package/dist/src/plugin/rotation.js +328 -0
  234. package/dist/src/plugin/rotation.js.map +1 -0
  235. package/dist/src/plugin/search.d.ts +32 -0
  236. package/dist/src/plugin/search.d.ts.map +1 -0
  237. package/dist/src/plugin/search.js +195 -0
  238. package/dist/src/plugin/search.js.map +1 -0
  239. package/dist/src/plugin/server.d.ts +23 -0
  240. package/dist/src/plugin/server.d.ts.map +1 -0
  241. package/dist/src/plugin/server.js +324 -0
  242. package/dist/src/plugin/server.js.map +1 -0
  243. package/dist/src/plugin/storage.d.ts +173 -0
  244. package/dist/src/plugin/storage.d.ts.map +1 -0
  245. package/dist/src/plugin/storage.js +674 -0
  246. package/dist/src/plugin/storage.js.map +1 -0
  247. package/dist/src/plugin/stores/signature-store.d.ts +5 -0
  248. package/dist/src/plugin/stores/signature-store.d.ts.map +1 -0
  249. package/dist/src/plugin/stores/signature-store.js +25 -0
  250. package/dist/src/plugin/stores/signature-store.js.map +1 -0
  251. package/dist/src/plugin/thinking-recovery.d.ts +90 -0
  252. package/dist/src/plugin/thinking-recovery.d.ts.map +1 -0
  253. package/dist/src/plugin/thinking-recovery.js +316 -0
  254. package/dist/src/plugin/thinking-recovery.js.map +1 -0
  255. package/dist/src/plugin/token.d.ts +19 -0
  256. package/dist/src/plugin/token.d.ts.map +1 -0
  257. package/dist/src/plugin/token.js +128 -0
  258. package/dist/src/plugin/token.js.map +1 -0
  259. package/dist/src/plugin/transform/claude.d.ts +80 -0
  260. package/dist/src/plugin/transform/claude.d.ts.map +1 -0
  261. package/dist/src/plugin/transform/claude.js +265 -0
  262. package/dist/src/plugin/transform/claude.js.map +1 -0
  263. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +35 -0
  264. package/dist/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
  265. package/dist/src/plugin/transform/cross-model-sanitizer.js +225 -0
  266. package/dist/src/plugin/transform/cross-model-sanitizer.js.map +1 -0
  267. package/dist/src/plugin/transform/gemini.d.ts +100 -0
  268. package/dist/src/plugin/transform/gemini.d.ts.map +1 -0
  269. package/dist/src/plugin/transform/gemini.js +446 -0
  270. package/dist/src/plugin/transform/gemini.js.map +1 -0
  271. package/dist/src/plugin/transform/index.d.ts +15 -0
  272. package/dist/src/plugin/transform/index.d.ts.map +1 -0
  273. package/dist/src/plugin/transform/index.js +14 -0
  274. package/dist/src/plugin/transform/index.js.map +1 -0
  275. package/dist/src/plugin/transform/model-resolver.d.ts +99 -0
  276. package/dist/src/plugin/transform/model-resolver.d.ts.map +1 -0
  277. package/dist/src/plugin/transform/model-resolver.js +340 -0
  278. package/dist/src/plugin/transform/model-resolver.js.map +1 -0
  279. package/dist/src/plugin/transform/types.d.ts +111 -0
  280. package/dist/src/plugin/transform/types.d.ts.map +1 -0
  281. package/dist/src/plugin/transform/types.js +1 -0
  282. package/dist/src/plugin/transform/types.js.map +1 -0
  283. package/dist/src/plugin/types.d.ts +97 -0
  284. package/dist/src/plugin/types.d.ts.map +1 -0
  285. package/dist/src/plugin/types.js +1 -0
  286. package/dist/src/plugin/types.js.map +1 -0
  287. package/dist/src/plugin/ui/ansi.d.ts +32 -0
  288. package/dist/src/plugin/ui/ansi.d.ts.map +1 -0
  289. package/dist/src/plugin/ui/ansi.js +52 -0
  290. package/dist/src/plugin/ui/ansi.js.map +1 -0
  291. package/dist/src/plugin/ui/auth-menu.d.ts +33 -0
  292. package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -0
  293. package/dist/src/plugin/ui/auth-menu.js +110 -0
  294. package/dist/src/plugin/ui/auth-menu.js.map +1 -0
  295. package/dist/src/plugin/ui/confirm.d.ts +2 -0
  296. package/dist/src/plugin/ui/confirm.d.ts.map +1 -0
  297. package/dist/src/plugin/ui/confirm.js +15 -0
  298. package/dist/src/plugin/ui/confirm.js.map +1 -0
  299. package/dist/src/plugin/ui/select.d.ts +23 -0
  300. package/dist/src/plugin/ui/select.d.ts.map +1 -0
  301. package/dist/src/plugin/ui/select.js +254 -0
  302. package/dist/src/plugin/ui/select.js.map +1 -0
  303. package/dist/src/plugin/version.d.ts +19 -0
  304. package/dist/src/plugin/version.d.ts.map +1 -0
  305. package/dist/src/plugin/version.js +80 -0
  306. package/dist/src/plugin/version.js.map +1 -0
  307. package/dist/src/plugin.d.ts +51 -0
  308. package/dist/src/plugin.d.ts.map +1 -0
  309. package/dist/src/plugin.js +2852 -0
  310. package/dist/src/plugin.js.map +1 -0
  311. package/dist/tui.js +420 -0
  312. package/package.json +99 -6
package/README.md CHANGED
@@ -1,3 +1,896 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # Antigravity + Gemini CLI OAuth Plugin for Opencode (OpenCode 2 supported)
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
4
+ [![X (Twitter)](https://img.shields.io/badge/X-@dopesalmon-000000?style=flat&logo=x)](https://x.com/dopesalmon)
5
+
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.1-pro` and `claude-opus-4-6-thinking` with your Google credentials.
7
+
8
+ > [!NOTE]
9
+ > **OpenCode 2.x support.** This fork ([PercyGFX/opencode-antigravity-auth](https://github.com/PercyGFX/opencode-antigravity-auth)) adds an OpenCode 2 entry point (`server.ts`), published on npm as [`@percygfx/opencode-antigravity-auth`](https://www.npmjs.com/package/@percygfx/opencode-antigravity-auth). OpenCode 2 ignores plugins written for 1.x. The tell-tale sign is that `opencode auth login google` only offers an API key. OpenCode 1.x keeps loading the original entry point unchanged, see [OpenCode 1.x](#opencode-1x).
10
+
11
+ ## What You Get
12
+
13
+ - **Gemini 3.8 Flash, Claude Opus/Sonnet 4.6** and the rest of Antigravity's models via Google OAuth
14
+ - **Automatic model list** — the models come from Antigravity's own Recommended list, so new ones appear without a plugin update (OpenCode 2)
15
+ - **Limits in the sidebar** — each account's 5-hour and weekly quota and the account serving your model, right in the TUI (OpenCode 2)
16
+ - **Multi-account support** — add multiple Google accounts, auto-rotates when rate-limited; manage them from the TUI with `/antigravity` (OpenCode 2)
17
+ - **Dual quota system** — access both Antigravity and Gemini CLI quotas from one plugin
18
+ - **Thinking models** — extended thinking for Claude and Gemini 3 with configurable budgets
19
+ - **Sign in with any browser** — the plugin never opens a browser itself; it copies the link so you choose the browser or profile (OpenCode 2)
20
+ - **Google Search grounding** — enable web search for Gemini models (auto or always-on; the `google_search` tool is OpenCode 1.x only for now)
21
+ - **Auto-recovery** — handles session errors and tool failures automatically (thinking-block recovery on both versions; recovery of interrupted tool calls is OpenCode 1.x only)
22
+ - **Plugin compatible** — works alongside other OpenCode plugins (oh-my-opencode, dcp, etc.)
23
+
24
+ ---
25
+
26
+ <details open>
27
+ <summary><b>⚠️ Terms of Service Warning — Read Before Installing</b></summary>
28
+
29
+ > [!CAUTION]
30
+ > Using this plugin (and any proxy for Antigravity) violates Google's Terms of Service. A number of users have reported their Google accounts being **banned** or **shadow-banned** (restricted access without explicit notification).
31
+ >
32
+ > **By using this plugin, you acknowledge:**
33
+ > - This is an unofficial tool not endorsed by Google
34
+ > - Your account may be suspended or permanently banned
35
+ > - You assume all risks associated with using this plugin
36
+ >
37
+
38
+ </details>
39
+
40
+ ---
41
+
42
+ ## Installation
43
+
44
+ These steps are for **OpenCode 2.x**. Check your version with `opencode --version`. For 1.x, see [OpenCode 1.x](#opencode-1x).
45
+
46
+ ### Quick Start
47
+
48
+ ```bash
49
+ opencode plugin add @percygfx/opencode-antigravity-auth
50
+ ```
51
+
52
+ Then open `opencode`, run `/antigravity` → **Add account**, and sign in with Google. The models appear in the model picker under **Google Antigravity**, and the sidebar shows your 5-hour and weekly limits. The steps below explain each part.
53
+
54
+ <details open>
55
+ <summary><b>For Humans</b></summary>
56
+
57
+ **Option A: Let an LLM do it**
58
+
59
+ Paste this into any LLM agent (Claude Code, OpenCode, Cursor, etc.):
60
+
61
+ ```
62
+ Install the OpenCode 2 build of the opencode-antigravity-auth plugin by following the "For LLM Agents" steps in: https://github.com/PercyGFX/opencode-antigravity-auth/blob/opencode-v2/README.md
63
+ ```
64
+
65
+ **Option B: Manual setup**
66
+
67
+ 1. **Install the plugin** with one command:
68
+
69
+ ```bash
70
+ opencode plugin add @percygfx/opencode-antigravity-auth
71
+ ```
72
+
73
+ OpenCode downloads the package and adds it to the `plugins` list in `~/.config/opencode/opencode.json`. There is no need for `npm install -g`: OpenCode keeps its own copy and checks for new versions by itself.
74
+
75
+ 2. **Check it loaded:** `opencode plugin list` should list `opencode-antigravity-auth`. Right after the background service starts, the list can take a few seconds to fill in. If OpenCode was already running and the plugin is missing, restart it: `opencode service restart`.
76
+
77
+ > **Upgrading from 1.x?** Remove the 1.x `opencode-antigravity-auth` entry from the `plugin` list in `opencode.json`, and remove the `provider.google.models` block that 1.x setups added. The models now come from the plugin, under the `google-antigravity` provider. The old block would only add copies under `google` that bypass the plugin.
78
+
79
+ 3. **Sign in** with your Google account, using any of:
80
+ - **TUI:** run `/antigravity` → **Add account**.
81
+ - **TUI:** run `/connect` (or choose **Connect an integration** in the model picker) → **Google Antigravity**. Sending a prompt with nothing connected opens the same dialog.
82
+ - **CLI:** `opencode auth login google-antigravity`
83
+
84
+ Pick one of two sign-in methods:
85
+
86
+ **Google account (Antigravity)**, for a browser on the same computer:
87
+ 1. The sign-in link is copied to your clipboard and also shown on screen. In the TUI, `c` copies it again and `o` opens it.
88
+ 2. Open it in any browser or profile on this computer and sign in with Google.
89
+ 3. The browser shows an **"All set!"** page and the sign-in finishes by itself. There is nothing to paste.
90
+
91
+ **Google account (Antigravity, paste the redirect URL)**, for a browser on another machine (SSH, containers):
92
+ 1. Open the sign-in link in any browser and sign in with Google.
93
+ 2. Google redirects to `http://localhost:51121/oauth-callback?...`. That page does not load, which is expected. Copy the **full URL** from the address bar.
94
+ 3. Paste it into the prompt and press Enter. The bare `code` value also works.
95
+
96
+ The first method switches to pasting by itself when port 51121 is busy, or in WSL and remote sessions.
97
+
98
+ > The plugin never opens a browser. `opencode auth login` (the CLI) does open the link in your default browser when it runs in a terminal. That is OpenCode's own behaviour and a plugin cannot turn it off, so use the TUI dialog if you want to pick the browser.
99
+
100
+ Sign in again to add more accounts. Each login is labeled with its Google email in `opencode auth list`.
101
+
102
+ 4. **Use it:** pick a model under **Google Antigravity** in the model picker, or from the CLI:
103
+
104
+ ```bash
105
+ opencode run "Hello" --model google-antigravity/antigravity-claude-opus-4-6-thinking#max
106
+ ```
107
+
108
+ The sidebar shows each account's 5-hour and weekly limits. Click an account there, or run `/antigravity`, to add, disable, re-authenticate or remove accounts.
109
+
110
+ 5. **Update or uninstall:**
111
+
112
+ ```bash
113
+ opencode plugin update # update now (OpenCode also checks by itself)
114
+ opencode plugin remove @percygfx/opencode-antigravity-auth # uninstall
115
+ ```
116
+
117
+ **Option C: From source** (to work on the plugin)
118
+
119
+ ```bash
120
+ git clone -b opencode-v2 https://github.com/PercyGFX/opencode-antigravity-auth.git
121
+ cd opencode-antigravity-auth
122
+ npm install
123
+ ```
124
+
125
+ Add the **folder** to the `plugins` list in `~/.config/opencode/opencode.json`, for example `"plugins": ["C:/Users/you/opencode-antigravity-auth"]` (forward slashes on Windows). Point at the folder, not a file: OpenCode 2 skips a path to a single `.js` file and logs `configured plugin path must be a directory`. OpenCode runs `server.ts` and `tui.tsx` directly, so there is no build step. Use either the folder or the npm package, not both.
126
+
127
+ </details>
128
+
129
+ <details>
130
+ <summary><b>For LLM Agents</b></summary>
131
+
132
+ ### Step-by-Step Instructions
133
+
134
+ 1. Check that OpenCode is 2.x: `opencode --version`. For 1.x, follow [OpenCode 1.x](#opencode-1x) instead.
135
+
136
+ 2. Install the plugin. This also adds it to the global OpenCode configuration:
137
+
138
+ ```bash
139
+ opencode plugin add @percygfx/opencode-antigravity-auth
140
+ ```
141
+
142
+ Check with `opencode plugin list` (it can take a few seconds after the background service starts). If OpenCode was already running and the plugin is missing, run `opencode service restart`.
143
+
144
+ 3. Open the OpenCode configuration file at `~/.config/opencode/opencode.json` (or `opencode.jsonc`). If its `plugin` list still has a 1.x `opencode-antigravity-auth` entry (such as `opencode-antigravity-auth@latest`), remove that entry.
145
+
146
+ > **Note**: This path works on all platforms. On Windows, `~` resolves to your user home directory (e.g., `C:\Users\YourName`).
147
+
148
+ 4. Remove any `provider.google.models` entries named `antigravity-*` or `gemini-*` left over from a 1.x setup. Do not add model definitions: the plugin registers them under the `google-antigravity` provider.
149
+
150
+ 5. Ask the user to sign in, either with `opencode auth login google-antigravity` or from the TUI (`/connect` → **Google Antigravity**). Sign-in needs the user to sign in to Google in a browser, so an agent cannot finish it alone.
151
+
152
+ ### Verification
153
+
154
+ ```bash
155
+ opencode plugin list # lists opencode-antigravity-auth
156
+ opencode run "Hello" --model google-antigravity/antigravity-claude-opus-4-6-thinking#max
157
+ ```
158
+
159
+ </details>
160
+
161
+ <details>
162
+ <summary><b id="opencode-1x">OpenCode 1.x</b></summary>
163
+
164
+ OpenCode 1.x loads the original v1 entry point. Use the original npm package, `opencode-antigravity-auth`:
165
+
166
+ 1. **Add the plugin** to `~/.config/opencode/opencode.json`:
167
+
168
+ ```json
169
+ {
170
+ "plugin": ["opencode-antigravity-auth@latest"]
171
+ }
172
+ ```
173
+
174
+ > Want bleeding-edge features? Use `opencode-antigravity-auth@beta` instead.
175
+
176
+ 2. **Login** with your Google account:
177
+
178
+ ```bash
179
+ opencode auth login
180
+ ```
181
+
182
+ 3. **Add models** — choose one:
183
+ - Run `opencode auth login` → Google → OAuth with Google (Antigravity) → select **"Configure models in opencode.json"** (auto-configures all models)
184
+ - Or manually copy the [full configuration](#models) below
185
+
186
+ 4. **Use it:**
187
+
188
+ ```bash
189
+ opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
190
+ ```
191
+
192
+ </details>
193
+
194
+ ---
195
+
196
+ ## Models
197
+
198
+ ### Model Reference
199
+
200
+ **The model list comes from Antigravity itself.** On OpenCode 2 the plugin asks Antigravity for its **Recommended** models after you sign in, and again every 6 hours, then registers them under the `google-antigravity` provider. New models appear without a plugin update, and retired ones disappear. Until the first discovery (before sign-in, or offline) a built-in list is used; the last discovered list is cached in `~/.config/opencode/antigravity-models.json`. Refer to a model as `google-antigravity/<model>`. On **OpenCode 1.x** the models live under `google/<model>` and come from the [configuration block](#models) below.
201
+
202
+ Models Antigravity recommended at release (October 2026):
203
+
204
+ | Model | Variants | Notes |
205
+ |-------|----------|-------|
206
+ | `antigravity-gemini-3.8-flash` | low, medium, high | Gemini 3.8 Flash, Antigravity's default model |
207
+ | `antigravity-gemini-3.7-flash` | low, medium, high | Gemini 3.7 Flash (Antigravity: "Leaving Soon") |
208
+ | `antigravity-gemini-3.6-flash` | low, medium, high | Gemini 3.6 Flash (Antigravity: "Leaving Soon") |
209
+ | `antigravity-gemini-3.1-pro` | low, high | Gemini 3.1 Pro (Antigravity: "Leaving Soon") |
210
+ | `antigravity-claude-sonnet-4-6` | — | Claude Sonnet 4.6 |
211
+ | `antigravity-claude-opus-4-6-thinking` | low, max | Claude Opus 4.6 with extended thinking |
212
+ | `antigravity-gpt-oss-120b-medium` | — | GPT-OSS 120B (Antigravity: removed November 2, 2026) |
213
+
214
+ Antigravity notes that Claude access on free plans ends **November 2, 2026**, and that Sonnet/Opus 5.5 are available on paid Pro and Ultra plans. Whatever your accounts are offered shows up automatically.
215
+
216
+ > **What the variants do:** each Gemini tier is its own upstream model (e.g. `gemini-3.8-flash-high`), and the plugin sends the one you pick. Without a variant, Antigravity's default tier (high) is used. Claude variants set the thinking budget.
217
+
218
+ > **Routing:** Gemini models share one Antigravity quota, Claude and GPT-OSS share another. Models from Antigravity's list never fall back to the Gemini CLI quota: they don't exist there, and accounts without a Gemini CLI license would get a 403. Older Gemini model names you request directly still follow `cli_first` and the automatic fallback.
219
+
220
+ > **See what your account is offered:** `node scripts/list-models.mjs` (add `--account 2` for another account, `--all` for models outside the Recommended list).
221
+
222
+ **Using variants:**
223
+ ```bash
224
+ # OpenCode 2: append the variant to the model with "#"
225
+ opencode run "Hello" --model google-antigravity/antigravity-claude-opus-4-6-thinking#max
226
+
227
+ # OpenCode 1.x
228
+ opencode run "Hello" --model=google/antigravity-claude-opus-4-6-thinking --variant=max
229
+ ```
230
+
231
+ For details on variant configuration and thinking levels, see [docs/MODEL-VARIANTS.md](docs/MODEL-VARIANTS.md).
232
+
233
+ <details>
234
+ <summary><b>Full models configuration (copy-paste ready, OpenCode 1.x only)</b></summary>
235
+
236
+ > OpenCode 2 does not need this block, so do not add it there. The plugin registers these models itself, and this block would only create copies under `google` that bypass the plugin.
237
+
238
+ Add this to your `~/.config/opencode/opencode.json`:
239
+
240
+ ```json
241
+ {
242
+ "$schema": "https://opencode.ai/config.json",
243
+ "plugin": ["opencode-antigravity-auth@latest"],
244
+ "provider": {
245
+ "google": {
246
+ "models": {
247
+ "antigravity-gemini-3.8-flash": {
248
+ "name": "Gemini 3.8 Flash (Antigravity)",
249
+ "limit": { "context": 1048576, "output": 65536 },
250
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
251
+ "variants": {
252
+ "low": { "thinkingLevel": "low" },
253
+ "medium": { "thinkingLevel": "medium" },
254
+ "high": { "thinkingLevel": "high" }
255
+ }
256
+ },
257
+ "antigravity-gemini-3.7-flash": {
258
+ "name": "Gemini 3.7 Flash (Antigravity)",
259
+ "limit": { "context": 1048576, "output": 65536 },
260
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
261
+ "variants": {
262
+ "low": { "thinkingLevel": "low" },
263
+ "medium": { "thinkingLevel": "medium" },
264
+ "high": { "thinkingLevel": "high" }
265
+ }
266
+ },
267
+ "antigravity-gemini-3.6-flash": {
268
+ "name": "Gemini 3.6 Flash (Antigravity)",
269
+ "limit": { "context": 1048576, "output": 65536 },
270
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
271
+ "variants": {
272
+ "low": { "thinkingLevel": "low" },
273
+ "medium": { "thinkingLevel": "medium" },
274
+ "high": { "thinkingLevel": "high" }
275
+ }
276
+ },
277
+ "antigravity-gemini-3.1-pro": {
278
+ "name": "Gemini 3.1 Pro (Antigravity)",
279
+ "limit": { "context": 1048576, "output": 65536 },
280
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
281
+ "variants": {
282
+ "low": { "thinkingLevel": "low" },
283
+ "high": { "thinkingLevel": "high" }
284
+ }
285
+ },
286
+ "antigravity-claude-sonnet-4-6": {
287
+ "name": "Claude Sonnet 4.6 (Thinking) (Antigravity)",
288
+ "limit": { "context": 250000, "output": 64000 },
289
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }
290
+ },
291
+ "antigravity-claude-opus-4-6-thinking": {
292
+ "name": "Claude Opus 4.6 (Thinking) (Antigravity)",
293
+ "limit": { "context": 250000, "output": 64000 },
294
+ "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] },
295
+ "variants": {
296
+ "low": { "thinkingConfig": { "thinkingBudget": 8192 } },
297
+ "max": { "thinkingConfig": { "thinkingBudget": 32768 } }
298
+ }
299
+ },
300
+ "antigravity-gpt-oss-120b-medium": {
301
+ "name": "GPT-OSS 120B (Medium) (Antigravity)",
302
+ "limit": { "context": 131072, "output": 32768 },
303
+ "modalities": { "input": ["text"], "output": ["text"] }
304
+ }
305
+ }
306
+ }
307
+ }
308
+ }
309
+ ```
310
+
311
+ > **Backward Compatibility:** Legacy model names with `antigravity-` prefix (e.g., `antigravity-gemini-3-flash`) still work. The plugin automatically handles model name transformation for both Antigravity and Gemini CLI APIs.
312
+
313
+ </details>
314
+
315
+ ---
316
+
317
+ ## Multi-Account Setup
318
+
319
+ Add multiple Google accounts for a higher combined quota. The plugin automatically rotates between accounts when one is rate-limited.
320
+
321
+ ```bash
322
+ opencode auth login google-antigravity # OpenCode 2: run again to add more accounts
323
+ opencode auth login # OpenCode 1.x
324
+ ```
325
+
326
+ Each sign-in adds one account to `~/.config/opencode/antigravity-accounts.json`, the same file 1.x uses, so accounts added under 1.x keep working.
327
+
328
+ ### Accounts and limits in the TUI (OpenCode 2)
329
+
330
+ The session sidebar has an **Antigravity · limits** section:
331
+
332
+ ```
333
+ Antigravity · limits
334
+ • you@gmail.com in use
335
+ Gemini 5h 99% 4h 16m
336
+ wk 99% 6d 23h
337
+ Claude & GPT 5h 100% 5h 00m
338
+ wk 100% 6d 23h
339
+ • other@gmail.com Claude
340
+ Gemini 5h 98% 4h 15m
341
+ ...
342
+ manage: /antigravity
343
+ ```
344
+
345
+ - **Limits** — the same numbers as Antigravity's *Settings → Models*: for each model group (Gemini; Claude & GPT), the remaining share of the **5-hour** limit (`5h`) and the **weekly** limit (`wk`), and when each fully refreshes. The 5-hour limit spreads global capacity across all users; the weekly limit depends on your plan. The dot turns yellow at 30% and red at 10% on either window.
346
+ - **In use** — the account currently serving the selected model's group is bold and marked *in use*; the other accounts show which group they serve.
347
+ - **Manage** — click an account, or run `/antigravity` (also in the command palette as *Antigravity accounts*):
348
+ - **Disable / Enable** — take the account out of rotation or put it back
349
+ - **Re-authenticate** — shows the sign-in link right away (also copied to your clipboard), with that Google account preselected. Sign in and the dialog closes by itself; if the browser says the page can't be reached, paste that page's URL into the dialog instead. Only the plugin's account is updated, so no extra opencode login is created.
350
+ - **Remove** — removes the account from the plugin (asks first)
351
+ - **Add account** (in `/antigravity`) — the same sign-in dialog, for another Google account. Your very first account goes through `/connect` instead, which creates opencode's Antigravity login.
352
+
353
+ The limits refresh every 2 minutes and after each response. `opencode auth logout google-antigravity` signs out of opencode's Antigravity login; after removing your last account, use it to sign out completely.
354
+
355
+ **Account management options (OpenCode 1.x, via `opencode auth login`):**
356
+ - **Configure models** — Auto-configure all plugin models in opencode.json
357
+ - **Check quotas** — View remaining API quota for each account
358
+ - **Manage accounts** — Enable/disable specific accounts for rotation
359
+
360
+ For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
361
+
362
+ ---
363
+
364
+ ## Troubleshooting
365
+
366
+ > **Quick Reset**: Most issues can be resolved by deleting `~/.config/opencode/antigravity-accounts.json` and signing in again. On OpenCode 2, also run `opencode auth logout google-antigravity` first, then `opencode auth login google-antigravity`. On 1.x, run `opencode auth login`.
367
+
368
+ ### OpenCode 2: Login Only Offers "Google API key"
369
+
370
+ **Cause:** A 1.x build of this plugin is installed. OpenCode 2 does not run 1.x plugins, so the Antigravity sign-in never registers. The `google` integration only has OpenCode's built-in API-key method.
371
+
372
+ **Solution:** Install the OpenCode 2 build (see [Installation](#installation)), then sign in under **`google-antigravity`** instead of `google`:
373
+
374
+ ```bash
375
+ opencode auth login google-antigravity
376
+ ```
377
+
378
+ ---
379
+
380
+ ### OpenCode 2: Plugin Not Loading
381
+
382
+ 1. Run `opencode plugin list`. `opencode-antigravity-auth` should be listed, with `@percygfx/opencode-antigravity-auth` (or your source folder) as its source. Right after the background service starts, give it a few seconds and run it again.
383
+ 2. A source checkout's entry must be the plugin **folder**. OpenCode 2 skips a path to a single `.js` file and logs `configured plugin path must be a directory`.
384
+ 3. A package or folder without a default-exported v2 plugin fails with `Plugin must export a default definition with an id and an effect or setup function`. That is the 1.x package (`opencode-antigravity-auth`); install `@percygfx/opencode-antigravity-auth` instead.
385
+ 4. Check the OpenCode log, `~/.local/share/opencode/log/opencode.log`: `failed to load plugin` is the server part (sign-in, models), `plugin operation failed` the TUI part (sidebar limits, `/antigravity`).
386
+ 5. After editing a source checkout, restart the background service: `opencode service restart`.
387
+
388
+ ---
389
+
390
+ ### OpenCode 2: "Not signed in to Google Antigravity"
391
+
392
+ The `google-antigravity` models only appear after you sign in. If a request still fails with this message, the connection is missing or its token could not be refreshed. Sign in again with `opencode auth login google-antigravity`.
393
+
394
+ ---
395
+
396
+ ### OpenCode 2: A Model Is Missing, or a New One Doesn't Show Up
397
+
398
+ The model list follows Antigravity's **Recommended** list for your account. It is refreshed after each sign-in and every 6 hours. To see what Antigravity offers your accounts right now:
399
+
400
+ ```bash
401
+ node scripts/list-models.mjs # first enabled account
402
+ node scripts/list-models.mjs --account 2 # another account
403
+ node scripts/list-models.mjs --all # include models outside the Recommended list
404
+ ```
405
+
406
+ A model listed there but missing in OpenCode appears after the next refresh: sign in again, or restart the service with `opencode service restart` once the cached list is more than 6 hours old. Models outside the Recommended list (e.g. Gemini 3 Flash, Gemini 3.5 Flash) are not added; Antigravity has superseded them.
407
+
408
+ ---
409
+
410
+ ### OpenCode 2: "Not Available on Your Current Plan" / No Sonnet or Opus 5.5
411
+
412
+ Antigravity decides which models an account gets. Its notices say Claude access on free plans ends November 2, 2026, and that Sonnet/Opus 5.5 are offered on paid Pro and Ultra plans. An account can have a Google AI Pro subscription and still be enrolled in Antigravity's **free** tier; it then sees the free-tier models and limits. Sign in to the Antigravity app with that account to check what it offers. Once Antigravity offers a model to a signed-in account, it appears in OpenCode automatically.
413
+
414
+ ---
415
+
416
+ ### 403 "You do not have a valid license of this product"
417
+
418
+ This comes from the **Gemini CLI** quota, which many accounts cannot use. The plugin no longer retries models from Antigravity's list on the Gemini CLI quota, so you should not see it with them. If a rate-limited Antigravity model used to end in this error, update the plugin. Older Gemini model names requested directly can still fall back to Gemini CLI; set `cli_first` off and use the `antigravity-` models instead.
419
+
420
+ ---
421
+
422
+ ### Configuration Path (All Platforms)
423
+
424
+ OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
425
+
426
+ | File | Path |
427
+ |------|------|
428
+ | Main config | `~/.config/opencode/opencode.json` |
429
+ | Accounts | `~/.config/opencode/antigravity-accounts.json` |
430
+ | Plugin config | `~/.config/opencode/antigravity.json` |
431
+ | Debug logs | `~/.config/opencode/antigravity-logs/` |
432
+ | Discovered models (OpenCode 2) | `~/.config/opencode/antigravity-models.json` |
433
+ | OpenCode 2 server log | `~/.local/share/opencode/log/opencode.log` |
434
+
435
+ > **Windows users**: `~` resolves to your user home directory (e.g., `C:\Users\YourName`). Do NOT use `%APPDATA%`.
436
+
437
+ > **Custom path**: Set `OPENCODE_CONFIG_DIR` environment variable to use a custom location.
438
+
439
+ > **Windows migration**: If upgrading from plugin v1.3.x or earlier, the plugin will automatically find your existing config in `%APPDATA%\opencode\` and use it. New installations use `~/.config/opencode/`.
440
+
441
+ ---
442
+
443
+ ### Multi-Account Auth Issues
444
+
445
+ If you encounter authentication issues with multiple accounts:
446
+
447
+ 1. Delete the accounts file:
448
+ ```bash
449
+ rm ~/.config/opencode/antigravity-accounts.json
450
+ ```
451
+ 2. Re-authenticate:
452
+ ```bash
453
+ # OpenCode 2
454
+ opencode auth logout google-antigravity
455
+ opencode auth login google-antigravity
456
+
457
+ # OpenCode 1.x
458
+ opencode auth login
459
+ ```
460
+
461
+ ---
462
+
463
+ ### 403 Permission Denied (`rising-fact-p41fc`)
464
+
465
+ **Error:**
466
+ ```
467
+ Permission 'cloudaicompanion.companions.generateChat' denied on resource
468
+ '//cloudaicompanion.googleapis.com/projects/rising-fact-p41fc/locations/global'
469
+ ```
470
+
471
+ **Cause:** Plugin falls back to a default project ID when no valid project is found. This works for Antigravity but fails for Gemini CLI models.
472
+
473
+ **Solution:**
474
+ 1. Go to [Google Cloud Console](https://console.cloud.google.com/)
475
+ 2. Create or select a project
476
+ 3. Enable the **Gemini for Google Cloud API** (`cloudaicompanion.googleapis.com`)
477
+ 4. Add `projectId` to your accounts file:
478
+ ```json
479
+ {
480
+ "accounts": [
481
+ {
482
+ "email": "your@email.com",
483
+ "refreshToken": "...",
484
+ "projectId": "your-project-id"
485
+ }
486
+ ]
487
+ }
488
+ ```
489
+
490
+ > **Note**: Do this for each account in a multi-account setup.
491
+
492
+ ---
493
+
494
+ ### Gemini Model Not Found
495
+
496
+ **OpenCode 2:** use the `google-antigravity/` prefix, e.g. `google-antigravity/antigravity-gemini-3.8-flash`. The models are only listed once you have signed in. Check `opencode plugin list` if they never appear.
497
+
498
+ **OpenCode 1.x:** add this to your `google` provider config:
499
+
500
+ ```json
501
+ {
502
+ "provider": {
503
+ "google": {
504
+ "npm": "@ai-sdk/google",
505
+ "models": { ... }
506
+ }
507
+ }
508
+ }
509
+ ```
510
+
511
+ ---
512
+
513
+ ### Gemini 3 Models 400 Error ("Unknown name 'parameters'")
514
+
515
+ **Error:**
516
+ ```
517
+ Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]'
518
+ ```
519
+
520
+ **Causes:**
521
+ - Tool schema incompatibility with Gemini's strict protobuf validation
522
+ - MCP servers with malformed schemas
523
+ - Plugin version regression
524
+
525
+ **Solutions:**
526
+ 1. **Update the plugin.** On OpenCode 2, run `opencode plugin update` (or `git pull` in a source checkout), then `opencode service restart`. On 1.x, use the latest beta:
527
+ ```json
528
+ { "plugin": ["opencode-antigravity-auth@beta"] }
529
+ ```
530
+
531
+ 2. **Disable MCP servers** one-by-one to find the problematic one
532
+
533
+ 3. **Add npm override** (OpenCode 1.x only; OpenCode 2 always uses its own Gemini client):
534
+ ```json
535
+ { "provider": { "google": { "npm": "@ai-sdk/google" } } }
536
+ ```
537
+
538
+ ---
539
+
540
+ ### MCP Servers Causing Errors
541
+
542
+ Some MCP servers have schemas incompatible with Antigravity's strict JSON format.
543
+
544
+ **Common symptom:**
545
+ ```bash
546
+ Invalid function name must start with a letter or underscore
547
+ ```
548
+
549
+ Sometimes it shows up as:
550
+ ```bash
551
+ GenerateContentRequest.tools[0].function_declarations[12].name: Invalid function name must start with a letter or underscore
552
+ ```
553
+
554
+ This usually means an MCP tool name starts with a number (for example, a 1mcp key like `1mcp_*`). Rename the MCP key to start with a letter (e.g., `gw`) or disable that MCP entry for Antigravity models.
555
+
556
+ **Diagnosis:**
557
+ 1. Disable all MCP servers in your config
558
+ 2. Enable one-by-one until error reappears
559
+ 3. Report the specific MCP in a [GitHub issue](https://github.com/NoeFabris/opencode-antigravity-auth/issues)
560
+
561
+ ---
562
+
563
+ ### "All Accounts Rate-Limited" (But Quota Available)
564
+
565
+ **Cause:** Cascade bug in `clearExpiredRateLimits()` in hybrid mode (fixed in recent beta).
566
+
567
+ **Solutions:**
568
+ 1. Update to latest beta version
569
+ 2. If persists, delete accounts file and re-authenticate
570
+ 3. Try switching `account_selection_strategy` to `"sticky"` in `antigravity.json`
571
+
572
+ ---
573
+
574
+ ### Session Recovery
575
+
576
+ If you encounter errors during a session:
577
+ 1. Type `continue` to trigger the recovery mechanism
578
+ 2. If blocked, use `/undo` to revert to pre-error state
579
+ 3. Retry the operation
580
+
581
+ > On OpenCode 2 the plugin does not receive session events. Repairing an interrupted tool call automatically (with `auto_resume`) is therefore 1.x only. Use the manual steps above.
582
+
583
+ ---
584
+
585
+ ### Using with Oh-My-OpenCode
586
+
587
+ > These steps are for OpenCode 1.x. On OpenCode 2, oh-my-opencode only runs if it ships a 2.x build. If it does, refer to models as `google-antigravity/...` instead of `google/...`.
588
+
589
+ **Important:** Disable the built-in Google auth to prevent conflicts:
590
+
591
+ ```json
592
+ // ~/.config/opencode/oh-my-opencode.json
593
+ {
594
+ "google_auth": false,
595
+ "agents": {
596
+ "frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3.1-pro" },
597
+ "document-writer": { "model": "google/antigravity-gemini-3.8-flash" }
598
+ }
599
+ }
600
+ ```
601
+
602
+ ---
603
+
604
+ ### Infinite `.tmp` Files Created
605
+
606
+ **Cause:** When account is rate-limited and plugin retries infinitely, it creates many temp files.
607
+
608
+ **Workaround:**
609
+ 1. Stop OpenCode
610
+ 2. Clean up: `rm ~/.config/opencode/*.tmp`
611
+ 3. Add more accounts or wait for rate limit to expire
612
+
613
+ ---
614
+
615
+ ### OAuth Callback Issues
616
+
617
+ > **OpenCode 2:** if the browser cannot reach the "All set!" page (Safari's HTTPS-Only Mode, a busy port, Docker, WSL2 or SSH), use the **paste the redirect URL** sign-in method instead. It needs no local server. Open the link in any browser on any machine, then copy the redirected `localhost:51121` URL from the address bar and paste it back. If the browser rewrote the URL (for example to `https://localhost...`), paste it anyway, because only its `code` and `state` values are used. The sections below apply to 1.x.
618
+
619
+ <details>
620
+ <summary><b>Safari OAuth Callback Fails (macOS)</b></summary>
621
+
622
+ **Symptoms:**
623
+ - "fail to authorize" after successful Google login
624
+ - Safari shows "Safari can't open the page"
625
+
626
+ **Cause:** Safari's "HTTPS-Only Mode" blocks `http://localhost` callback.
627
+
628
+ **Solutions:**
629
+
630
+ 1. **Use Chrome or Firefox** (easiest):
631
+ Copy the OAuth URL and paste into a different browser.
632
+
633
+ 2. **Disable HTTPS-Only Mode temporarily:**
634
+ - Safari > Settings (⌘,) > Privacy
635
+ - Uncheck "Enable HTTPS-Only Mode"
636
+ - Run `opencode auth login`
637
+ - Re-enable after authentication
638
+
639
+ </details>
640
+
641
+ <details>
642
+ <summary><b>Port Conflict (Address Already in Use)</b></summary>
643
+
644
+ **macOS / Linux:**
645
+ ```bash
646
+ # Find process using the port
647
+ lsof -i :51121
648
+
649
+ # Kill if stale
650
+ kill -9 <PID>
651
+
652
+ # Retry
653
+ opencode auth login
654
+ ```
655
+
656
+ **Windows (PowerShell):**
657
+ ```powershell
658
+ netstat -ano | findstr :51121
659
+ taskkill /PID <PID> /F
660
+ opencode auth login
661
+ ```
662
+
663
+ </details>
664
+
665
+ <details>
666
+ <summary><b>Docker / WSL2 / Remote Development</b></summary>
667
+
668
+ OAuth callback requires browser to reach `localhost` on the machine running OpenCode.
669
+
670
+ **WSL2:**
671
+ - Use VS Code's port forwarding, or
672
+ - Configure Windows → WSL port forwarding
673
+
674
+ **SSH / Remote:**
675
+ ```bash
676
+ ssh -L 51121:localhost:51121 user@remote
677
+ ```
678
+
679
+ **Docker / Containers:**
680
+ - OAuth with localhost redirect doesn't work in containers
681
+ - Wait 30s for manual URL flow, or use SSH port forwarding
682
+
683
+ </details>
684
+
685
+ ---
686
+
687
+ ### Configuration Key Typo: `plugin` not `plugins`
688
+
689
+ On OpenCode 1.x the correct key is `plugin` (singular):
690
+
691
+ ```json
692
+ {
693
+ "plugin": ["opencode-antigravity-auth@beta"]
694
+ }
695
+ ```
696
+
697
+ **Not** `"plugins"` (will cause "Unrecognized key" error). OpenCode 2 accepts both keys; it reads the 1.x `plugin` array as `plugins`.
698
+
699
+ ---
700
+
701
+ ### Migrating Accounts Between Machines
702
+
703
+ When copying `antigravity-accounts.json` to a new machine:
704
+ 1. Ensure the plugin is installed: `opencode plugin add @percygfx/opencode-antigravity-auth` on OpenCode 2 (see [Installation](#installation)), or `"plugin": ["opencode-antigravity-auth@beta"]` on 1.x
705
+ 2. Copy `~/.config/opencode/antigravity-accounts.json`
706
+ 3. On OpenCode 2, sign in once with `opencode auth login google-antigravity`. OpenCode keeps its own connection, separate from the accounts file, and the models only appear once that connection exists.
707
+ 4. If you get "API key missing" error, the refresh token may be invalid — re-authenticate
708
+
709
+ ## Known Plugin Interactions
710
+ For details on load balancing, dual quota pools, and account storage, see [docs/MULTI-ACCOUNT.md](docs/MULTI-ACCOUNT.md).
711
+
712
+ ---
713
+
714
+ ## Plugin Compatibility
715
+
716
+ > The plugins below are OpenCode 1.x plugins. OpenCode 2 only runs plugins that ship a 2.x build, so check each one's own docs before relying on it under 2.x.
717
+
718
+ ### @tarquinen/opencode-dcp
719
+
720
+ DCP creates synthetic assistant messages that lack thinking blocks. **List this plugin BEFORE DCP:**
721
+
722
+ ```json
723
+ {
724
+ "plugin": [
725
+ "opencode-antigravity-auth@latest",
726
+ "@tarquinen/opencode-dcp@latest"
727
+ ]
728
+ }
729
+ ```
730
+
731
+ ### oh-my-opencode
732
+
733
+ Disable built-in auth and override agent models in `oh-my-opencode.json`:
734
+
735
+ ```json
736
+ {
737
+ "google_auth": false,
738
+ "agents": {
739
+ "frontend-ui-ux-engineer": { "model": "google/antigravity-gemini-3.1-pro" },
740
+ "document-writer": { "model": "google/antigravity-gemini-3.8-flash" },
741
+ "multimodal-looker": { "model": "google/antigravity-gemini-3.8-flash" }
742
+ }
743
+ }
744
+ ```
745
+
746
+ > **Tip:** When spawning parallel subagents, enable `pid_offset_enabled: true` in `antigravity.json` to distribute sessions across accounts.
747
+
748
+ ### Plugins you don't need
749
+
750
+ - **gemini-auth plugins** — Not needed. This plugin handles all Google OAuth.
751
+
752
+ ---
753
+
754
+ ## Configuration
755
+
756
+ Create `~/.config/opencode/antigravity.json` for optional settings:
757
+
758
+ ```json
759
+ {
760
+ "$schema": "https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/assets/antigravity.schema.json"
761
+ }
762
+ ```
763
+
764
+ Most users don't need to configure anything — defaults work well.
765
+
766
+ ### Model Behavior
767
+
768
+ | Option | Default | What it does |
769
+ |--------|---------|--------------
770
+ | `keep_thinking` | `false` | Preserve Claude's thinking across turns. **Warning:** enabling may degrade model stability. |
771
+ | `session_recovery` | `true` | Auto-recover from tool errors (OpenCode 1.x only) |
772
+ | `cli_first` | `false` | Route Gemini models to Gemini CLI first (Claude and image models stay on Antigravity). |
773
+
774
+ ### Account Rotation
775
+
776
+ | Your Setup | Recommended Config |
777
+ |------------|-------------------|
778
+ | **1 account** | `"account_selection_strategy": "sticky"` |
779
+ | **2-5 accounts** | Default (`"hybrid"`) works great |
780
+ | **5+ accounts** | `"account_selection_strategy": "round-robin"` |
781
+ | **Parallel agents** | Add `"pid_offset_enabled": true` |
782
+
783
+ ### Quota Protection
784
+
785
+ | Option | Default | What it does |
786
+ |--------|---------|--------------|
787
+ | `soft_quota_threshold_percent` | `90` | Skip account when quota usage exceeds this percentage. Prevents Google from penalizing accounts that fully exhaust quota. Set to `100` to disable. |
788
+ | `quota_refresh_interval_minutes` | `15` | Background quota refresh interval. After successful API requests, refreshes quota cache if older than this interval. Set to `0` to disable. |
789
+ | `soft_quota_cache_ttl_minutes` | `"auto"` | How long quota cache is considered fresh. `"auto"` = max(2 × refresh interval, 10 minutes). Set a number (1-120) for fixed TTL. |
790
+
791
+ > **How it works**: Quota cache is refreshed automatically after API requests (when older than `quota_refresh_interval_minutes`) and manually via "Check quotas" in `opencode auth login`. The threshold check uses `soft_quota_cache_ttl_minutes` to determine cache freshness - if cache is older, the account is considered "unknown" and allowed (fail-open). When ALL accounts exceed the threshold, the plugin waits for the earliest quota reset time (like rate limit behavior). If wait time exceeds `max_rate_limit_wait_seconds`, it errors immediately.
792
+
793
+ ### Rate Limit Scheduling
794
+
795
+ Control how the plugin handles rate limits:
796
+
797
+ | Option | Default | What it does |
798
+ |--------|---------|--------------|
799
+ | `scheduling_mode` | `"cache_first"` | `"cache_first"` = wait for same account (preserves prompt cache), `"balance"` = switch immediately, `"performance_first"` = round-robin |
800
+ | `max_cache_first_wait_seconds` | `60` | Max seconds to wait in cache_first mode before switching accounts |
801
+ | `failure_ttl_seconds` | `3600` | Reset failure count after this many seconds (prevents old failures from permanently penalizing accounts) |
802
+
803
+ **When to use each mode:**
804
+ - **cache_first** (default): Best for long conversations. Waits for the same account to recover, preserving your prompt cache.
805
+ - **balance**: Best for quick tasks. Switches accounts immediately when rate-limited for maximum availability.
806
+ - **performance_first**: Best for many short requests. Distributes load evenly across all accounts.
807
+
808
+ ### App Behavior
809
+
810
+ | Option | Default | What it does |
811
+ |--------|---------|--------------|
812
+ | `quiet_mode` | `false` | Hide toast notifications |
813
+ | `debug` | `false` | Enable debug file logging (`~/.config/opencode/antigravity-logs/`) |
814
+ | `debug_tui` | `false` | Show debug logs in the TUI log panel (independent from `debug`) |
815
+ | `auto_update` | `true` | Auto-update plugin |
816
+
817
+ > **OpenCode 2:** the plugin cannot show toasts or write to the TUI log panel, and OpenCode updates the plugin itself (`opencode plugin update`). `quiet_mode`, `debug_tui` and `auto_update` therefore have no effect, and toast messages (such as "Using account 2/3") are not shown. To see what the plugin is doing, turn on `debug` for the debug log files. Every other option works the same on both versions.
818
+
819
+ For all options, see [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
820
+
821
+ **Environment variables:**
822
+ ```bash
823
+ OPENCODE_CONFIG_DIR=/path/to/config opencode # Custom config directory
824
+ OPENCODE_ANTIGRAVITY_DEBUG=1 opencode # Enable debug file logging
825
+ OPENCODE_ANTIGRAVITY_DEBUG=2 opencode # Verbose debug file logging
826
+ OPENCODE_ANTIGRAVITY_DEBUG_TUI=1 opencode # Enable TUI log panel debug output
827
+ ```
828
+
829
+ ---
830
+
831
+ ## Troubleshooting
832
+
833
+ See the full [Troubleshooting Guide](docs/TROUBLESHOOTING.md) for solutions to common issues including:
834
+
835
+ - Auth problems and token refresh
836
+ - "Model not found" errors
837
+ - Session recovery
838
+ - Gemini CLI permission errors
839
+ - Safari OAuth issues
840
+ - Plugin compatibility
841
+ - Migration guides
842
+
843
+ ---
844
+
845
+ ## Documentation
846
+
847
+ - [Configuration](docs/CONFIGURATION.md) — All configuration options
848
+ - [Multi-Account](docs/MULTI-ACCOUNT.md) — Load balancing, dual quota pools, account storage
849
+ - [Model Variants](docs/MODEL-VARIANTS.md) — Thinking budgets and variant system
850
+ - [Troubleshooting](docs/TROUBLESHOOTING.md) — Common issues and fixes
851
+ - [Architecture](docs/ARCHITECTURE.md) — How the plugin works
852
+ - [API Spec](docs/ANTIGRAVITY_API_SPEC.md) — Antigravity API reference
853
+
854
+ ---
855
+
856
+ ## Support
857
+
858
+ If this plugin saves you time, consider supporting its development:
859
+
860
+ [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/S6S81QBOIR)
861
+
862
+ ---
863
+
864
+ ## Credits
865
+
866
+ - [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) by [@jenslys](https://github.com/jenslys)
867
+ - [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)
868
+
869
+ ## License
870
+
871
+ MIT License. See [LICENSE](LICENSE) for details.
872
+
873
+ <details>
874
+ <summary><b>Legal</b></summary>
875
+
876
+ ### Intended Use
877
+
878
+ - Personal / internal development only
879
+ - Respect internal quotas and data handling policies
880
+ - Not for production services or bypassing intended limits
881
+
882
+ ### Warning
883
+
884
+ By using this plugin, you acknowledge:
885
+
886
+ - **Terms of Service risk** — This approach may violate ToS of AI model providers
887
+ - **Account risk** — Providers may suspend or ban accounts
888
+ - **No guarantees** — APIs may change without notice
889
+ - **Assumption of risk** — You assume all legal, financial, and technical risks
890
+
891
+ ### Disclaimer
892
+
893
+ - Not affiliated with Google. This is an independent open-source project.
894
+ - "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC.
895
+
896
+ </details>