{"id":18637,"library":"opencode-gemini-auth","title":"OAuth Plugin for Opencode with Gemini","description":"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.","status":"active","version":"1.4.10","language":"javascript","source_language":"en","source_url":"https://github.com/jenslys/opencode-gemini-auth","tags":["javascript"],"install":[{"cmd":"npm install opencode-gemini-auth","lang":"bash","label":"npm"},{"cmd":"yarn add opencode-gemini-auth","lang":"bash","label":"yarn"},{"cmd":"pnpm add opencode-gemini-auth","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency for Opencode CLI plugin API","package":"opencode","optional":false},{"reason":"Peer dependency for TypeScript definitions","package":"typescript","optional":true}],"imports":[{"note":"ESM-only; no CommonJS support. The default export is a function that returns a plugin object.","wrong":"const plugin = require('opencode-gemini-auth')","symbol":"default","correct":"import plugin from 'opencode-gemini-auth'"},{"note":"Named export for programmatic login. Available since v1.4.0.","wrong":"","symbol":"login","correct":"import { login } from 'opencode-gemini-auth'"},{"note":"Named export for checking Gemini quota, used internally by /gquota command.","wrong":"","symbol":"getQuota","correct":"import { getQuota } from 'opencode-gemini-auth'"}],"quickstart":{"code":"// Ensure Opencode CLI is installed\n// Add plugin to Opencode config (~/.config/opencode/opencode.json):\n// {\n//   \"$schema\": \"https://opencode.ai/config.json\",\n//   \"plugin\": [\"opencode-gemini-auth@latest\"]\n// }\n\n// Then run:\n// opencode auth login\n// Select \"Google\" then \"OAuth with Google (Gemini CLI)\"\n// Browser will open for OAuth consent","lang":"typescript","description":"Shows how to install and authenticate the plugin to use Gemini models with Opencode CLI."},"warnings":[{"fix":"Use a Gemini API key instead for lower risk, or accept the potential OAuth policy risk.","message":"Google has stated that using Gemini CLI OAuth with third-party software may violate policy and trigger account restrictions.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Manually paste the callback URL or authorization code when prompted.","message":"OAuth callback local server may fail if port is in use or in headless environments.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use projectId in provider.google.options config or set GOOGLE_CLOUD_PROJECT / GOOGLE_CLOUD_PROJECT_ID.","message":"The environment variable OPENCODE_GEMINI_PROJECT_ID is deprecated in favor of projectId config option.","severity":"deprecated","affected_versions":">=1.4.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install Opencode CLI via npm install -g opencode or ensure it's available as a dependency.","cause":"Opencode CLI is not installed or not found in node_modules.","error":"Error: Cannot find module 'opencode'"},{"fix":"Use import plugin from 'opencode-gemini-auth' (default import).","cause":"Wrong import style; this package exports a default function, not an object.","error":"TypeError: plugin is not a function"},{"fix":"Set projectId in config or environment variable (GOOGLE_CLOUD_PROJECT).","cause":"Organization-backed subscription requires explicit projectId.","error":"Error: Missing projectId for Gemini Code Assist"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}