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

@nima__/oai-proxy

v0.1.0

Published

Local ChatGPT subscription proxy exposing an OpenAI-compatible API.

Readme

oaiproxy

Simple experimental proxy and local bridge that signs into a ChatGPT subscription account and exposes an OpenAI-compatible API on http://127.0.0.1:1456.

Current scope:

  • POST /v1/chat/completions
  • GET /v1/models
  • GET /v1/models/:id
  • GET /health
  • POST /auth/login
  • POST /auth/logout
  • GET /auth/status
  • GET /auth/callback

Requirements

  • Node.js 22.11.0 or newer
  • npm 10+
  • A local browser session that can complete OpenAI OAuth

Install

npm install -g @nima__/oai-proxy

Run

oaiproxy

Default listen address:

  • Host: 127.0.0.1
  • Port: 1455

On startup:

  • If a usable auth session is found, the server starts immediately.
  • If auth is missing, the terminal prompts: No valid ChatGPT auth found. Launch browser login now? [Y/n]
  • If you answer Y or press enter, the browser opens and the callback returns to http://localhost:1455/auth/callback

Run As A LaunchAgent

The clean macOS way to keep this running for a local OpenAI-compatible client is a user-scoped launchd agent.

That is exactly what I set up locally:

  • a plist under ~/Library/LaunchAgents/
  • absolute node path in ProgramArguments
  • repo root as WorkingDirectory
  • stdout/stderr sent to log files under ~/Library/Logs/oaiproxy/

Important: install auth first. The background agent has no interactive terminal, so do one successful login with:

oaiproxy

After auth exists, install the LaunchAgent:

oaiproxy-launchd install

Useful commands:

oaiproxy-launchd status
oaiproxy-launchd logs
oaiproxy-launchd uninstall

Defaults used by the LaunchAgent:

  • Label: dev.oaiproxy.server
  • Plist: ~/Library/LaunchAgents/dev.oaiproxy.server.plist
  • Logs:
    • ~/Library/Logs/oaiproxy/stdout.log
    • ~/Library/Logs/oaiproxy/stderr.log

You can override the runtime parameters at install time:

PORT=1555 LOG_LEVEL=debug oaiproxy-launchd install

To change the port after the agent is already installed, edit the plist directly and reload:

# 1. Edit the PORT value in the plist
nano ~/Library/LaunchAgents/dev.oaiproxy.server.plist

# 2. Reload (this stops the running process and starts it on the new port)
launchctl unload ~/Library/LaunchAgents/dev.oaiproxy.server.plist
launchctl load  ~/Library/LaunchAgents/dev.oaiproxy.server.plist

Do not kill the process with kill or pkillKeepAlive is set, so launchd will immediately restart it on the old port.

You can also pin a specific Node binary if your shell uses a version manager:

NODE_BINARY="$(command -v node)" oaiproxy-launchd install

If your reusable auth lives under a custom CODEX_HOME, pass that during install too:

CODEX_HOME="/path/to/codex-home" oaiproxy-launchd install

Configuration

Environment variables:

  • HOST
    • Default: 127.0.0.1
    • Listen host for the local server.
  • PORT
    • Default: 1455
    • Listen port for the local server.
  • LOG_LEVEL
    • Default: info
    • Pino log level. Accepts fatal, error, warn, info, debug, trace, silent.
  • UPSTREAM_TIMEOUT_MS
    • Default: 30000
    • Timeout used for OAuth token exchange and upstream Codex requests.

The OAuth callback URL is derived from the current PORT and always uses:

  • http://localhost:<PORT>/auth/callback

Auth files

Primary auth file written by this project:

  • ~/.chatgpt-codex/auth.json

Read-only fallback sources:

  • $CODEX_HOME/auth.json
  • ~/.codex/auth.json

If fallback auth is used, refreshes and new logins still write to ~/.chatgpt-codex/auth.json.

Endpoints

GET /health

  • Simple liveness check.

GET /auth/status

  • Shows whether auth is usable.
  • Returns the source auth path, email, plan type, account id, and expiry.

POST /auth/login

  • Starts OAuth login and opens the browser.

POST /auth/logout

  • Removes the primary local auth file.

GET /v1/models

  • Returns the tested model list.

GET /v1/models/:id

  • Returns a single model record for supported model ids.

POST /v1/chat/completions

  • Supports both stream: true and stream: false
  • Converts OpenAI chat messages into the upstream Codex responses format
  • Preserves multimodal user content with OpenAI-compatible image_url parts
  • Translates upstream SSE back into OpenAI-compatible chat completion output

Quick checks

Health:

curl http://127.0.0.1:1455/health

Auth status:

curl http://127.0.0.1:1455/auth/status

Models:

curl http://127.0.0.1:1455/v1/models

Streaming chat completion:

curl -sN http://127.0.0.1:1455/v1/chat/completions \
  -H 'content-type: application/json' \
  -d '{
    "model": "gpt-5.4",
    "stream": true,
    "messages": [
      { "role": "system", "content": "Reply briefly." },
      { "role": "user", "content": "Say hello in three words." }
    ]
  }'

Non-streaming chat completion:

curl http://127.0.0.1:1455/v1/chat/completions \
  -H 'content-type: application/json' \
  -d '{
    "model": "gpt-5.4",
    "stream": false,
    "messages": [
      { "role": "system", "content": "Reply briefly." },
      { "role": "user", "content": "Say hello in three words." }
    ]
  }'

Multimodal chat completion:

curl http://127.0.0.1:1455/v1/chat/completions \
  -H 'content-type: application/json' \
  -d '{
    "model": "gpt-5.5",
    "stream": false,
    "messages": [
      { "role": "system", "content": "Describe images briefly." },
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "What is important in this image?" },
          {
            "type": "image_url",
            "image_url": {
              "url": "data:image/png;base64,...",
              "detail": "low"
            }
          }
        ]
      }
    ]
  }'

Client setup

For any OpenAI-compatible client, use:

  • Base URL: http://127.0.0.1:1455
  • Model: gpt-5.4
  • API key: leave blank unless the client insists on a value

The prototype route to use is /v1/chat/completions.

If you installed the LaunchAgent with a custom port, use that port in the client too.

Development

Typecheck:

npm run typecheck

Tests:

npm test