Skip to content

feat(gemini): add Gemini provider plugin (oauth-personal, pro/flash usage)#189

Merged
validatedev merged 3 commits intorobinebers:mainfrom
Rich627:feat/gemini-provider
Feb 17, 2026
Merged

feat(gemini): add Gemini provider plugin (oauth-personal, pro/flash usage)#189
validatedev merged 3 commits intorobinebers:mainfrom
Rich627:feat/gemini-provider

Conversation

@Rich627
Copy link
Contributor

@Rich627 Rich627 commented Feb 17, 2026

Closes #13.

Summary

Add Gemini provider plugin with minimal first-merge scope:

  • plugins/gemini/plugin.js
  • plugins/gemini/plugin.json
  • plugins/gemini/plugin.test.js
  • plugins/gemini/icon.svg
  • docs/providers/gemini.md
  • README.md provider list update

Behavior:

  • Supports oauth-personal
  • Explicitly rejects unsupported auth modes (api-key, vertex-ai)
  • Reads OAuth credentials from ~/.gemini/oauth_creds.json
  • Refreshes token via Google OAuth token endpoint when needed
  • Uses Gemini quota endpoints and maps to Pro / Flash lines
  • Adds Account line from id_token email

Validation (local)

Environment:

  • Node: v20.20.0 (via /opt/homebrew/opt/node@20/bin)

Commands run:

  • npm run build
  • npm run test -- --run

Result:

  • Test Files: 38 passed
  • Tests: 570 passed

Summary by cubic

Adds a Gemini provider plugin using personal OAuth to show Pro/Flash usage, plan tier, and account email. Fixes token refresh for Homebrew installs by discovering OAuth client credentials in Homebrew paths.

  • New Features

    • Supports oauth-personal; rejects api-key and vertex-ai.
    • Uses ~/.gemini/oauth_creds.json and OAuth refresh; discovers client ID/secret from gemini-cli oauth2.js.
    • Maps plan from loadCodeAssist tier (Paid, Workspace, Free, Legacy).
    • Shows Pro and Flash usage; adds Account from id_token email.
    • Falls back to project discovery via Cloud Resource Manager; adds plugin.json, icon, docs/providers/gemini.md, README link, and tests.
  • Bug Fixes

    • Restores token refresh for Gemini CLI Homebrew installs by searching oauth2.js under /opt/homebrew/opt and /usr/local/opt.

Written for commit fdc0d64. Summary will update on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

@Rich627
Copy link
Contributor Author

Rich627 commented Feb 17, 2026

Update: Homebrew path fix + real API smoke test

Bug found & fixed

Token refresh was failing for Homebrew-installed Gemini CLI because the plugin only searched ~/.bun, ~/.npm-global, and ~/.nvm paths for OAuth client credentials (oauth2.js).

Added /opt/homebrew/opt/ (Apple Silicon) and /usr/local/opt/ (Intel) Homebrew symlink paths. See commit 6bf90ba.

Smoke test results (real Gemini API)

Ran a standalone smoke test against real Gemini credentials:

[1] Auth type: oauth-personal ✅
[2] OAuth creds loaded ✅
[3] id_token email decoded ✅
[4] Token expired → refresh via Homebrew path → success ✅
[5] loadCodeAssist HTTP 200 ✅
    project: warm-transmitter-j3lhb
[6] retrieveUserQuota HTTP 200 ✅
    12 quota buckets returned:
    - gemini-2.0-flash, gemini-2.5-flash, gemini-2.5-flash-lite
    - gemini-2.5-pro, gemini-3-flash-preview, gemini-3-pro-preview
    (+ vertex variants)

Validation

  • vitest --run: 38 files / 570 tests passed ✅
  • tsc && vite build: passed ✅

@robinebers
Copy link
Owner

Thank you! @cubic-dev-ai review

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Feb 17, 2026

Thank you! @cubic-dev-ai review

@robinebers I have started the AI code review. It will take a few minutes to complete.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Copy link
Collaborator

@davidarny davidarny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Rich627 and others added 2 commits February 17, 2026 09:59
…iscovery

Token refresh was failing for users who installed Gemini CLI via Homebrew
because the oauth2.js file is located under /opt/homebrew/opt/ (Apple Silicon)
or /usr/local/opt/ (Intel), not in ~/.bun or ~/.npm-global.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@davidarny davidarny force-pushed the feat/gemini-provider branch from 6bf90ba to 1507fde Compare February 17, 2026 06:59
Copy link
Collaborator

@validatedev validatedev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@validatedev validatedev merged commit 1c42015 into robinebers:main Feb 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Gemini plugin provider

4 participants