Codex
OpenAI's open-source coding agent for the terminal, which inspects code, makes changes and runs commands with OpenAI's models. Run it in EnvHaven from any browser, signed in once with your own account, and keep it working 24/7; or install it on your own machine.
Updated November 23, 2026 · Checked against Codex 0.157.1 in EnvHaven v1.9.0
| At a glance | |
|---|---|
| Made by | OpenAI |
| Command | codex |
| Version checked | 0.157.1, in EnvHaven v1.9.0 |
| License | Apache-2.0, source |
| Documentation | learn.chatgpt.com/docs/codex/cli |
Use Codex in EnvHaven
- Open your workspace in any browser, on a laptop, a tablet or a phone.
- Tap Launch, choose Codex and tap Sign in: it runs
codex login --device-auth, which shows a one-time code to approve in ChatGPT (turn on device code sign-in in ChatGPT’s security settings first). - Start it with one tap: signed in, Codex gets a green dot in the Launch menu and an icon in the workspace’s top bar. Support is built in (0.157.1), so there is nothing to install or update.
- Give it a task. The image writes both settings into
~/.codex/config.toml, socodexstarts without approvals. - Close the tab whenever you like. The workspace is an always-on Linux machine, so Codex keeps working, and every device you open it from shows the same session.
Every agent signs in with your own account: EnvHaven never resells tokens or adds a markup.
Install Codex on another machine
macOS, Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
npm:
npm install -g @openai/codex
Homebrew:
brew install --cask codex
Sign in from the terminal
In a workspace the Launch menu does this for you. On any other machine, or when you would rather type it:
- Run
codex loginand sign in with ChatGPT. On a machine without a browser,codex login --device-authprints a code to approve on any device (turn on device code login in ChatGPT’s security settings first). - Or use an API key:
printenv OPENAI_API_KEY | codex login --with-api-key, orCODEX_API_KEYfor non-interactive runs. Codex does not readOPENAI_API_KEYby itself. - ChatGPT Plus and Pro include Codex in the CLI, as do Business and Enterprise workspaces; API-key sessions bill at API rates.
Run Codex without permission prompts
For one session:
codex --dangerously-bypass-approvals-and-sandbox
As the default, in ~/.codex/config.toml:
approval_policy = "never"
sandbox_mode = "danger-full-access"
The flag turns off approvals and the sandbox together; its help calls it “EXTREMELY DANGEROUS” and meant for environments that are already sandboxed, and OpenAI’s docs recommend full access inside Docker for that reason. Quote the values in config.toml: an unquoted never fails with “Error loading config.toml”. Administrators can forbid both values through requirements.toml.
In EnvHaven: The image writes both settings into ~/.codex/config.toml, so codex starts without approvals. The details, and when full access is safe, are on the Codex full-access page.
Instructions file
Codex reads AGENTS.md, AGENTS.override.md, ~/.codex/AGENTS.md. It reads them from the project root down to the working directory, capped at 32 KiB by default; project_doc_fallback_filenames in config.toml adds other names.
Add MCP servers
codex mcp add <name> -- <command> [args...]
Use --env KEY=VALUE for stdio servers and --url <url> for streamable HTTP. Servers are saved as [mcp_servers.<name>] tables in ~/.codex/config.toml.
The MCP config converter writes the same server for every agent at once.
Run it from scripts
codex exec "<prompt>"
Headless runs cannot stop to ask, so they need the full-access setting above.
Codex away from your desk
Codex keeps working only while the machine it runs on is awake. In EnvHaven that machine is the workspace, which never sleeps: start a task, close the laptop and check on it from a phone.
- Codex in the browser
- Codex on iPhone
- Codex on iPad
- Codex on Android
- Codex on a Chromebook
- Codex on Windows
- Codex on a VPS
- Codex in Docker
- Codex on a Raspberry Pi
- Codex 24/7
OpenAI’s own options:
- The ChatGPT mobile app starts, steers and approves Codex tasks in the cloud or on a computer running the ChatGPT desktop app; it is set up from the desktop app.
codex cloudstarts and lists cloud tasks from the terminal.
Compare Codex
When Codex misbehaves
- Codex: 401 Unauthorized, Missing bearer or basic authentication in header
- Codex: 401 Unauthorized, Incorrect API key provided
- Codex: Error loading config.toml
- Codex: stream disconnected before completion
- Codex: You’ve hit your usage limit.
- Codex: error: unexpected argument ‘--full-auto’ found
- Codex: Not inside a trusted directory and --skip-git-repo-check was not specified.
- Codex: bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted
- Codex: In-app browser plugin unavailable
- Codex: handshaking with MCP server failed: connection closed: initialize response
- Is Codex down? Live status of the providers it depends on.