Skip to content

Commit 5d229bf

Browse files
committed
First commit - auth and models working
0 parents  commit 5d229bf

23 files changed

Lines changed: 3120 additions & 0 deletions

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# dependencies (bun install)
2+
node_modules
3+
4+
# output
5+
out
6+
dist
7+
*.tgz
8+
9+
# code coverage
10+
coverage
11+
*.lcov
12+
13+
# logs
14+
logs
15+
_.log
16+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
17+
antigravity-debug-*.log
18+
19+
# dotenv environment variable files
20+
.env
21+
.env.development.local
22+
.env.test.local
23+
.env.production.local
24+
.env.local
25+
26+
# caches
27+
.eslintcache
28+
.cache
29+
*.tsbuildinfo
30+
31+
# IntelliJ based IDEs
32+
.idea
33+
34+
# Finder (MacOS) folder config
35+
.DS_Store

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Jens
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Antigravity OAuth Plugin for Opencode
2+
3+
[![npm version](https://img.shields.io/npm/v/opencode-antigravity-auth.svg)](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.

bun.lock

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export {
2+
AntigravityCLIOAuthPlugin,
3+
GoogleOAuthPlugin,
4+
} from "./src/plugin";
5+
6+
export {
7+
authorizeAntigravity,
8+
exchangeAntigravity,
9+
} from "./src/antigravity/oauth";
10+
11+
export type {
12+
AntigravityAuthorization,
13+
AntigravityTokenExchangeResult,
14+
} from "./src/antigravity/oauth";

0 commit comments

Comments
 (0)