Magpie / OpenCode 提供方插件 · 官方 agy CLIMagpie / OpenCode provider plugin · official agy CLI
把 Antigravity 订阅,
接进你的编码客户端。
Your Antigravity subscription, inside your coding client.
驱动真实的 agy acp,把 Anthropic Messages 转成 Agent Client Protocol。多个 Google 账号在 Magpie 中独立成行、共用普通模型 ID;精简 prompt、会话复用,用量与缓存一目了然。
It drives the real agy acp and translates Anthropic Messages to the Agent Client Protocol. Several Google accounts appear as separate Magpie rows sharing ordinary model IDs, with lean prompts, session reuse and visible token and cache usage.
$ magpie plugin add https://github.com/DylanLIiii/opencode-antigravity-bridge
无需 npm 发布。然后在 Magpie:Providers → Antigravity Bridge → 登录 → 新增 Google 账号。需要已安装 agy。
No npm release required. Then in Magpie: Providers → Antigravity Bridge → Sign in → Add a Google account. Requires an installed agy.
一个模型 ID,多个账号,由 Magpie 来选。One model ID, several accounts, chosen by Magpie.
每个 Google 账号在 Magpie 中独立成行,共用不带前缀的模型 ID。首选、启用/关闭和账号路由规则都用 Magpie 自带的;会话、进程和额度按账号隔离。直接用 OpenCode 时,仍可写 <账号>/<模型id>。
Each Google account is its own Magpie row, sharing ordinary model IDs without prefixes. Preference, on/off switches and routing rules are Magpie's own; sessions, processes and quota stay per account. Direct OpenCode use can still write <account>/<model-id>.
演示简化了路由:这里只按「首选且启用 → 其他已启用账号」选择。实际由 Magpie 的账号路由规则决定。账号名和型号都是示例;可用型号取决于各账号与 agy 版本的实际探测结果。 The demo simplifies routing to "preferred and enabled → another enabled account". Magpie's own routing rules decide in practice. Account names and models are examples; available models depend on what each account and agy version actually offer.
去掉 agy 自带的 8K 编码 prompt。Drop agy's built-in 8K coding prompt.
精简 agent 默认开启(AGY_BRIDGE_MINIMAL_AGENT=0 可关闭)。客户端自己的 system prompt 和工具目录才是权威来源;指令每个会话只安装一次,每轮只发新增消息。
The minimal agent is on by default (AGY_BRIDGE_MINIMAL_AGENT=0 turns it off). The client's own system prompt and tool catalog are authoritative; instructions are installed once per session and each turn sends only the new message.
历史实测:agy 1.4.12,gemini-3.8-flash;三轮会话使用 gemini-3.8-flash-low 和两个客户端工具。−94% 与 −73% 只代表这些条件,不同版本、模型和客户端 prompt 会不同。
Historical measurements: agy 1.4.12, gemini-3.8-flash; the three-turn session used gemini-3.8-flash-low and two client tools. −94% and −73% describe those conditions only; other versions, models and client prompts differ.
前缀稳定,缓存才有机会。命中与否由 Google 决定。A stable prefix gives caching a chance. Google decides whether it hits.
请求只追加不改写,便于 Google 后端复用前缀。在历史 Argon 样本中,每轮约最后 2,049 个 token 不从缓存读取,因此 prompt 越大,比例越高。下方示意按这个推断计算。 Requests only append, so Google's backend can reuse the prefix. In historical Argon samples, about the last 2,049 tokens of each turn were never read from cache, so the share grows with prompt size. The illustration below applies that inference.
| 历史样本(agy 1.4.12)Historical sample (agy 1.4.12) | 观察结果Observed |
|---|---|
gemini-4-argon-low · 约 26k 稳定 prompt,第 3 轮~26k stable prompt, turn 3 | 23,944 / 26,097 = 91.7% |
gemini-4-argon-low · 约 5.5k 稳定 prompt,第 2–4 轮~5.5k stable prompt, turns 2–4 | ≈ 62–64% |
gemini-3.8-flash-low · 约 5.5k 稳定 prompt~5.5k stable prompt | 0 |
不承诺 90% 命中。2,049 常数是从样本推断的,Google 未公开说明。能读到 agy 本地会话库的逐调用记录(gen_metadata / steps)时,cache_read_input_tokens 来自实际记录;读不到时,工具轮次缓存量是有界估算,不能证明 Google 实际命中。
No 90% hit rate is promised. The 2,049 constant is inferred from samples and is not documented by Google. With agy's per-call records (gen_metadata / steps) available, cache_read_input_tokens comes from actual records; otherwise tool-round cache figures are bounded estimates, not evidence of actual Google cache hits.
官方 CLI 进程,原生 MCP 工具。The official CLI process, native MCP tools.
Anthropic Messages, SSE
真正的客户端工具Real client tools
客户端工具以 MCP 原生工具出现:并行、多轮、长耗时,每个调用只执行一次。没有文本约定 hack。Client tools appear as native MCP tools: parallel, multi-round, long-running, each run once. No text conventions.
会话复用与续接Session reuse and resume
每轮只发新增消息;空闲、淘汰或重启后按哈希快照(不存明文)session/resume。历史改写时按预算重放。Each turn sends only the new message; idle, evicted or restarted sessions resume from a hashed snapshot (no message text). Changed history replays within budget.
流式 · 思考 · 图片Streaming · thinking · images
文本与思考摘要流式输出;内联 PNG/JPEG/GIF/WebP 输入需要 agy 声明图片能力(1.5.0 起)。Streamed text and thought summaries; inline PNG/JPEG/GIF/WebP input requires agy to advertise image support (1.5.0+).
用量看得见Observable usage
区分实际输入、缓存读写、输出与思考量;Magpie Usage 页显示订阅额度(仅展示)。Separates actual input, cache reads/writes, output and thinking; Magpie's Usage page shows subscription quota (display only).
隔离而不越权Isolation without bypass
不读取全局 MCP 配置;agy 的权限请求一律拒绝,操作发生在客户端侧。No global MCP configuration is read; agy permission requests are rejected, and actions happen client-side.
不放大重试No retry amplification
已提交的 Prompt 不会因客户端重试再次交给 agy,返回 prompt_outcome_unknown。A submitted prompt is not resent on client retry; it returns prompt_outcome_unknown.
保守默认,显式解锁。Conservative default, explicit unlock.
limit.context 声明default limit.context declaration右键 Providers 中的 Antigravity Bridge 行,选择「Antigravity Bridge 上下文设置」,或从侧边栏打开同名页面: Right-click the Antigravity Bridge row in Providers and choose Antigravity Bridge context, or open it from the sidebar:
- 选择方案Choose an option
- 查看影响Review it
- 确认执行Confirm
- 异步显示结果See the async result
- 可恢复默认Restore the default
保存后重启 Magpie 或重新加载 Bridge 插件,再刷新模型目录;已有会话保持原模式。WSL 页面仅显示状态说明。现有补丁只为已知构建生成受校验的副本,官方安装从不修改;新版 agy 的长上下文效果未经验证。CLI 入口同样可用: After saving, restart Magpie or reload Bridge, then refresh models; running sessions keep their mode. The WSL page explains the limitation without changing host state. The patcher only builds verified copies of known builds and never modifies the official install; long context on newer agy builds is unverified. The CLI remains available:
agy-bridge context status agy-bridge context unlock # Python 3.8+, patches only a copy agy-bridge context disable [--purge]
说清楚它不保证什么。What it does not guarantee.
- 型号按账号实际探测列出,不保证全部 Gemini / Claude / GPT-OSS 可用。Models are listed from each account's probe; no model family is guaranteed.
- 走官方 CLI 不等于保证账号不受限制,也不排除 Google 政策变化。Using the official CLI does not guarantee against account restrictions or Google policy changes.
- 缓存由 Google 后端决定;数字是历史样本,不是承诺。Caching is Google's decision; the figures are historical samples, not promises.
- 额度窗口仅展示,不会在耗尽时自动停请求。Quota windows are display-only and do not stop requests.
- 命名账号需要 agy 支持
--gemini_dir和文件 token;WSL 模式只支持默认账号。Named accounts need--gemini_dirand file tokens; WSL mode supports only the default account. - Windows 已有自动化测试,尚未完成实机验证。Windows has automated tests; real-host verification is pending.