explaingit

ysnock404/opencode-grok-auth

11TypeScriptAudience · developerComplexity · 3/5LicenseSetup · moderate

TLDR

An OpenCode plugin that lets you use xAI's Grok models by logging in through xAI's browser-based OAuth flow instead of managing an API key, supporting four Grok model variants.

Mindmap

mindmap
  root((opencode-grok-auth))
    What it does
      Grok models in OpenCode
      OAuth browser login
      No API key needed
    Models supported
      General purpose
      Reasoning variant
      Fast variant
      Multi-agent variant
    Tech stack
      TypeScript
      Bun
      OAuth
    Setup
      Build locally
      Copy to plugins folder
      Add provider config
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Use Grok language models inside OpenCode without needing to copy or manage an xAI API key.

USE CASE 2

Switch between four Grok model variants including a reasoning model and a fast model from within OpenCode.

USE CASE 3

Install a TypeScript OpenCode plugin built with Bun that handles OAuth token refresh automatically in the background.

Tech stack

TypeScriptBunOAuthxAI Grok

Getting it running

Difficulty · moderate Time to first run · 30min

Manual installation requires Bun to build locally and placing the output file in OpenCode's global plugins folder, npm publication is pending.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

This is a plugin for OpenCode, an AI coding tool, that adds support for xAI's Grok language models. Normally, connecting to Grok requires an API key. This plugin takes a different approach: it logs you in through xAI's own OAuth flow, the same login mechanism used by the SuperGrok subscription service, so you can use Grok inside OpenCode without managing an API key. OAuth is a standard way of handling logins where you approve access in a browser rather than copying a token from a dashboard. When you run the login command, the plugin opens a browser window pointing to xAI's authorization page, you sign in with your xAI account, and the plugin receives a short-lived access token that it stores and refreshes automatically in the background. The token is only ever sent to xAI's own API address, and the plugin includes a safety check that blocks it from going anywhere else. The plugin registers four Grok models in OpenCode's provider list: a general-purpose model, a reasoning-focused variant, a faster non-reasoning variant, and a multi-agent variant. You select which one to use from within OpenCode the same way you would select any other supported model. Installation is currently manual. You build the plugin locally using Bun, a JavaScript runtime, place the output file in OpenCode's global plugins folder, and add a provider block to OpenCode's configuration file. The README includes step-by-step instructions for Windows, with PowerShell commands for each step. Once published to npm, the setup will be simpler. The plugin is released under the MIT license. The README credits the implementation pattern to two other open-source projects: an Antigravity Auth plugin by a separate author and xAI OAuth work by Nous Research.

Copy-paste prompts

Prompt 1
Walk me through installing the opencode-grok-auth plugin on Windows: building it with Bun, placing it in OpenCode's plugins folder, and adding the provider block to the config file.
Prompt 2
Show me how the OAuth login flow works in opencode-grok-auth: what happens when I run the login command and how the access token is stored and refreshed.
Prompt 3
I want to modify opencode-grok-auth to add a fifth Grok model variant. Show me where models are registered in the TypeScript code and how to add a new entry.
Prompt 4
How do I select a specific Grok model variant like the reasoning model inside OpenCode after installing the opencode-grok-auth plugin?
Open on GitHub → Explain another repo

← ysnock404 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.