🎯 OpenCode插件系列: google-antigravity-auth
类型:身份验证插件(使用免费模型)
⚠️ 安装前重要提醒
- 仓库已归档 于 2026年2月28日(只读且不再开发)。
- 有报告称 Google 会封禁使用此插件的账户。
- Antigravity 服务条款 规定该服务不应与其他产品一起使用。
🚨 请自行承担使用风险,建议使用非主要的 Google 账户。
1. 这是什么插件?
opencode-google-antigravity-auth 是一个用于与 Google Antigravity(Google 的免费 AI IDE)进行 OAuth 身份验证的插件,可以免费使用 Gemini 和 Claude 模型,无需支付 API 积分。
该插件是 opencode-gemini-auth 的分支,但具有更强大的附加功能。
可以免费访问的模型:
- Gemini 3 Pro(Google 最强大的推理模型)
- Gemini 3 Flash(快速且智能)
- Gemini 2.5 Flash Lite
- Claude Sonnet 4.5(通过 Antigravity 代理)
- Claude Opus 4.5 with thinking
2. 用途
在以下情况下使用:
- ✅ 节省 100% 的 API 成本(对于无法从埃及支付 Google API 的用户非常重要)
- ✅ 多账户负载均衡 — 在多个 Google 账户之间自动轮换(最多10个账户)
- ✅ 终端点故障转移 — 尝试3个终端点(daily → autopush → prod)以获得最大可靠性
- ✅ 内置谷歌搜索工具 — 真实的网页搜索,包含URL分析和来源引用
- ✅ 跨模型对话 — 在同一会话中在 Gemini 和 Claude 之间切换,同时保留思考块
- ✅ 自动令牌刷新 — 无需手动刷新令牌
- ✅ 思考模型交错处理 — Claude 在每个工具调用之间进行思考
3. 如何使用?
步骤 1:安装
添加到 ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-google-antigravity-auth"]
}
步骤 2:登录
opencode auth login
然后选择:
- Google 提供商
- OAuth with Google (Antigravity)
- 将打开浏览器进行授权
- (可选)添加用于负载均衡的额外账户
步骤 3:模型设置(推荐)
将 providers 配置添加到 opencode.json(完整配置在原始 README 中):
{
"$schema": "[<https://opencode.ai/config.json>](<https://opencode.ai/config.json>)",
"plugin": ["opencode-google-antigravity-auth"],
"provider": {
"google": {
"npm": "@ai-sdk/google",
"models": {
"gemini-3-pro-preview": {
"id": "gemini-3-pro-preview",
"name": "Gemini 3 Pro",
"modalities": {
"input": ["text", "image", "video", "audio", "pdf"],
"output": ["text"]
},
"variants": {
"high": {
"options": {
"thinkingConfig": {
"thinkingLevel": "high",
"includeThoughts": true
}
}
}
}
},
"gemini-3-flash": { /* ... */ },
"gemini-claude-sonnet-4-5-thinking": { /* ... */ },
"gemini-claude-opus-4-5-thinking": { /* ... */ }
}
}
}
}
日常使用
# 使用 Gemini 3 Pro
opencode run -m google/gemini-3-pro-preview -p "修复这个bug"
# 通过 Antigravity 使用 Claude Opus
opencode run -m google/gemini-claude-opus-4-5-thinking -p "审查这段代码"
插件更新
OpenCode 不会自动更新插件。要更新:
rm -rf ~/.cache/opencode/node_modules/opencode-google-antigravity-auth
opencode
4. 何时使用?
在以下情况下使用:
- ✅ 无法支付 Google AI API 费用(在埃及使用电子支付时常见问题)
- ✅ 需要 Gemini 3 Pro 进行复杂推理
- ✅ 需要通过 Antigravity 代理免费使用 Claude
- ✅ 处理需要多账户轮换的重度使用项目
- ✅ 工作流程中需要内置谷歌搜索功能
- ✅ 处理多模态输入(图像、视频、PDF)
不要使用如果:
- ❌ 你有 Google AI Pro/Ultra 付费订阅(请改用
opencode-gemini-auth) - ❌ 不能承受 Google 账户被封的风险
- ❌ 正在使用
opencode-skills插件(存在兼容性问题 - 请改用openskills) - ❌ 你的工作敏感且 Google 服务条款对你很重要
⚠️ 重要注意事项
已知冲突:
opencode-skills— 不兼容,请改用openskills- 如果使用其他身份验证插件(如
opencode-gemini-auth或opencode-antigravity-auth),会发生冲突
图像支持:
需要在 opencode.json 的 provider.google.models.<model>.modalities.input 中添加 "image" 配置。
多账户存储:
账户元数据存储在:
$XDG_DATA_HOME/opencode/antigravity-accounts.json
或 ~/.local/share/opencode/antigravity-accounts.json
调试:
opencode --log-level DEBUG --print-logs
日志位于 ~/.local/share/opencode/logs/
🔗 有用链接
- README:https://github.com/shekohex/opencode-google-antigravity-auth
- NPM:https://www.npmjs.com/package/opencode-google-antigravity-auth
- Antigravity 服务条款:https://antigravity.google/terms