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 🙏

© 2026 – Pkg Stats / Ryan Hefner

open-grok-build

v0.1.5

Published

OpenCode plugin for Grok Build API (OAuth and payload sanitization).

Readme

open-grok-build

CI Version License: MIT

OpenCode plugin that connects xAI's Grok Build models (cli-chat-proxy.grok.com) to your terminal. Ships OAuth 2.0 + PKCE authentication, a curated model catalog, payload sanitization for xAI API quirks, and live billing queries — all as a drop-in plugin.

Features

  • OAuth 2.0 + PKCE — Browser-based login via auth.x.ai with automatic token refresh
  • Model catalog — Six Grok Build models with correct cost, context window, and reasoning metadata
  • Payload sanitization — Transparent rewrites for xAI's Responses API quirks (reasoning strip, image normalization, system→instructions, response_formattext.format, and more)
  • Billing usage/grok-build-usage slash command shows live credit quota as a TUI toast (no LLM turn consumed)

Quick Start

1. Install

opencode plugin -g open-grok-build

This registers both the server plugin (models, OAuth, payload sanitization) and the TUI plugin (/grok-build-usage slash command). Restart the TUI after installing.

2. Connect

/connect grok-build → Grok Build (cli-chat-proxy)

Or set GROK_BUILD_OAUTH_TOKEN for a static token bypass (no auto-refresh).

Local checkout

For development, use an absolute path:

{
  "plugin": ["/path/to/open-grok-build"]
}

Models

| Model | Context | Max Output | Reasoning | Input | |---|---|---|---|---| | grok-composer-2.5-fast | 200K | 30K | — | text, image | | grok-build | 512K | 30K | ✓ | text, image | | grok-4.3 | 1M | 30K | ✓ | text, image | | grok-4.20-0309-reasoning | 2M | 30K | ✓ | text, image | | grok-4.20-0309-non-reasoning | 2M | 30K | — | text, image | | grok-4.20-multi-agent-0309 | 2M | 30K | ✓ | text, image |

Override with GROK_BUILD_MODELS (comma-separated model IDs). Unknown IDs get sensible defaults.

Payload Sanitization

The plugin transparently rewrites outgoing requests to handle xAI's Responses API differences from stock OpenAI:

  • Strips replayed reasoning items (cause 400 errors on xAI)
  • Drops empty-string content items
  • Moves role: "developer" / role: "system" messages to top-level instructions
  • Converts image_url parts to input_image with data URIs
  • Resolves local image paths (.jpg, .jpeg, .png) to base64 — workspace-scoped for security
  • Extracts images from function_call_output.output arrays into separate user messages
  • Maps response_formattext.format
  • Adds prompt_cache_key for session-affinity caching
  • Normalizes reasoning.effort for models that support it

Environment Variables

| Variable | Default | Description | |---|---|---| | GROK_BUILD_BASE_URL | https://cli-chat-proxy.grok.com/v1 | API base URL | | GROK_BUILD_MODELS | (catalog) | Comma-separated model IDs to expose | | GROK_BUILD_OAUTH_CLIENT_ID | (built-in) | OAuth client ID override | | GROK_BUILD_CALLBACK_HOST | 127.0.0.1 | OAuth loopback callback host | | GROK_BUILD_CALLBACK_PORT | 56122 | OAuth loopback callback port | | GROK_BUILD_OAUTH_TOKEN | — | Static token bypass (skips OAuth, no refresh) | | GROK_BUILD_TOKEN_TIMEOUT_MS | 30000 | Timeout for OAuth token requests |

Development

bun install
bun run check        # lint + typecheck + knip + duplicate check + coverage
bun run test         # tests only
bun run typecheck    # tsc --noEmit
bun run coverage     # tests with coverage

License

MIT