{"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,"search_vec":"'/gquota':56 '2025':21 '5.9.3':97 'access':32 'account':30 'activ':58 'ai':71 'api':72 'assist':77 'auth':10 'authent':23 'automat':83 'callback':46 'cli':26 'code':76 'command':57 'current':17 'depend':94 'differenti':63 'elimin':64 'enabl':31 'fallback':52 'free':38 'frequent':61 'gemini':6,9,34,75 'googl':29,70 'includ':36,82 'javascript':98 'key':73 'local':44 'maintain':59 'manual':49 'model':35 'need':66 'oauth':1,45 'open':14 'open-sourc':13 'opencod':4,8,25 'opencode-gemini-auth':7 'past':51 'peer':93 'peer-depend':92 'plugin':2,16 'projectid':80 'provid':54 'refresh':85 'releas':20,62 'separ':69 'server':47 'ship':89 'sourc':15 'spin':41 'stabl':18 'subscript':78 'support':48,74 'tier':39 'token':84 'type':91 'typescript':88,96 'url':50 'use':27 'v1.4.10':19 'via':79 'written':86","created_at":"2026-04-25T07:39:20.794587+00:00","updated_at":"2026-04-25T07:39:20.794587+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"opencode","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jenslys/opencode-gemini-auth","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/opencode-gemini-auth","openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security","gcp","llm-agents"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}