{"id":32789490,"url":"https://github.com/jenslys/opencode-gemini-auth","last_synced_at":"2026-02-19T20:00:53.618Z","repository":{"id":321823061,"uuid":"1087304134","full_name":"jenslys/opencode-gemini-auth","owner":"jenslys","description":"Gemini auth plugin for opencode","archived":false,"fork":false,"pushed_at":"2026-01-31T17:13:51.000Z","size":73,"stargazers_count":980,"open_issues_count":18,"forks_count":87,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-15T17:44:21.872Z","etag":null,"topics":["gemini","opencode","opencode-plugins"],"latest_commit_sha":null,"homepage":"https://npmjs.com/opencode-gemini-auth","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenslys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-31T17:30:16.000Z","updated_at":"2026-02-15T06:08:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jenslys/opencode-gemini-auth","commit_stats":null,"previous_names":["jenslys/opencode-gemini-auth"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/jenslys/opencode-gemini-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenslys%2Fopencode-gemini-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenslys%2Fopencode-gemini-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenslys%2Fopencode-gemini-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenslys%2Fopencode-gemini-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenslys","download_url":"https://codeload.github.com/jenslys/opencode-gemini-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenslys%2Fopencode-gemini-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29627101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T18:02:07.722Z","status":"ssl_error","status_checked_at":"2026-02-19T18:01:46.144Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gemini","opencode","opencode-plugins"],"created_at":"2025-11-05T11:00:20.408Z","updated_at":"2026-02-19T20:00:53.611Z","avatar_url":"https://github.com/jenslys.png","language":"TypeScript","readme":"# Gemini OAuth Plugin for Opencode\n\n![License](https://img.shields.io/npm/l/opencode-gemini-auth)\n![Version](https://img.shields.io/npm/v/opencode-gemini-auth)\n\n**Authenticate the Opencode CLI with your Google account.** This plugin enables\nyou to use your existing Gemini plan and quotas (including the free tier)\ndirectly within Opencode, bypassing separate API billing.\n\n## Prerequisites\n\n- [Opencode CLI](https://opencode.ai) installed.\n- A Google account with access to Gemini.\n\n## Installation\n\nAdd the plugin to your Opencode configuration file\n(`~/.config/opencode/opencode.json` or similar):\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"plugin\": [\"opencode-gemini-auth@latest\"]\n}\n```\n\n\u003e [!IMPORTANT]\n\u003e If you're using a paid Gemini Code Assist subscription (Standard/Enterprise),\n\u003e explicitly configure a Google Cloud `projectId`. Free tier accounts should\n\u003e auto-provision a managed project, but you can still set `projectId` to force\n\u003e a specific project.\n\n## Usage\n\n1. **Login**: Run the authentication command in your terminal:\n\n   ```bash\n   opencode auth login\n   ```\n\n2. **Select Provider**: Choose **Google** from the list.\n3. **Authenticate**: Select **OAuth with Google (Gemini CLI)**.\n   - A browser window will open for you to approve the access.\n   - The plugin spins up a temporary local server to capture the callback.\n   - If the local server fails (e.g., port in use or headless environment),\n     you can manually paste the callback URL or just the authorization code.\n\nOnce authenticated, Opencode will use your Google account for Gemini requests.\n\n## Configuration\n\n### Google Cloud Project\n\nBy default, the plugin attempts to provision or find a suitable Google Cloud\nproject. To force a specific project, set the `projectId` in your configuration\nor via environment variables:\n\n**File:** `~/.config/opencode/opencode.json`\n\n```json\n{\n  \"provider\": {\n    \"google\": {\n      \"options\": {\n        \"projectId\": \"your-specific-project-id\"\n      }\n    }\n  }\n}\n```\n\nYou can also set `OPENCODE_GEMINI_PROJECT_ID`, `GOOGLE_CLOUD_PROJECT`, or\n`GOOGLE_CLOUD_PROJECT_ID` to supply the project ID via environment variables.\n\n### Model list\n\nBelow are example model entries you can add under `provider.google.models` in your\nOpencode config. Each model can include an `options.thinkingConfig` block to\nenable \"thinking\" features.\n\n```json\n{\n  \"provider\": {\n    \"google\": {\n      \"models\": {\n        \"gemini-2.5-flash\": {\n          \"options\": {\n            \"thinkingConfig\": {\n              \"thinkingBudget\": 8192,\n              \"includeThoughts\": true\n            }\n          }\n        },\n        \"gemini-2.5-pro\": {\n          \"options\": {\n            \"thinkingConfig\": {\n              \"thinkingBudget\": 8192,\n              \"includeThoughts\": true\n            }\n          }\n        },\n        \"gemini-3-flash-preview\": {\n          \"options\": {\n            \"thinkingConfig\": {\n              \"thinkingLevel\": \"high\",\n              \"includeThoughts\": true\n            }\n          }\n        },\n        \"gemini-3-pro-preview\": {\n          \"options\": {\n            \"thinkingConfig\": {\n              \"thinkingLevel\": \"high\",\n              \"includeThoughts\": true\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nNote: Available model names and previews may change—check Google's documentation or\nthe Gemini product page for the current model identifiers.\n\n### Thinking Models\n\nThe plugin supports configuring Gemini \"thinking\" features per-model via\n`thinkingConfig`. The available fields depend on the model family:\n\n- For Gemini 3 models: use `thinkingLevel` with values `\"low\"` or `\"high\"`.\n- For Gemini 2.5 models: use `thinkingBudget` (token count).\n- `includeThoughts` (boolean) controls whether the model emits internal thoughts.\n\nA combined example showing both model types:\n\n```json\n{\n  \"provider\": {\n    \"google\": {\n      \"models\": {\n        \"gemini-3-pro-preview\": {\n          \"options\": {\n            \"thinkingConfig\": {\n              \"thinkingLevel\": \"high\",\n              \"includeThoughts\": true\n            }\n          }\n        },\n        \"gemini-2.5-flash\": {\n          \"options\": {\n            \"thinkingConfig\": {\n              \"thinkingBudget\": 8192,\n              \"includeThoughts\": true\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nIf you don't set a `thinkingConfig` for a model, the plugin will use default\nbehavior for that model.\n\n## Troubleshooting\n\n### Manual Google Cloud Setup\n\nIf automatic provisioning fails, you may need to set up the project manually:\n\n1. Go to the [Google Cloud Console](https://console.cloud.google.com/).\n2. Create or select a project.\n3. Enable the **Gemini for Google Cloud API**\n   (`cloudaicompanion.googleapis.com`).\n4. Configure the `projectId` in your Opencode config as shown above.\n\n### Quotas, Plans, and 429 Errors\n\nCommon causes of `429 RESOURCE_EXHAUSTED` or `QUOTA_EXHAUSTED`:\n\n- **No project ID configured**: the plugin uses a managed free-tier project, which has lower quotas.\n- **Model-specific limits**: quotas are tracked per model (e.g., `gemini-3-pro-preview` vs `gemini-3-flash-preview`).\n- **Large prompts**: OAuth/Code Assist does not support cached content, so long system prompts and history can burn quota quickly.\n- **Parallel sessions**: multiple Opencode windows can drain the same bucket.\n\nNotes:\n\n- **Gemini CLI auto-fallbacks**: the official CLI may fall back to Flash when Pro quotas are exhausted, so it can appear to “work” even if the Pro bucket is depleted.\n- **Paid plans still require a project**: to use paid quotas in Opencode, set `provider.google.options.projectId` (or `OPENCODE_GEMINI_PROJECT_ID`) and re-authenticate.\n\n### Debugging\n\nTo view detailed logs of Gemini requests and responses, set the\n`OPENCODE_GEMINI_DEBUG` environment variable:\n\n```bash\nOPENCODE_GEMINI_DEBUG=1 opencode\n```\n\nThis will generate `gemini-debug-\u003ctimestamp\u003e.log` files in your working\ndirectory containing sanitized request/response details.\n\n## Parity Notes\n\nThis plugin mirrors the official Gemini CLI OAuth flow and Code Assist\nendpoints. In particular, project onboarding and quota retry handling follow\nthe same behavior patterns as the Gemini CLI.\n\n### References\n\n- Gemini CLI repository: https://github.com/google-gemini/gemini-cli\n- Gemini CLI quota documentation: https://developers.google.com/gemini-code-assist/resources/quotas\n\n### Local upstream mirror (optional)\n\nFor local parity checks, you can keep a separate clone of the official\n`gemini-cli` in this repo at `.local/gemini-cli`.\n\nThis mirror is intentionally untracked, so contributors must set it up once on\ntheir machine:\n\n```bash\ngit clone https://github.com/google-gemini/gemini-cli.git .local/gemini-cli\n```\n\nAfter setup, pull upstream updates with:\n\n```bash\nbun run update:gemini-cli\n```\n\n### Updating\n\nOpencode does not automatically update plugins. To update to the latest version,\nyou must clear the cached plugin:\n\n```bash\n# Clear the specific plugin cache\nrm -rf ~/.cache/opencode/node_modules/opencode-gemini-auth\n\n# Run Opencode to trigger a fresh install\nopencode\n```\n\n## Development\n\nTo develop on this plugin locally:\n\n1. **Clone**:\n\n   ```bash\n   git clone https://github.com/jenslys/opencode-gemini-auth.git\n   cd opencode-gemini-auth\n   bun install\n   ```\n\n2. **Link**:\n   Update your Opencode config to point to your local directory using a\n   `file://` URL:\n\n   ```json\n   {\n     \"plugin\": [\"file:///absolute/path/to/opencode-gemini-auth\"]\n   }\n   ```\n\n## License\n\nMIT\n","funding_links":[],"categories":["Plugins"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenslys%2Fopencode-gemini-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenslys%2Fopencode-gemini-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenslys%2Fopencode-gemini-auth/lists"}