Opencode-gemini-auth is an open-source plugin (current stable v1.4.10, released 2025) that authenticates the Opencode CLI using your Google account, enabling access to Gemini models including the free tier. It spins up a local OAuth callback server, supports manual URL paste fallback, and provides a `/gquota` command. Actively maintained with frequent releases. Differentiators: eliminates the need for a separate Google AI API key, supports Gemini Code Assist subscriptions via `projectId`, and includes automatic token refresh. Written in TypeScript, ships with types, peer-depends on TypeScript ^5.9.3.
npm install opencode-gemini-authVerified import paths — ran on the pinned version, not inferred.
Shows how to install and authenticate the plugin to use Gemini models with Opencode CLI.
Use a Gemini API key instead for lower risk, or accept the potential OAuth policy risk.
Manually paste the callback URL or authorization code when prompted.
Use projectId in provider.google.options config or set GOOGLE_CLOUD_PROJECT / GOOGLE_CLOUD_PROJECT_ID.
Install Opencode CLI via npm install -g opencode or ensure it's available as a dependency.
Use import plugin from 'opencode-gemini-auth' (default import).
Set projectId in config or environment variable (GOOGLE_CLOUD_PROJECT).