Open Think Start Free →

A companion Worker (not a plugin) that proxies paste-in Codex tokens to the ChatGPT backend the `codex` CLI talks to. Uses a Durable Object for token storage and exposes /rpc + /stream for the main Worker's `codex` plugin. Pick this when you want to stay entirely on Cloudflare. **Caveat:** the bridge can't refresh tokens itself — you rotate them by running `codex login` locally and POSTing the new values to /auth/rotate. Full thread/turn/steer semantics still need the Node codex-bridge in companion/codex-bridge/.

Install

1 · Steps

Reference repository:

https://github.com/open-think/open-think/tree/main/companion/codex-bridge-worker

  1. cd companion/codex-bridge-worker
  2. npm install
  3. wrangler secret put BRIDGE_TOKEN ← long random string; set this BEFORE deploy so the DO migration picks it up
  4. npx wrangler deploy ← creates the Worker + CodexAuthDO
  5. Run `codex login` locally, then grab accessToken + idToken from ~/.codex/auth.json
  6. curl -X POST https://<bridge-worker>/auth/rotate -H 'authorization: Bearer <BRIDGE_TOKEN>' -d '{"accessToken":"...","idToken":"..."}'
  7. On the main Worker: set CODEX_APP_SERVER_URL=https://<bridge-worker> and CODEX_APP_SERVER_TOKEN=<BRIDGE_TOKEN> (same value)
  8. Redeploy the main Worker and call /healthz on the bridge to confirm { configured: true }

Tags

codexbridgecompanioncloudflare-nativeno-dockermanual-rotation