|
| 1 | +# Antigravity OAuth Plugin for Opencode |
| 2 | + |
| 3 | +[](https://www.npmjs.com/package/opencode-antigravity-auth) |
| 4 | + |
| 5 | +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. |
| 6 | + |
| 7 | +## What you get |
| 8 | + |
| 9 | +- **Google OAuth sign-in** with automatic token refresh |
| 10 | +- **Antigravity API compatibility** for OpenAI-style requests |
| 11 | +- **Debug logging** for requests and responses |
| 12 | +- **Drop-in setup**—Opencode auto-installs the plugin from config |
| 13 | + |
| 14 | +## Quick start |
| 15 | + |
| 16 | +1) **Add the plugin to config** (`~/.config/opencode/opencode.json` or project `.opencode.json`): |
| 17 | + |
| 18 | +```json |
| 19 | +{ |
| 20 | + "plugin": ["opencode-antigravity-auth"] |
| 21 | +} |
| 22 | +``` |
| 23 | + |
| 24 | +2) **Authenticate** |
| 25 | + |
| 26 | +- Run `opencode auth login`. |
| 27 | +- Choose Google → **OAuth with Google (Antigravity)**. |
| 28 | +- Sign in via the browser and return to Opencode. If the browser doesn’t open, use the printed link. |
| 29 | + |
| 30 | +3) **Declare the models you want** |
| 31 | + |
| 32 | +Add Antigravity models under the `provider.google.models` section of your config: |
| 33 | + |
| 34 | +```json |
| 35 | +{ |
| 36 | + "plugin": ["opencode-antigravity-auth"], |
| 37 | + "provider": { |
| 38 | + "google": { |
| 39 | + "models": { |
| 40 | + "gemini-3-pro-high": { |
| 41 | + "name": "Gemini 3 Pro High (Antigravity)", |
| 42 | + "limit": { "context": 1048576, "output": 65535 } |
| 43 | + }, |
| 44 | + "gemini-3-pro-low": { |
| 45 | + "name": "Gemini 3 Pro Low (Antigravity)", |
| 46 | + "limit": { "context": 1048576, "output": 65535 } |
| 47 | + }, |
| 48 | + "claude-sonnet-4-5": { |
| 49 | + "name": "Claude Sonnet 4.5 (Antigravity)", |
| 50 | + "limit": { "context": 200000, "output": 64000 } |
| 51 | + }, |
| 52 | + "claude-sonnet-4-5-thinking": { |
| 53 | + "name": "Claude Sonnet 4.5 Thinking (Antigravity)", |
| 54 | + "limit": { "context": 200000, "output": 64000 } |
| 55 | + }, |
| 56 | + "claude-opus-4-5-thinking": { |
| 57 | + "name": "Claude Opus 4.5 Thinking (Antigravity)", |
| 58 | + "limit": { "context": 200000, "output": 64000 } |
| 59 | + }, |
| 60 | + "gpt-oss-120b-medium": { |
| 61 | + "name": "GPT-OSS 120B Medium (Antigravity)", |
| 62 | + "limit": { "context": 131072, "output": 32768 } |
| 63 | + } |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +4) **Use a model** |
| 71 | + |
| 72 | +```bash |
| 73 | +opencode run "Hello world" --model=google/gemini-3-pro-high |
| 74 | +``` |
| 75 | + |
| 76 | +## Debugging |
| 77 | + |
| 78 | +Enable verbose logging: |
| 79 | + |
| 80 | +```bash |
| 81 | +export OPENCODE_ANTIGRAVITY_DEBUG=1 |
| 82 | +``` |
| 83 | + |
| 84 | +Logs are written to the current directory (e.g., `antigravity-debug-<timestamp>.log`). |
| 85 | + |
| 86 | +## Development |
| 87 | + |
| 88 | +```bash |
| 89 | +npm install |
| 90 | +``` |
| 91 | + |
| 92 | +## Safety, usage, and risk notices |
| 93 | + |
| 94 | +### Intended use |
| 95 | + |
| 96 | +- Personal / internal development only |
| 97 | +- Respect internal quotas and data handling policies |
| 98 | +- Not for production services or bypassing intended limits |
| 99 | + |
| 100 | +### Not suitable for |
| 101 | + |
| 102 | +- Production application traffic |
| 103 | +- High-volume automated extraction |
| 104 | +- Any use that violates Acceptable Use Policies |
| 105 | + |
| 106 | +### ⚠️ Warning (assumption of risk) |
| 107 | + |
| 108 | +By using this plugin, you acknowledge and accept the following: |
| 109 | + |
| 110 | +- **Terms of Service risk:** This approach may violate the Terms of Service of AI model providers (Anthropic, OpenAI, etc.). You are solely responsible for ensuring compliance with all applicable terms and policies. |
| 111 | +- **Account risk:** Providers may detect this usage pattern and take punitive action, including suspension, permanent ban, or loss of access to paid subscriptions. |
| 112 | +- **No guarantees:** Providers may change APIs, authentication, or policies at any time, which can break this method without notice. |
| 113 | +- **Assumption of risk:** You assume all legal, financial, and technical risks. The authors and contributors of this project bear no responsibility for any consequences arising from your use. |
| 114 | + |
| 115 | +Use at your own risk. Proceed only if you understand and accept these risks. |
| 116 | + |
| 117 | +## Legal |
| 118 | + |
| 119 | +- Not affiliated with Google. This is an independent open-source project and is not endorsed by, sponsored by, or affiliated with Google LLC. |
| 120 | +- "Antigravity", "Gemini", "Google Cloud", and "Google" are trademarks of Google LLC. |
| 121 | +- Software is provided "as is", without warranty. You are responsible for complying with Google's Terms of Service and Acceptable Use Policy. |
| 122 | + |
| 123 | +## Credits |
| 124 | + |
| 125 | +- Inspired by and different from [opencode-gemini-auth](https://github.com/jenslys/opencode-gemini-auth) by [jenslys](https://github.com/jenslys). Thanks for the groundwork! 🚀 |
| 126 | +- Thanks to [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) for the inspiration. |
0 commit comments