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

openai-ws-opencode

v0.1.24

Published

OpenCode plugin for OpenAI Responses WebSocket transport.

Readme

openai-ws-opencode

Standalone OpenCode provider plugin for routing OpenAI Responses API streaming requests over WebSocket transport.

What it provides

  • Provider id: openai-ws
  • API-key transport: wss://api.openai.com/v1/responses
  • ChatGPT/Codex OAuth transport: wss://chatgpt.com/backend-api/codex/responses
  • Curated GPT/Codex model table with OpenCode variants
  • Auth-aware model discovery at auth-load time: Codex backend models for ChatGPT OAuth, OpenAI /v1/models IDs for API keys, bundled table fallback for both
  • WebSocket-to-SSE bridge so OpenCode can keep using its normal streaming path

Install

npm install -g openai-ws-opencode
openai-ws-opencode setup --global
opencode auth login openai-ws

For project-local setup:

openai-ws-opencode setup --project
opencode auth login openai-ws

The setup command is idempotent. It adds the npm plugin entry and a fallback provider.openai-ws model registry to opencode.json, preserving existing user model overrides.

At runtime the plugin also attempts short best-effort model discovery for the selected auth mode. ChatGPT/Codex OAuth uses https://chatgpt.com/backend-api/codex/models; API-key auth uses https://api.openai.com/v1/models as an availability filter around the bundled WebSocket model table. Both paths fall back to the bundled table if discovery is unavailable.

Set OPENAI_WS_OPENCODE_SKIP_CATALOG=1 to skip runtime catalog lookups and use only the bundled fallback table plus your config overrides.

Manual config

If you do not want to use the setup command, add this shape to your OpenCode config and copy model entries from openai-ws-opencode setup --path <temp-file> output:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["openai-ws-opencode@latest"],
  "provider": {
    "openai-ws": {
      "name": "OpenAI WebSocket",
      "api": "https://api.openai.com/v1",
      "npm": "@ai-sdk/openai",
      "models": {
        "gpt-5.3-codex": {
          "name": "GPT 5.3 Codex (WebSocket)",
          "reasoning": true,
          "temperature": false,
          "attachment": true,
          "tool_call": true,
          "limit": { "context": 258400, "output": 128000 },
          "modalities": { "input": ["text", "image"], "output": ["text"] },
          "options": {},
          "provider": { "npm": "@ai-sdk/openai", "api": "https://api.openai.com/v1" }
        }
      }
    }
  }
}

Auth modes

API key

Choose OpenAI (WebSocket) - API Key during opencode auth login openai-ws.

This path uses the public OpenAI Responses WebSocket endpoint and sends:

  • Authorization: Bearer <OPENAI_API_KEY>
  • OpenAI-Beta: responses_websockets=2026-02-06

ChatGPT/Codex OAuth

Choose the browser or headless ChatGPT Pro/Plus OAuth option during opencode auth login openai-ws.

This path uses the Codex/ChatGPT backend and sends:

  • Authorization: Bearer <access-token>
  • ChatGPT-Account-Id when available
  • originator: opencode
  • OpenAI-Beta: responses_websockets=2026-02-06

Important: the OAuth/Codex WebSocket path is unofficial, reuses Codex OAuth behavior, targets a private ChatGPT backend, can break without notice, and may carry account or terms-of-service risk. This project is not affiliated with OpenAI or OpenCode.

Local development install

From this repo:

bun install
bun run build
npm pack

Then point OpenCode at the packed tarball through the plugin array:

{
  "plugin": ["openai-ws-opencode@file:/absolute/path/openai-ws-opencode-0.1.5.tgz"]
}

Direct file:///absolute/path/dist/index.js imports are useful for debugging, but npm/tarball installs better match how OpenCode resolves dependencies.

Development

bun install
bun run lint
bun run typecheck
bun test
bun run build
npm pack --dry-run

The root package export intentionally exposes only the OpenCode plugin function because OpenCode calls every function exported by the root module. Test helpers are available from openai-ws-opencode/testing.

Troubleshooting

  • Provider is not visible: run openai-ws-opencode setup --global or add provider.openai-ws manually.
  • Missing auth: run opencode auth login openai-ws.
  • OAuth refresh failed: re-run opencode auth login openai-ws and choose a ChatGPT OAuth method.
  • WebSocket 401/403: verify the selected auth mode and account entitlement. OAuth/Codex behavior may change upstream.
  • Local file:// install cannot find ws: use the packed tarball install path or add dependencies to your OpenCode config directory.