Google Gemini OAuth Plugin for Opencode: What Still Works After Google's June 2026 Deprecation

Murtuzaali Surti
Murtuzaali Surti

• 4 min read

Updated

TL;DR

Table of Contents

CAUTION

Update (August 2026): Google deprecated Gemini Code Assist consumer account access on June 18, 2026. The Gemini CLI OAuth flow no longer works for Gemini Code Assist for individuals, Google AI Pro, or Google AI Ultra accounts. Google stopped serving requests for these tiers and removed the "Login with Google" option. Only Gemini Code Assist Standard and Enterprise subscriptions still work with this plugin (you'll need to configure a Google Cloud projectId as shown below), and Google has stated that using Gemini CLI OAuth with third-party software is a policy-violating use case which may trigger abuse detection. If you're on a consumer Google AI subscription, the low-risk path is to use Opencode with a regular Gemini API key instead.

Opencode is an open source AI coding agent similar to Claude Code, Gemini CLI, and Codex. It's an interactive terminal user interface (TUI) which connects with most of the AI model (LLM) providers out there, OpenRouter, Google, Anthropic, OpenAI, Amazon Bedrock, Groq, Ollama, you name it.

Out of the box, Opencode allows you to connect Google as a provider via an API key. But, what if you don't have a Google Cloud API key? What if you've purchased a Google AI Pro/Ultra subscription, or received a free Google AI subscription (students and users in India often qualify for these offers), and want to use it with Opencode?

To use a Google AI subscription, you need to sign in with your Google account in Opencode. The problem is, Opencode doesn't support this out of the box. I came across a plugin from a GitHub issue in the Opencode repository which solves this exact problem.

opencode-gemini-auth by Jens Lystad allows you to sign in using your Google account via OAuth and use any Gemini models accessible via your subscription with Opencode.

In this tutorial, I'll walk you through setting up the opencode-gemini-auth plugin with Opencode.

Pre-requisites

  • A Google account with access to Gemini (Gemini Code Assist Standard or Enterprise for the OAuth flow, since the consumer tiers were deprecated in June 2026)
  • Opencode CLI installed

Installing Opencode

First, install Opencode if you haven't already using the simple shell script below:

curl -fsSL https://opencode.ai/install | bash

Locating the Config File

Opencode uses a JSON config file for configuration. I recommend using a global config for configuring providers, but you're free to use a local (project-scoped) config file (opencode.json) instead.

Find the global config file at these locations:

  • macOS/Linux: ~/.config/opencode/opencode.json
  • Windows: Run opencode debug paths to check the config file location

If the global opencode.json config file doesn't exist yet, create it at the respective location for your operating system.

Registering the Plugin

Add the following to your Opencode config file:

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

That's it. Opencode is now ready to use Google OAuth for authentication.

Connecting Your Google Account

CAUTION

The OAuth flow below only works with Gemini Code Assist Standard and Enterprise subscriptions after the June 2026 deprecation. If you're using a consumer Google AI plan (Pro, Ultra, or free tier), this flow will fail and your best option is the API key route.

Once you've updated the config file with the plugin, run this command:

opencode auth login

Choose Google from the list of providers. You'll see an OAuth with Google option. Selecting it will open a browser window and redirect you to the Google OAuth flow. After you sign in and grant access, Opencode can access any Gemini models associated with your subscription.

Pro Tip

If the browser doesn't open automatically (common in headless environments or when the port is in use), you can manually paste the callback URL or authorization code when prompted.

Troubleshooting

To view detailed logs for debugging, run Opencode with the debug flag:

OPENCODE_GEMINI_DEBUG=1 opencode

It will generate gemini-debug-<timestamp>.log files in your working directory.

Updating the Plugin

Opencode doesn't automatically update plugins. To update to the latest version, clear the cached plugin and restart Opencode:

rm -rf ~/.cache/opencode/node_modules/opencode-gemini-auth
opencode

Wrapping Up

The opencode-gemini-auth plugin was a straightforward way to use your existing Gemini quota directly within Opencode's terminal user interface. After Google's June 2026 deprecation of consumer account access, it remains useful mainly for Gemini Code Assist Standard and Enterprise users (who should configure provider.google.options.projectId in their Opencode config, or set the OPENCODE_GEMINI_PROJECT_ID environment variable). Everyone else is better off with a standard Gemini API key, which Opencode supports natively through the /connect command.

Note that your usage is subject to the quotas and rate limits of whichever Google plan or API tier you end up using.


How to Use Free Antigravity AI Models in Claude Code

Previous

A Million Token Context Window Isn't What You Think It Is

Next