opencode-antigravity-auth README

项目的 README,来自 github.com/NoeFabris/opencode-antigravity-auth。合并为一个 markdown 文件:README.md。

Antigravity + Gemini CLI OAuth Plugin for Opencode

npm version npm beta npm downloads License: MIT X (Twitter)

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.

Unofficial plugin. Google may restrict accounts using third-party clients.

Special Thanks

Infistar.cc, leading AI models with one API key

Claude, GPT, Gemini and more with one API key at Infistar.cc. Sign up through the link to get CNY 5 in free credit.

Setup

Requires OpenCode 2.1.2+ and Node.js 20+.

Add to ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["[email protected]"]
}

Then run:

opencode auth login google

Choose Google OAuth (Antigravity). Existing accounts are reused.

To use a local checkout, run npm ci && npm run build and replace the package name above with the checkout's absolute path.

Use

opencode models
opencode run --model=google/antigravity-gemini-3.8-flash-high "Hello"
opencode run --model=google/antigravity-claude-opus-4-6-thinking#max "Hello"

Models are discovered from your enabled accounts and cached for an hour. Availability depends on your Google plan. Select an antigravity-* model for Google OAuth. Native Google API-key models are hidden while Antigravity OAuth is selected and return when you switch to an API-key connection.

Inside OpenCode, open /antigravity (or /ag) to:

The account list shows the lowest cached quota across Claude, Gemini Pro, and Gemini Flash. Choose Check quotas / verify enabled accounts to refresh the saved quota data. Refresh quotas if an older cache shows a percentage without a reset time.

Accounts are stored in ~/.config/opencode/antigravity-accounts.json. Back up this file before moving machines; it contains credentials. Disabling an account excludes it from rotation and routine quota checks.

Development

npm ci
npm run typecheck
npm test
npm run build
OPENCODE_BIN=/path/to/opencode npm run test:e2e:v2

The runtime test uses synthetic credentials. Authenticated model and menu checks require a logged-in Google account.

V2 migration and verification · Configuration · Troubleshooting

OpenCode 1.18.29+ remains supported through the legacy entrypoint; its account menu opens from opencode auth login.

opencode-antigravity-auth (NoeFabris/opencode-antigravity-auth)

正在搜索数据库…

这是什么?这是一个 OpenCode 插件,通过 Google OAuth 登录 Antigravity(Google 的 IDE),让 OpenCode 可以使用 Antigravity 的配额来运行 Gemini 3.1 Pro 和 Claude Opus 4.6-thinking 等模型。使用的是你自己的 Google 账号,无需单独的 API 密钥。
这是独立应用,还是只是 OpenCode 的附加组件?它只是一个插件,添加到 OpenCode 的配置数组中即可。它不能单独运行,设计上是与其他 OpenCode 插件一起使用的。
我该如何安装和配置它?在 ~/.config/opencode/opencode.json 的 plugin 数组中添加该插件,然后运行 'opencode auth login',选择 Google → OAuth with Google (Antigravity),再选择 'Configure models in opencode.json',即可自动添加所有模型定义。
我需要 Google Cloud API 密钥,还是只需要 Google 账号?正常使用时不需要单独的 API 密钥,通过 OAuth 用 Google 账号登录即可,还可以添加多个账号以合并更多配额。只有当你在 Gemini CLI 模型上遇到特定的 403 错误时,才需要创建一个启用了 Gemini API 的 Google Cloud 项目。
使用这个插件是否违反 Google 的服务条款?是的。README 明确警告这违反了 Google 的服务条款,有些用户因为使用它而导致 Google 账号被封禁或被暗中限制。
Windows、macOS 和 Linux 的设置有区别吗?配置路径在所有操作系统上都相同(~/.config/opencode/,包括 Windows,其中 ~ 仍指向用户的主文件夹),不过在 Safari/macOS、WSL2、SSH 和 Docker 中,OAuth 回调需要额外的设置步骤。
我的 Google 凭据存储在哪里?OAuth 账号数据以 JSON 文件的形式保存在本地的 OpenCode 配置文件夹中,插件不会将其发送到其他任何地方。
通过这个插件,我实际可以使用哪些模型?通过 Antigravity 配额可使用 Claude Opus 4.6 / Sonnet 4.6 以及 Gemini 3.1 Pro / Flash;通过单独的 Gemini CLI 配额可使用 Gemini 2.5 以及 Gemini 3 Pro/Flash。当其中一个资源池用完时,会自动在两个池之间切换。
多账号轮换是如何工作的?你可以添加多个 Google 账号,当某个账号被限速时,插件会自动切换到其他账号。根据账号数量的不同,它会采用粘性、混合或轮询(round-robin)策略。
这个项目还在积极维护吗?该仓库在 GitHub 上已被标记为已归档。虽然 README 描述的是一个仍在积极演进、并提供测试版(beta)通道的插件,但这个仓库已不再接收新的开发工作。
如果某个 MCP 服务器导致这个插件出错,怎么办?Antigravity 严格的 schema 校验可能会因格式错误的 MCP 工具 schema 而失败(例如工具名以数字开头)。解决办法是逐个禁用 MCP 服务器,或重命名有问题的工具键名,直到错误消失。
作者
NoeFabris
大小
1.7 MB
星标
11.1K
时长
11个月
提交 · 90 天