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-oxide

v0.11.2

Published

Native Node.js bindings for openai-oxide powered by napi-rs.

Readme

openai-oxide for Node.js

npm npm downloads

Native Node.js bindings for openai-oxide, built with napi-rs. Also available on crates.io (Rust) and PyPI (Python).

The package exposes the Rust client to Node.js with native streaming and WebSocket support, while keeping release artifacts out of git. Prebuilt binaries are published to npm for the supported targets listed below.

Features

  • Native bindings for chat, responses, streaming, and WebSocket sessions
  • Shared Rust core with the main openai-oxide crate
  • Prebuilt npm artifacts for the main desktop and server targets
  • Fast-path APIs for hot loops that return only text or response id
  • Local development and release flow driven by pnpm

Why choose openai-oxide on Node?

| Feature | openai-oxide | official openai SDK | | :--- | :--- | :--- | | WebSocket Responses | Persistent wss:// session, reuses TLS for every step | REST-only | | Streaming parser | Zero-copy SSE parser + early function-call parse | HTTP/2 response buffering | | Typed Rust core | Full Response struct, hedged requests, parallel fan-outs | Generic JS objects | | Hot REST paths | createText, createStoredResponseId, createTextFollowup avoid JSON bridge | Always serializes Record<string, any> | | Platform binaries | Prebuilt .node for darwin/linux/windows in npm | Pure JS package |

The official SDK is great for HTTP/REST but does not expose WebSocket streaming or Rust-level hedged/parallel tooling out of the box. If your workload issues quick successive tool calls, streams tokens, or runs inside a WebSocket session, the native bindings keep latency and contention lower while still letting you call the same OpenAI APIs.

Supported Targets

  • macOS x64
  • macOS arm64
  • Linux x64 GNU
  • Linux x64 musl
  • Linux arm64 GNU
  • Linux arm64 musl
  • Windows x64 MSVC

Install

npm install openai-oxide
# or
pnpm add openai-oxide
# or
yarn add openai-oxide

From the repository for local development:

cd openai-oxide-node
pnpm install
pnpm build
pnpm test

Client reads credentials from the same environment variables as the Rust crate, for example OPENAI_API_KEY.

Quick Start

const { Client } = require('openai-oxide')

async function main() {
  const client = new Client()

  const response = await client.createResponse({
    model: 'gpt-4o-mini',
    input: 'Say hello to Node.js from Rust via napi-rs.'
  })

  console.log(response.output?.[0]?.content?.[0]?.text)
}

main().catch((error) => {
  console.error(error)
  process.exitCode = 1
})

Examples live in examples/:

  • examples/01_basic_request.js
  • examples/02_streaming.js
  • examples/03_websocket.js
  • examples/bench_node.js

Benchmarks

Benchmarks were run locally against the live OpenAI API with:

BENCH_ITERATIONS=5 pnpm bench

Setup:

  • Model: gpt-5.4
  • Iterations: 5
  • Reported value: median latency
  • Comparison target: official openai npm SDK

Node.js Ecosystem (openai-oxide vs openai)

openai-oxide wins 8/8 tests. Native napi-rs bindings vs official openai npm.

| Test | openai-oxide | openai | Winner | | :--- | :--- | :--- | :--- | | Plain text | 1075ms | 1311ms | OXIDE (+18%) | | Structured output | 1370ms | 1765ms | OXIDE (+22%) | | Function calling | 1725ms | 1832ms | OXIDE (+6%) | | Multi-turn (2 reqs) | 2283ms | 2859ms | OXIDE (+20%) | | Rapid-fire (5 calls) | 6246ms | 6936ms | OXIDE (+10%) | | Streaming TTFT | 534ms | 580ms | OXIDE (+8%) | | Parallel 3x | 1937ms | 1991ms | OXIDE (+3%) | | WebSocket hot pair | 2181ms | N/A | OXIDE |

median of medians, 3×5 iterations. Model: gpt-5.4.

Reproduce: cd openai-oxide-node && BENCH_ITERATIONS=5 node examples/bench_node.js

Summary: openai-oxide wins 8/8 tests.

For the lowest-overhead REST paths in Node, prefer the fast-path methods:

  • client.createText(model, input, maxOutputTokens?)
  • client.createStoredResponseId(model, input, maxOutputTokens?)
  • client.createTextFollowup(model, input, previousResponseId, maxOutputTokens?)

Development

Useful commands:

pnpm install
pnpm build
pnpm test
pnpm bench
pnpm pack:preview

pnpm build writes the local .node binary next to index.js for development only. Those generated binaries are ignored by git and are not committed. pnpm pack:preview writes a tarball preview into .preview/, which is also ignored by git.

Release Flow

The repository keeps the Node release separate from the Rust and Python releases.

For the Node package:

  1. Keep the Node package version aligned with the Rust crate and Python package version.
  2. Push a tag like node-v0.9.6.
  3. GitHub Actions builds the native addon for each supported target.
  4. The Node release workflow assembles platform packages with napi-rs and publishes to npm with pnpm publish.

Required secrets for npm publishing:

  • NPM_TOKEN

The workflow uses pnpm throughout, publishes with provenance enabled, and keeps platform-specific binaries out of the repository history.