Registry / auth-security / opencode-gemini-auth

opencode-gemini-auth

JSON →
library1.4.10jsnpmunverified

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-auth
INSTALL
IMPORT
SIG · OPENCODE-GEMINI-AU
O
opencode-gemini-auth
auth-securityjavascriptv1.4.10
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import plugin from 'opencode-gemini-auth'
const plugin = require('opencode-gemini-auth')
ESM-only; no CommonJS support. The default export is a function that returns a plugin object.
login
import { login } from 'opencode-gemini-auth'
Named export for programmatic login. Available since v1.4.0.
getQuota
import { getQuota } from 'opencode-gemini-auth'
Named export for checking Gemini quota, used internally by /gquota command.

Shows how to install and authenticate the plugin to use Gemini models with Opencode CLI.

// Ensure Opencode CLI is installed // Add plugin to Opencode config (~/.config/opencode/opencode.json): // { // "$schema": "https://opencode.ai/config.json", // "plugin": ["opencode-gemini-auth@latest"] // } // Then run: // opencode auth login // Select "Google" then "OAuth with Google (Gemini CLI)" // Browser will open for OAuth consent
opencode --version
Debug
Known issues
breakingGoogle has stated that using Gemini CLI OAuth with third-party software may violate policy and trigger account restrictions.
fix
Use a Gemini API key instead for lower risk, or accept the potential OAuth policy risk.
affects: >=1.0.0
gotchaOAuth callback local server may fail if port is in use or in headless environments.
fix
Manually paste the callback URL or authorization code when prompted.
affects: >=1.0.0
deprecatedThe environment variable OPENCODE_GEMINI_PROJECT_ID is deprecated in favor of projectId config option.
fix
Use projectId in provider.google.options config or set GOOGLE_CLOUD_PROJECT / GOOGLE_CLOUD_PROJECT_ID.
affects: >=1.4.0
Errors
Common errors & fixes
Error: Cannot find module 'opencode'
Opencode CLI is not installed or not found in node_modules.
fix
Install Opencode CLI via npm install -g opencode or ensure it's available as a dependency.
TypeError: plugin is not a function
Wrong import style; this package exports a default function, not an object.
fix
Use import plugin from 'opencode-gemini-auth' (default import).
Error: Missing projectId for Gemini Code Assist
Organization-backed subscription requires explicit projectId.
fix
Set projectId in config or environment variable (GOOGLE_CLOUD_PROJECT).
Upgrade
Version history
1.4.10latest on npm
Audit
Dependencies
opencoderequiredRuntime dependency for Opencode CLI plugin API
typescriptoptionalPeer dependency for TypeScript definitions
Agent activity
43 hits · last 30 days
node
38
OpenAI (training)
1
Resources
opencode-gemini-auth — npm install opencode-gemini-auth · libregistry