An OpenCode plugin for the Antigravity CLI (agy). It ships one provider, google-agy-acp, which drives your local agy binary over the Agent Client Protocol (agy acp).
Add the plugin to your OpenCode configuration (opencode.json in your project, or ~/.config/opencode/opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@anthonyhaussman/opencode-agy-auth"]
}Then connect the google-agy-acp provider in OpenCode and pick an authentication method (see below).
- OpenCode >= 2.4.0, required by
google-agy-acp(this package supports the v2 plugin API only; older OpenCode versions cannot load the provider). OpenCode 2.2.3 to 2.3.2 can load the provider, but their system prompt names the Code Mode tooltools.opencode.session_move, and agy answers every prompt that contains this string withRESOURCE_EXHAUSTED (code 429)(antigravity-cli#1684). OpenCode 2.4.0 renamed the tool totools.opencode.session.move. - agy >= 1.5.10 for
google-agy-acp. The binary isagyon yourPATH, or the path inOPENCODE_AGY_PATH.
The provider starts agy acp --agent opencode (one process per OpenCode session, no shell) and exposes agy's models in OpenCode. OpenCode keeps ownership of tools: they are presented to agy through a local MCP bridge (127.0.0.1, random port, per-process bearer token) served by an agy plugin named opencode-bridge, so file edits and commands still run inside OpenCode with OpenCode's permission prompts. Model ids carry the thinking level (for example gemini-4-neon-low), so models have no variants. The model list comes from agy models shortly after startup and refreshes when agy reports a different list at session start. If agy models fails later, the provider keeps the last list that worked for the current account; if agy is missing, too old, or has never answered for that account, the provider lists no models.
Pick a method when connecting the google-agy-acp provider:
- Gemini API key (recommended): stored by OpenCode, passed to agy as
GEMINI_API_KEYin the child environment. - Vertex AI / Agent Platform (recommended): uses your Application Default Credentials. Nothing is stored by OpenCode.
- Google login (personal or Gemini Enterprise / Workspace): you sign in with
agyitself; the plugin never reads, refreshes or forwards agy's OAuth tokens and never reads the OS keyring.
- Global agy plugin. On first use the provider runs
agy plugin installand adds theopencode-bridgeplugin to agy's global plugins in~/.gemini/config/plugins/. A one-time notice is shown. Remove it at any time withagy plugin uninstall opencode-bridge. The plugin never edits~/.gemini/config/*by hand. read_fileis not sandboxed. agy's ownread_filecan read any file your user can read, including files outside the workspace, without a permission prompt. It is read-only and appears in OpenCode as a provider-executed call. Other agy built-ins (write_file,run_commandand so on) are rejected.- Shared schema cache. agy caches tool schemas in
~/.gemini/antigravity-cli/mcp/opencode-bridge_bridge/, shared by all sessions. Concurrent sessions with different tool sets can see each other's schemas; calls to a tool the session does not have are rejected by the bridge. - Other MCP servers are blocked. MCP servers from other agy plugins are blocked by permission rejection.
- Long tool runs. agy times MCP calls out at 180 s. OpenCode tools that run longer than 170 s return "still running" to agy, and the result is delivered with the next message.
- Process lifetime. agy child processes are not killed when the plugin unloads (the v2 setup hook has no disposer), but they exit after 5 minutes idle or when OpenCode exits.
OPENCODE_AGY_PATH: path to the agy binary (default:agyonPATH).AGY_ACP_DEBUG=1: write a debug log of each agy child process (spawn, ACP JSON-RPC traffic, stderr, exit). The bridge token and the Gemini API key are redacted; prompts and tool output are logged as-is. Off by default.AGY_ACP_DEBUG_FILE: debug log path (default:$XDG_DATA_HOME/opencode/agy-acp/debug.log, or~/.local/share/opencode/agy-acp/debug.log). Created with mode 0600.
The direct Code Assist provider google-agy, its agy_quota and agy_quota_summary tools and the /agyquota and /agyquotasummary commands were removed. To migrate:
- Switch your models from
google-agy/<model>togoogle-agy-acp/<model>. - Delete any
provider.google-agyblock (for exampleoptions.projectId) fromopencode.json.OPENCODE_AGY_PROJECT_ID,OPENCODE_AGY_AUTH_PROXY,OPENCODE_AGY_ENDPOINTandOPENCODE_AGY_VERBOSE_LOGSare no longer read. - The
google-agyentry in~/.local/share/opencode/auth.jsonis no longer used and can be deleted. - The
antigravity-turn-states.jsonfile under~/.config/opencode/is no longer written and can be deleted.
For quota in OpenCode, a google-agy-acp provider for opencode-quota is proposed in anthonyhaussman/opencode-quota#2. It reads agy -p /usage --output-format json and shows the weekly and five-hour windows for each model family. You can also run /usage in agy directly.
To test and develop the plugin locally with OpenCode before publishing:
-
Build the plugin locally: Clone the repository, install dependencies, and build the source code:
npm install npm run build
-
Configure OpenCode to use the local build: In the target project where you want to test the plugin, open your
opencode.json(or~/.config/opencode/opencode.jsonfor global testing) and add the absolute local path to the plugin:{ "$schema": "https://opencode.ai/config.json", "plugin": ["/absolute/path/to/opencode-agy-auth"] }Note: OpenCode also supports dropping plugin files directly into the
.opencode/plugins/folder in your project. -
Verify the plugin: Launch OpenCode in your target project. OpenCode will automatically resolve and load your local plugin directory. You can test your changes by running
npm run buildin the plugin directory and restarting your OpenCode session.
To test bleeding-edge features or upcoming changes before official releases, configure the @alpha distribution tag:
npm install @anthonyhaussman/opencode-agy-auth@alphaOr configure it directly in your opencode.json:
{
"plugin": ["@anthonyhaussman/opencode-agy-auth@alpha"]
}Warning
Instability Warning: The @alpha release contains experimental features and active development builds. It may be unstable or cause disruptions in session authentication and model requests. Use only for testing and development. For day-to-day work, use the stable release.
If this plugin saved you time or made using Antigravity models in OpenCode smoother, consider giving the repository a star on GitHub - it helps others discover the project.