Connect to Codex CLI from the ChatGPT desktop app
What feature would you like to see?
What
Enable the ChatGPT desktop app (Win/macOS) to detect and connect to a locally running Codex CLI instance, exposing it as a selectable model (e.g., "Codex CLI @ my-computer/my-directory"). All functionality from the ChatGPT app (searchable history, nice font/formatting, refined scroll behaviour, dictation, drag-and-drop file attachments) remains available, but responses are powered by the user’s local Codex.
Why
Better developer experience. The TUI is good, but developers miss out on all the nice affordances that have been added to the ChatGPT app over the years.
This might also save the codex-cli team re-inventing a whole bunch of features from the ChatGPT app one by one.
How (some rough ideas)
(I'm aware this involves changes across two repos, but only the codex CLI repo is public so I'm logging this here.)
MVP
- ChatGPT app probes 127.0.0.1 on a particular port listened to by Codex.
- Shows **“Codex CLI @ ... ” in the model selector if found.
- Connect via WebSocket.
- History persistence with Codex-tagged sessions.
- Basic error handling (e.g. when viewing conversation on phone, the model isn't available).
Later phases
- File/image forwarding.
- WSL-aware port forwarding on Windows (if it doesn't just work out of the box)
- Remote connection if local codex is exposed (maybe a terrible idea!)
Some inspiration could be taken from how Chrome Dev Tools allows access to local folders in the Sources tab. Perhaps the ChatGPT App could have something similar where you define in the app UI which folders you want to be able to access with Codex (and ultimately, there's no reason that the app itself couldn't manage the install and launching of Codex).
Open Questions
- Should local Codex chats sync to cloud search?
- Should tool-calls (e.g., Drive search) be proxied by the app or Codex?
- How would it work with projects?
- Would it require a different system prompt?
- Should the ChatGPT UI show multiple codex instances (for multiple directories) if they're running? What if there's two instances for the same directory?
- Should the ChatGPT UI allow viewing/changing sandbox and approval options?
- Should the user have to manually run a Codex instance, or would this involve a background process.
- How to handle codex-only interactions like interrupting (or is that basically the same as hitting the stop button in the app?) or running commands like
!git status - Should this only be in the ChatGPT App, or also chatgpt.com (there's certainly something 'odd' about a website connecting to a local process, but I don't think there's any technical blocker)
- I think there's this view that developers love being in the terminal; and maybe that's true for others, but for me I'd much prefer the well designed interface of the ChatGPT App. So the big question is: would a reasonable portion of developers prefer to interact with Codex through a more feature-rich UI? Maybe an internal OpenAI survey would provide an interesting insight.
Are you interested in implementing this feature?
_No response_
Additional information
_No response_
6 Comments
yes plz
Related #2614
While the Desktop App can connected to local instances in theory, often instances are running on remote servers and would require an outbound connection from codex CLI instead, but both should be supported an the UI should be similar in the ChatGPT Mobile App, web app and desktop app, just how it connects can differ.
You are suggesting to show it in the chat view, while I suggested to instead show in the Codex view. Right now the Codex is not available native in the desktop app, only the web app and mobile app.
One big disadvantage of showing it in the regular chat view is that it would make the chat list incredibly cluttered unless it switched the chat list betwen the codex agent chats and regular chats when switching models.
It might be better to show in the codex view rather than the chat view, otherwise it will just be cluttered, but that requires the codex view to be implemented in the desktop app too. In any case the UI of either the chat view or the codex view would need to be reworked a bit to get a good UX.
Below is a concrete, path to make Codex CLI feel first‑class across Desktop, Web, and Mobile—without cluttering the chat experience or compromising security.
---
TL;DR – Recommended direction
---
1) Critique of the two proposals (and high‑impact fixes)
A. “Show Codex CLI as a selectable model in Chat”
Drawbacks
Fixes
B. “Show Codex in a separate Codex view (Agents list)”
Drawbacks
Fixes
Bottom line: Use a Codex workspace as the primary surface and chat-side attach as the bridge. Avoid polluting the main chat list.
---
2) Architecture options
| Option | How it connects | Where it works | Pros | Cons | Recommendation |
| --------------- | -------------------------------------------------------- | ------------------ | -------------------------------- | ------------------------------------ | -------------- |
| Local Bridge | Desktop app probes
127.0.0.1:PORT(WebSocket) | Desktop only | Zero cloud, low latency | No Web/Mobile reach; WSL/path quirks | MVP || Cloud Relay | CLI keeps outbound TLS WS to a relay; clients fan‑in | Desktop/Web/Mobile | NAT‑proof, remote servers, teams | Requires auth & relay infra | Phase 2 |
| P2P (STUN/TURN) | NAT traversal between client↔CLI | Desktop/Web/Mobile | Potentially lower relay cost | Complex, brittle | Later/Optional |
Handshake (both modes)
codex link→ enter code in app”), short‑lived tokens, mTLS between relay and CLI where applicable.---
3) UX system
A. Agents list (Codex workspace left rail)
(host, projectRoot); allow aliases when two CLIs attach to the same dir.B. Session view (center)
C. Chat-side attach (bridge from normal chat)
D. Mobile/Web parity
---
4) Permissions, safety, and privacy
rm -rf), require inline approval; show exact command and impact.---
5) Handling multi‑instance, WSL, and remote hosts
(agentId, hostName, projectRoot, capabilitiesHash).C:\…↔/mnt/c/...); show active environment (WSL1/2, distro).hostNameand an optional label (e.g.,gpu-rig).---
6) Feature mapping (MVP → Phases)
MVP (Desktop + Local Bridge)
127.0.0.1:PORT(configurable; single port or mDNS).Phase 2 (Cloud Relay + Parity)
codex link), team sharing, push notifications, Web/Mobile use.Phase 3 (DX polish)
---
7) Tool Broker: where calls should execute
---
8) Interrupts, runs, and commands
!git status) or button converts the next instruction to a terminal command preview; user approves and the CLI runs it.---
9) Answers to the Open Questions
Default off. Offer per‑agent opt‑in with redaction. Show a shield icon when a session is local‑only.
Split: host‑sensitive via CLI; cloud/SAAS via client. Use a Tool Broker to route and show provenance.
Agents attach to Project Roots; Sessions inherit project context (env, scopes). Agents can be grouped under Projects in the rail.
Yes—use a Codex‑operator system prompt that emphasizes reproducibility, conservative edits, and tool etiquette. Keep it visible and overridable per agent.
Allowed; show as siblings under the same project with different host labels. Offer a “prefer fastest/closest” default.
Yes—per‑agent Settings: scopes, approvals, environment, redaction, indexing. Quick toggles in the right panel.
MVP: manual (
codex start). Phase 2: optional background helper managed by Desktop (with clear menu bar tray and Quit).!git status)?Supported as command mode with preview + approval. Stop maps to interrupt.
Desktop: Local Bridge + Cloud Relay. Web/Mobile: Cloud Relay only. The UI looks the same; the transport differs.
Expect both camps. Provide workspace UX for rich interactions, terminal‑first workflow for purists, and chat‑side attach for casual use.
---
10) Key UI flows (concrete)
Connect a local agent (MVP):
codex start(defaults to port 8719).~/repo” → Connect.Link a remote agent (Phase 2):
codex link→ device code displayed.Send a chat message to an agent:
---
11) Reliability & diagnostics
---
12) Security checklist
---
13) What to build first (bite‑sized backlog)
Phase 2 adds Cloud Relay, mobile/Web parity, push notifications, team sharing, and file/image forwarding.
---
14) “Where this could go” (optional polish)
In the Codex web you also launch an agent, and it doesn’t clutter the chat list. After all, you’re running the main session, while the internally launched ones are stored within it.
it also need to come with tabs, like how terminal / browser we can keep open fresh chat while not closing it. then well be really great.
ram leak n performance issue still there. just a plain bring app in front cost 54% on m4 cpu.
less gui more hotkey make ux better, eg raycast chat.
that say chatgpt.com seems also can intergrat this.
The local bridge idea seems right, but I would separate two product goals:
The second goal is especially important once phone access enters the picture. A mobile/desktop app can be nicer than a TUI, but if it does not act on the same live local session, users still get stale context, duplicated threads, or unclear approval state.
I built Faryo as a narrower open-source experiment around that second goal: Codex/Claude/shell stay running inside tmux on the owner machine, and phone/desktop browser acts as a lightweight workbench for compact output, short input, approve/interrupt, and handoff. It is not a ChatGPT app integration, but it may be a useful comparison for the "local Codex remains the live source of truth" design: https://github.com/Snailflyer/faryo
Would your desired MVP require ChatGPT's full history/search UI, or would a small same-session workbench be enough if it controls the existing Codex CLI process reliably?