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

@cortexkit/opencode-openai-auth

v0.1.3

Published

ChatGPT Plus/Pro OAuth support for [OpenCode](https://opencode.ai).

Downloads

541

Readme

@cortexkit/opencode-openai-auth

ChatGPT Plus/Pro OAuth support for OpenCode.

This OpenCode plugin lets OpenCode talk to the OpenAI Codex backend using a ChatGPT Plus/Pro subscription instead of a pay-as-you-go API key. It rewrites OpenCode's outbound OpenAI requests into Codex's request shape, filters the model list to OAuth-eligible models, zeroes provider costs for those models, and adds a prompt-cache stabilizer.

The plugin registers the built-in openai provider id. OpenCode loads external plugins after its built-ins, so this package supersedes OpenCode's internal OpenAI auth hook without any change to your model configuration.

Install

{
  "plugin": ["@cortexkit/[email protected]"]
}

Restart OpenCode after changing plugin config, then authenticate:

/login openai

Features

  • ChatGPT Plus/Pro OAuth login (browser and headless device flows), plus a manual API-key fallback.
  • Codex request rewriting for OAuth requests, with Codex identity parity.
  • OAuth model filtering and zero-cost display.
  • Prompt-cache stabilizer (web_search) that keeps tool-continuation requests on the backend's cached path (on by default).
  • Multiple ChatGPT accounts with automatic reactive fallback on rate limits, configurable routing, and a per-account quota killswitch.
  • Per-turn quota tracking (5-hour + weekly windows) on both transports, with a sidebar readout and an explicit all-accounts refresh.
  • Idle prompt-cache keep-warm, with an optional subagent mode.
  • Leveled, secret-redacting, rotating log file.
  • Interactive in-TUI control surfaces for every command, plus an openai-auth CLI for managing fallback accounts headlessly.
  • Optional OpenAI Responses WebSocket transport (HTTP is the default).

Commands

Each opens an interactive dialog in the TUI and also accepts explicit arguments:

| Command | Arguments | Purpose | | --- | --- | --- | | /openai-quota | — | Show 5h + weekly quota for all accounts. | | /openai-account | add [label] · switch <id> · remove <id> · order <a> <b> | Manage main + fallback accounts (non-destructive switch). | | /openai-routing | main-first · fallback-first | Account preference order. | | /openai-killswitch | on · off · set <acct>:<5h>,<1w> ... | Hard-block accounts below quota thresholds. | | /openai-cachekeep | on · off · subagents on · subagents off | Idle prompt-cache keep-warm. | | /openai-logging | <level> | Set log level live. | | /openai-dump | on · off | Toggle transport request dumps. |

CLI (fallback accounts only; the main account comes from /login openai):

openai-auth login [--label <name>] [--headless]
openai-auth list
openai-auth remove <id>

Configuration

Settings resolve as environment variable → config file (~/.config/opencode/openai-auth.json) → default.

| Config field | Environment variable | Default | Purpose | | --- | --- | --- | --- | | webSearch | CORTEXKIT_OPENAI_AUTH_NO_WEB_SEARCH (set to disable) | true | Inject the web_search prompt-cache stabilizer. | | webSockets | CORTEXKIT_OPENAI_AUTH_WEBSOCKETS | false | Use the Codex Responses WebSocket transport instead of HTTP. | | rawWebSocket | CORTEXKIT_OPENAI_AUTH_RAW_WS | false | Use the hand-rolled raw TCP/TLS client with Codex-style incremental streaming. Bun uses Bun.connect; Node/OpenCode Desktop uses node:net/node:tls. | | dump | CORTEXKIT_OPENAI_AUTH_DUMP | false | Dump final Codex request bodies for cache debugging. | | dumpDir | OPENCODE_OPENAI_AUTH_DUMP_DIR | OS temp dir: opencode-openai-auth-dumps | Directory for request dump files. | | codexApiEndpoint | CORTEXKIT_OPENAI_AUTH_CODEX_ENDPOINT | https://chatgpt.com/backend-api/codex/responses | Send rewritten Codex requests to a compatible proxy/relay instead of ChatGPT's backend endpoint. |

See the repository README for transport differences and why web_search is needed.

License

MIT