Use Codex from your phone while the real work stays on your computer.
Codex Relay is a mobile companion for the Codex CLI. It runs a local relay server in your workspace, pairs with the mobile app over your own network, and lets you follow or steer Codex sessions from your phone.
Codex Relay is an independent project. It is not affiliated with, endorsed by, or sponsored by OpenAI or the OpenAI Codex team.
The project is intentionally local-first. Your code, shell, git state, and Codex CLI session stay on your computer; the phone talks to the relay that you run.
- Stream Codex output from a local workspace to a paired mobile app.
- Send prompts, continue threads, and respond when Codex needs input.
- Review active threads, queued inputs, approvals, and workspace state.
- Preview git changes, local web output, files, and terminal surfaces from mobile.
- Choose separate turn-complete and action-required push notifications.
- Keep pairing and session data under your local relay state.
- Node.js 22.14 or newer
- Codex CLI installed and signed in
- Codex Relay on your phone
- A network path from your phone to your computer
From the workspace where you want Codex to work:
npx codex-relay@latestThe relay prints a QR code, a mobile URL, and a codex-relay://pair... pairing
link.
Open the mobile app and scan the QR code printed by the relay. If scanning is
not available, paste the full codex-relay://pair... link into the app.
When the app shows an approval code, approve it from your computer:
npx codex-relay@latest approve XXXX-XXXXYour phone can now talk to your local Codex session.
The default relay uses its own Codex app-server process. To make mobile and a terminal TUI use the same shared app-server, start the relay with:
npx codex-relay@latest --shared-app-serverWhen a shared app-server is already running, the relay attaches to it instead of starting another one. If the relay's own socket connection resets, it reconnects without deliberately stopping the shared app-server.
Then attach a new terminal TUI. On macOS, Linux, or WSL:
codex resume --remote unix://On native Windows:
codex resume --remote ws://127.0.0.1:8788An already-running standalone TUI cannot be converted in place. Exit it and reconnect with --remote. Shared mode requires a recent Codex CLI with app-server and remote-resume support. It uses a Unix socket on macOS, Linux, and WSL, or a loopback-only WebSocket on Windows.
Shared mode uses Codex's experimental app-server transport. A directly connected terminal TUI has its own WebSocket connection, which the relay cannot observe or reconnect. If that terminal reports a socket reset while the thread continues on mobile, reconnect it with the matching remote endpoint above and append the thread ID if needed.
After pairing, open Settings > Notifications in the mobile app and enable either or both alerts:
- Turn complete for completed or failed Codex turns
- Action required for approval and input requests
The relay sends only a generic alert plus opaque thread and turn identifiers needed to open the conversation. It does not send prompts, responses, commands, or approval text through the push service. Push support requires a native mobile build that includes expo-notifications; an OTA update alone cannot add that native module.
Your phone must be able to open the Mobile: URL printed by Codex Relay.
- Same Wi-Fi usually works.
- Tailscale is a good default when the devices are on different networks.
Pairing only makes the Codex Relay server reachable. If you open a local web app from the mobile Web preview, that app's port must also be reachable from the phone.
When using Tailscale, prefer Tailscale Serve
for preview ports so the iOS WebView loads the site over HTTPS. For example,
if your local app runs on http://127.0.0.1:3000:
tailscale serve 3000Tailscale prints an https://<machine>.<tailnet>.ts.net URL. Open that HTTPS
URL in the mobile Web preview instead of http://100.x.y.z:3000. If the Web
preview says App Transport Security requires a secure connection, the app is
trying to load a plain HTTP URL; expose that same port with tailscale serve
or another HTTPS tunnel and retry.
The mobile Web preview also detects http://100.x.y.z:<port> and
http://<machine>.<tailnet>.ts.net:<port> URLs. When detected, tap Serve
in the Tailscale row to run Tailscale Serve for that port from the relay machine
and switch the preview to the returned HTTPS URL automatically.
Please use English as the default language for GitHub issues, pull requests, and maintainer-facing discussions. If English is difficult, start with a short English summary and then include the rest in the language you are most comfortable using.
Before opening a connection issue, confirm the network checklist in the issue template. Most pairing failures happen because the phone cannot reach the relay URL printed by the computer.
Changes to the published codex-relay package should include a changeset:
pnpm changesetCommit the generated file with the change. The release workflow maintains a release pull request and publishes it after that pull request is merged. See the Changesets guide for the release process.
| Command | What it does |
|---|---|
npx codex-relay@latest |
Start the relay and print a pairing QR. |
npx codex-relay@latest --bg |
Keep the relay running in the background. |
npx codex-relay@latest --shared-app-server |
Share live sessions with an attached terminal TUI. |
npx codex-relay@latest qr |
Print the current pairing QR for an existing relay. |
npx codex-relay@latest approve XXXX-XXXX |
Approve a pending mobile pairing request. |
npx codex-relay@latest clear |
Sign out every paired mobile app. |
The relay listens on 0.0.0.0:8787 by default.
| Variable | Purpose |
|---|---|
PORT |
Server port. Defaults to 8787. |
HOST |
Listen host. Defaults to 0.0.0.0. |
CODEX_RELAY_WORKSPACE_PATH |
Workspace path Codex should use. Defaults to the current directory. |
CODEX_RELAY_AUTH_DB_PATH |
Pairing and session database path. |
CODEX_RELAY_APP_SERVER_MODE |
socket for shared terminal/mobile sessions; defaults to stdio. |
CODEX_BIN |
Codex CLI executable path. |
CODEX_HOME |
Codex home directory for reading local session metadata. |
Background mode writes runtime files under .codex-relay/ in the current
workspace, including server logs, process state, and pairing data.
If qr cannot find a server, start one first:
npx codex-relay@latestIf another process is using the local pairing database, use the existing server:
npx codex-relay@latest qrIf the mobile app cannot connect, confirm that the phone can reach the printed
Mobile: URL and that your firewall allows traffic on the relay port.
Connection checklist:
- Are the phone and computer on the same Wi-Fi or LAN?
- If keeping the same network is difficult, are both devices connected through Tailscale or another reachable private network?
- Can the phone open the exact
Mobile:URL printed by the relay? - Does the computer firewall allow inbound traffic on the relay port, usually
8787?
Codex Relay is licensed under the Apache License 2.0. See LICENSE.
The Codex Relay name, logos, app icons, screenshots, and other brand assets are not licensed under Apache-2.0. See TRADEMARKS.md.




