npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

opencode-gemini-auth

v1.2.0

Published

Authenticate the Opencode CLI with your Google account so you can use your existing Gemini plan and its included quota instead of API billing.

Readme

Gemini OAuth Plugin for Opencode

Authenticate the Opencode CLI with your Google account so you can use your existing Gemini plan and its included quota instead of API billing.

Setup

  1. Add the plugin to your Opencode config:

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-gemini-auth"]
    }
  2. Run opencode auth login.

  3. Choose the Google provider and select OAuth with Google (Gemini CLI).

The plugin spins up a local callback listener, so after approving in the browser you'll land on an "Authentication complete" page with no URL copy/paste required. If that port is already taken, the CLI automatically falls back to the classic copy/paste flow and explains what to do.

Updating

[!WARNING] Opencode does NOT auto-update plugins.

To get the latest version, you need to clear the cached plugin and let Opencode reinstall it:

# Remove the plugin from cache
rm -rf ~/.cache/opencode/node_modules/opencode-gemini-auth

# Run Opencode to trigger reinstall
opencode

Alternatively, you can manually remove the dependency from ~/.cache/opencode/package.json if the above doesn't work.

Thinking Configuration

This plugin supports configuring "thinking" capabilities for Gemini models via the thinkingConfig option.

  • Gemini 3 models use thinkingLevel (string: 'low', 'medium', 'high').
  • Gemini 2.5 models use thinkingBudget (number).

The plugin passes these values through to the API as configured.

Examples

Gemini 3 (using thinkingLevel):

{
  "provider": {
    "google": {
      "models": {
        "gemini-3-pro-preview": {
          "options": {
            "thinkingConfig": {
              "thinkingLevel": "high",
              "includeThoughts": true
            }
          }
        }
      }
    }
  }
}

Gemini 2.5 (using thinkingBudget):

{
  "provider": {
    "google": {
      "models": {
        "gemini-2.5-flash": {
          "options": {
            "thinkingConfig": {
              "thinkingBudget": 8192,
              "includeThoughts": true
            }
          }
        }
      }
    }
  }
}

Local Development

First, clone the repository and install dependencies:

git clone https://github.com/jenslys/opencode-gemini-auth.git
cd opencode-gemini-auth
bun install

When you want Opencode to use a local checkout of this plugin, point the plugin entry in your config to the folder via a file:// URL:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["file:///absolute/path/to/opencode-gemini-auth"]
}

Replace /absolute/path/to/opencode-gemini-auth with the absolute path to your local clone.

Manual Google Cloud Setup

If automatic provisioning fails, use the console:

  1. Go to the Google Cloud Console and create (or select) a project, e.g. gemini.
  2. Select that project.
  3. Enable the Gemini for Google Cloud API (cloudaicompanion.googleapis.com).
  4. Re-run opencode auth login and enter the project ID (not the display name).

Debugging Gemini Requests

Set OPENCODE_GEMINI_DEBUG=1 in the environment when you run an Opencode command to capture every Gemini request/response that this plugin issues. When enabled, the plugin writes to a timestamped gemini-debug-<ISO>.log file in your current working directory so the CLI output stays clean.

OPENCODE_GEMINI_DEBUG=1 opencode

The logger shows the transformed URL, HTTP method, sanitized headers (the Authorization header is redacted), whether the call used streaming, and a truncated preview (2 KB) of both the request and response bodies. This is handy when diagnosing "Bad Request" responses from Gemini. Remember that payloads may still include parts of your prompt or response, so only enable this flag when you're comfortable keeping that information in the generated log file.

404s on gemini-2.5-flash-image. Opencode fires internal summarization/title requests at gemini-2.5-flash-image. The plugin automatically remaps those payloads to gemini-2.5-flash, eliminating the extra 404s for accounts without image access. If you still see a 404, confirm your project actually has access to the fallback model.