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

crabex

v1.0.0

Published

Route models and inspect context inside Codex

Readme


Crabex is a local proxy that sits between Codex (CLI and Desktop) and its backend. Codex keeps working exactly as it does today: your ChatGPT subscription login, the /model picker, native subagents, Apps, WebSockets. Crabex lets you put other models inside that shell, and shows you precisely what Codex sends to them.

Like a hermit crab, the model moves in; the shell stays the same.

Why

Most "use other models with Codex" setups replace Codex's provider with an API key and lose what makes the harness good. Crabex takes the opposite approach:

  • No new login. It forwards your existing Codex OAuth session to chatgpt.com. No API key, no CLIProxyAPI. Routed models use their own tokens.
  • Native, not bolted on. Routed models appear in Codex's own model picker, can be spawned as native subagents, and keep tool calls, compaction, and reasoning working across providers.
  • Glass box. Every request chain is captured locally, so you can see which instructions, tools, and history consume your context, then trim them.

What it does

| | Capability | Details | | --- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 🔀 | Model routing | Map any Codex model slug to an OpenAI-compatible Responses gateway or a native Anthropic Messages API (including Bedrock Mantle). HTTP/SSE and WebSocket on both sides. Anthropic routes | | 📋 | Model picker integration | Routed models are injected into Codex's /models catalog with display names, descriptions, ordering, and metadata copied from a template model. Catalog refresh | | 🛟 | Failover and flex | Ordered fallback targets with retry, backoff, and circuit breakers. Advertise -flex slugs for half-price OpenAI flex processing that falls back to standard. Flex routes | | 🧑‍🤝‍🧑 | Subagents across providers | Spawn routed models as Codex subagents, see which routes hold native spawn slots, and safely mix provider histories in forks and child agents. Tool compatibility | | 🧰 | Tool compatibility | Per-route tool policy: pass, translate, broker, omit, or reject each tool type. Freeform apply_patch, tool_search, and web search keep working on models that don't support them natively. Tool compatibility | | 🔍 | Context inspector | Captures every request chain and breaks it into context parts, sections, tools, and token estimates, per model, harness, and project. Captures · Design | | ✂️ | Transformations | Rules that delete context parts, rewrite text, or disable tools before a request leaves your machine, with hit/miss telemetry and on-demand preview. Inspector | | 🔌 | Apps relay | Keeps Slack, Drive, and other ChatGPT Apps working when Codex's ChatGPT base URL points at the proxy. Apps relay | | ⚙️ | Config-bundle overrides | Answer Codex's remote config-bundle fetch with your own edited bundle, from the Advanced page. | | 📈 | Live traffic and stats | Watch in-flight requests, routing attempts, fallbacks, cache use, and flex vs. standard serves. | | 🍎 | macOS service | One command installs a LaunchAgent with its own runtime, local HTTPS with Keychain trust, safe restarts, and automatic rollback. macOS service |

Everything is configured from the web UI served on the proxy's own port, or from plain JSON files under .crabex/.

How it works

 Codex CLI / Desktop                     Crabex (127.0.0.1:8765)                     Upstreams
┌──────────────────┐   Responses API   ┌───────────────────────────────┐   OAuth   ┌──────────────────┐
│ /model picker    │ ────────────────▶ │ capture ─▶ transform ─▶ route │ ────────▶ │ chatgpt.com      │
│ subagents, tools │   HTTP / WS       │                               │ ────────▶ │ Responses gateway│
│ Apps (MCP)       │ ◀──────────────── │ UI + local API on same port   │ ────────▶ │ Anthropic API    │
└──────────────────┘                   └───────────────────────────────┘           └──────────────────┘

Unrouted models go to chatgpt.com with your login, unchanged except for any transformations you enable. Routed models are translated to the target API and back, so Codex never knows the difference.

Quick start

With Bun and a working Codex login:

bunx crabex@latest proxy

Or install with Homebrew (includes Bun):

brew install niieani/tap/crabex
crabex proxy

The proxy runs anywhere Bun does; the background service is macOS-only. To build from source, install Vite+ (vp, which provides Bun), clone this repository, and run:

vp install
vp run build
./packages/proxy/dist/cli.mjs proxy

Open http://127.0.0.1:8765. On the Codex setup page, turn on both endpoint toggles. Or add them to ~/.codex/config.toml yourself:

openai_base_url = "http://127.0.0.1:8765/backend-api/codex"
chatgpt_base_url = "http://127.0.0.1:8765/backend-api"

Prefer to opt in for a single CLI session? Pass both settings on the command line:

codex \
  -c 'openai_base_url="http://127.0.0.1:8765/backend-api/codex"' \
  -c 'chatgpt_base_url="http://127.0.0.1:8765/backend-api"'

For a reusable opt-in profile on current Codex versions, put those two TOML settings in ~/.codex/crabex.config.toml and run codex --profile crabex. See the Codex configuration guide for configuration precedence and profile support.

Then run Codex as usual. Captures show up live in the UI. Add a route on the Model routes page and the new model appears in Codex's /model picker.

To keep Crabex running across reboots (and use the ChatGPT desktop app, which requires HTTPS):

bunx crabex@latest service install --https

With Homebrew, use crabex service install --https. After updating the package, refresh the service's independent copy using the service update instructions.

Configuration

All state lives in .crabex/ relative to where you start the proxy (the macOS service keeps its own copy under ~/Library/Application Support/crabex/data). Keep private route configuration there rather than in a repository.

| File | Purpose | | -------------------------------------------- | ------------------------------------------------------------------------------------------- | | model-routes.json | Routes, targets, tool policies, picker metadata | | transformations.json | Context transformation rules | | config.json | Proxy settings (Apps relay, routed agents, search broker) | | config-bundle.json | Config-bundle override | | captures/ | NDJSON request captures, kept for 7 days or 2 GiB (retention) | | stats.json | Route counters and a daily per-model token ledger, kept indefinitely | | upstream-cache.json, snapshot-cache.json | Caches |

Every path can be overridden with a flag; run crabex --help for the full list.

CLI

crabex proxy [--listen 127.0.0.1:8765] [--upstream https://chatgpt.com] [--project <key>] ...
crabex service install [--https] [--env NAME]... [-- proxy options]
crabex service uninstall|status|restart|logs
crabex service tls status|renew|remove

Documentation

Privacy and security

Crabex binds to loopback by default and is meant for a trusted, single-user machine. Captures stay on disk with owner-only permissions and never include headers. Your ChatGPT credentials are held in memory only; route tokens come from environment variables you name. See the Apps relay limitations before exposing the listener beyond localhost.

Development

vp run dev     # build both packages and watch, single listener
vp check       # format, lint, type check
vp run test    # tests (Bun-native; not bare `vp test`)
vp run build

The repository holds packages/proxy (Bun server and CLI) and packages/ui (React and Tailwind UI). vp run dev:ui runs a standalone Vite server for frontend-only work.

See CONTRIBUTING.md for contribution guidelines and SECURITY.md for private vulnerability reporting.

License

MIT © Bazyli Brzóska