Codex Remote Proxy lets Codex stay signed into ChatGPT for remote-control features while sending the actual model traffic to your own OpenAI-compatible upstream and API key.
npm install -g @cluic/codex-remote-proxyThen run:
crp startYou can also run it without a global install:
npx @cluic/codex-remote-proxy startCodex splits request routing and authentication across two local files:
~/.codex/config.tomlcontrols the OpenAIbase_url~/.codex/auth.jsoncontrols theAuthorizationtoken
When Codex is signed into ChatGPT, requests may still carry tokens.access_token instead of the API key required by your upstream provider.
This package inserts a local proxy that:
- receives Codex requests on
127.0.0.1 - forwards them to the real upstream
- rewrites
Authorizationto the real upstream API key
The easiest persistent setup is to add this section to ~/.codex/config.toml:
[codex_remote_proxy]
upstream_base_url = "https://your-upstream.example.com"
upstream_api_key = "sk-your-key"
capture_enabled = true
capture_db_path = "/Users/you/.codex-remote-proxy/traffic.sqlite3"Then run:
crp startIf you do not want to place secrets in ~/.codex/config.toml, use one of these alternatives instead:
crp init
crp startcrp init stores the upstream configuration under:
~/.codex-remote-proxy/config.json
export CRP_UPSTREAM_BASE_URL="https://your-upstream.example.com"
export CRP_UPSTREAM_API_KEY="sk-your-key"
export CRP_CAPTURE_ENABLED="true"
export CRP_CAPTURE_DB_PATH="/Users/you/.codex-remote-proxy/traffic.sqlite3"
crp startcrp start resolves values in this order:
- CLI flags
- Environment variables
~/.codex/config.tomlunder[codex_remote_proxy]usingupstream_base_url,upstream_api_key,capture_enabled, andcapture_db_path- Saved config from
crp init - Interactive prompts
SQLite request capture is optional and off by default.
When enabled, the proxy stores one full request/response transaction per row in:
~/.codex-remote-proxy/traffic.sqlite3
You can enable it at startup:
crp start --capture
crp start --capture --capture-db-path /Users/you/.codex-remote-proxy/custom-traffic.sqlite3Or hot-toggle it on a running proxy:
crp capture on
crp capture off
crp capture status --jsonEdits to ~/.codex-remote-proxy/node/proxy-config.json also hot-apply capture.enabled. Changes to capture.dbPath are detected but require a restart before the new database path is used.
-
crp checkInspect Codex config, auth mode, runtime availability, and managed service state -
crp startAccept upstream settings from CLI flags, environment variables,~/.codex/config.toml[codex_remote_proxy], or prompts; choose a free port, patch Codex, and start the proxy in the background by default -
crp initSave upstream settings and optional capture defaults once under~/.codex-remote-proxy/ -
crp capture on|off|statusToggle SQLite request capture at runtime for a managed proxy, or save the preference for the next start -
crp statusShow managed service status and health -
crp stopStop the managed service -
crp guidePrint AI-oriented usage guidance
This package uses Changesets and GitHub Actions for npm releases.
From node/:
npm run changesetCommit the generated file under .changeset/ with your feature PR. After the PR is merged to main, GitHub Actions will open or update a release PR. Merging that release PR publishes the package to npm.
See RELEASING.md for the one-time npm Trusted Publishing setup.
crp startmodifies~/.codex/config.tomland creates a backup- the managed proxy runs in the background by default
- managed state and logs live under
~/.codex-remote-proxy/ - request capture redacts sensitive headers before writing
- Node.js 22.13.0 or newer is required