Registry / ai-ml / openai-ws-opencode

openai-ws-opencode

JSON →
library0.1.24jsnpmunverified

OpenCode provider plugin routing OpenAI Responses API streaming over WebSocket transport (v0.1.24). Supports both API-key auth (public OpenAI endpoint) and ChatGPT/Codex OAuth (private backend, unofficial). Provides model discovery at auth-load time, WebSocket-to-SSE bridging, and a bundled model table fallback. Active development with monthly releases. Distinct from other OpenAI plugins by focusing on WebSocket transport for real-time responses.

npm install openai-ws-opencode
INSTALL
IMPORT
SIG · OPENAI-WS-OPENCODE
O
openai-ws-opencode
ai-mljavascriptv0.1.24
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import openaiWsOpencode from 'openai-ws-opencode'
const openaiWsOpencode = require('openai-ws-opencode')
Package exports a single default function to be used as an OpenCode plugin. ESM-only.
OpenAIWsProvider
import { OpenAIWsProvider } from 'openai-ws-opencode'
Named export for the provider class, typed and usable separately outside OpenCode plugin registration.
type Config
import type { Config } from 'openai-ws-opencode'
import { Config } from 'openai-ws-opencode'
Config is a type only, not a runtime value. Must use 'import type'.

Shows how to import and register the openai-ws-opencode plugin in OpenCode configuration, including model definitions.

import openaiWsOpencode from 'openai-ws-opencode'; // Register the plugin in your OpenCode config: const config = { plugin: ['openai-ws-opencode@latest'], provider: { 'openai-ws': { name: 'OpenAI WebSocket', api: 'https://api.openai.com/v1', models: { 'gpt-4o-codex': { name: 'GPT-4o Codex (WebSocket)', reasoning: false, temperature: true, attachment: true, tool_call: true, limit: { context: 128000, output: 16384 }, modalities: { input: ['text', 'image'], output: ['text'] }, options: {}, provider: { npm: '@ai-sdk/openai', api: 'https://api.openai.com/v1' } } } } } }; // Plugin function can be used directly: openaiWsOpencode({ apiKey: process.env.OPENAI_API_KEY ?? '' })
Debug
Known issues
gotchaThe OAuth/Codex WebSocket path is unofficial and may break without notice.
fix
Use API-key auth for production; OAuth path is experimental.
affects: >=0.1.0
breakingPeer dependency on @opencode-ai/plugin >=1.0.0 <2. Incompatible with OpenCode 0.x.
fix
Ensure OpenCode is version 1.x.
affects: >=0.1.0
gotchaModel discovery can fail at runtime; plugin falls back to bundled table silently.
fix
Set OPENAI_WS_OPENCODE_SKIP_CATALOG=1 to skip runtime discovery and rely on config/bundled table.
affects: >=0.1.0
deprecatedThe 'require' pattern is not supported; package is ESM-only.
fix
Use import statements; set 'type': 'module' in package.json if needed.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'openai-ws-opencode'
Package not installed or not linked correctly in OpenCode plugin array.
fix
Run `npm install -g openai-ws-opencode` and configure plugin array with 'openai-ws-opencode@latest'.
TypeError: openaiWsOpencode is not a function
Incorrect import (default vs named).
fix
Use `import openaiWsOpencode from 'openai-ws-opencode'` (default import).
Error: openai-ws-opencode requires @opencode-ai/plugin >=1.0.0
OpenCode version is too old.
fix
Upgrade OpenCode to version 1.x.
Upgrade
Version history
0.1.24latest on npm
Audit
Dependencies
@opencode-ai/pluginrequiredPeer dependency: plugin interface for OpenCode >=1.0.0 <2
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
openai-ws-opencode — npm install openai-ws-opencode · libregistry