ChatGPT web has its own composer command menu. Type / to see the actions
available in the current chat. It doesn’t expose the ChatGPT desktop app or CLI
command set; the Codex slash commands, CLI subcommands, and flags in this
reference don’t apply to ChatGPT web.
ChatGPT desktop app commands
The general Commands page covers app navigation, chat shortcuts, keyboard customization, and deep links for chats, settings, skills, scheduled tasks, plugins, and pets.
The Slash commands page covers the commands
available from the app composer, including /feedback, /goal, /init,
/mcp, /plan, /review, and /status.
How to read this reference
This page catalogs every documented Codex CLI command and flag. Use the interactive tables to search by key or description. Each section shows the option’s maturity and flags deprecated options and risky combinations.
The CLI inherits most defaults from ~/.codex/config.toml. Any
-c key=value overrides you pass at the command line take
precedence for that invocation. See Config
basics for more
information.
Global flags
| Key | Type / Values | Details |
|---|---|---|
--add-dir | path | Grant additional directories write access alongside the main workspace. Repeat for multiple paths. |
--ask-for-approval, -a | on-request | never | Control when Codex pauses for human approval before running a command. |
--cd, -C | path | Set the working directory for the agent before it starts processing your request. |
--config, -c | key=value | Override configuration values. Values parse as TOML if possible; otherwise the literal string is used. |
--dangerously-bypass-approvals-and-sandbox, --yolo | boolean | Run every command without approvals or sandboxing. Only use inside an externally hardened environment. |
--dangerously-bypass-hook-trust | boolean | Run enabled hooks without requiring persisted hook trust for this invocation. Intended only for automation that already vets hook sources. |
--disable | feature | Force-disable a feature flag (translates to -c features.<name>=false). Repeatable. |
--enable | feature | Force-enable a feature flag (translates to -c features.<name>=true). Repeatable. |
--image, -i | path[,path...] | Attach one or more image files to the initial prompt. Separate multiple paths with commas or repeat the flag. |
--local-provider | lmstudio | ollama | Choose the local provider used with --oss, overriding oss_provider for this run. |
--model, -m | string | Override the model set in configuration (for example gpt-6-sol). |
--no-alt-screen | boolean | Disable alternate screen mode for the TUI (overrides tui.alternate_screen for this run). |
--oss | boolean | Use a local open source model provider. Codex uses --local-provider, your configured oss_provider, or prompts you to choose between LM Studio and Ollama. |
--profile, -p | string | Layer $CODEX_HOME/profile-name.config.toml on top of the base user config. |
--remote | ws://host:port | wss://host:port | unix:// | unix://PATH | Connect to a remote app-server endpoint over WebSocket or a Unix socket. Supported for codex, codex resume, codex fork, codex archive, codex delete, and codex unarchive; other subcommands reject remote mode. |
--remote-auth-token-env | ENV_VAR | Read a bearer token from this environment variable and send it when connecting with --remote. Requires --remote; tokens are only sent over wss:// URLs or local-only ws:// URLs. |
--sandbox, -s | read-only | workspace-write | danger-full-access | Select the sandbox policy for model-generated shell commands. |
--search | boolean | Enable live web search (sets web_search = "live" instead of the default "cached"). |
--strict-config | boolean | Error when config.toml contains fields this Codex version does not recognize. Supported by runtime commands such as codex, exec, review, resume, fork, app-server, and exec-server. |
PROMPT | string | Optional text instruction to start the session. Omit to launch the TUI without a pre-filled message. |
--add-dirpath--ask-for-approval, -aon-request | never--cd, -Cpath--config, -ckey=value--dangerously-bypass-approvals-and-sandbox, --yoloboolean--dangerously-bypass-hook-trustboolean--disablefeature-c features.<name>=false). Repeatable.--enablefeature-c features.<name>=true). Repeatable.--image, -ipath[,path...]--local-providerlmstudio | ollama--oss, overriding oss_provider for this run.--model, -mstringgpt-6-sol).--no-alt-screenbooleantui.alternate_screen for this run).--ossboolean--local-provider, your configured oss_provider, or prompts you to choose between LM Studio and Ollama.--profile, -pstring$CODEX_HOME/profile-name.config.toml on top of the base user config.--remotews://host:port | wss://host:port | unix:// | unix://PATHcodex, codex resume, codex fork, codex archive, codex delete, and codex unarchive; other subcommands reject remote mode.--remote-auth-token-envENV_VAR--remote. Requires --remote; tokens are only sent over wss:// URLs or local-only ws:// URLs.--sandbox, -sread-only | workspace-write | danger-full-access--searchbooleanweb_search = "live" instead of the default "cached").--strict-configbooleanconfig.toml contains fields this Codex version does not recognize. Supported by runtime commands such as codex, exec, review, resume, fork, app-server, and exec-server.PROMPTstringThese options apply to the base codex command. Most propagate to commands;
see the notes above or the relevant command help for exceptions. For propagated
flags, follow the relevant command help. For example, codex exec --oss ...
applies --oss to exec.
Command overview
The Maturity column uses feature maturity labels such as Experimental, Beta, Stable, and Deprecated. See Feature Maturity for how to interpret these labels.
| Key | Maturity | Details |
|---|---|---|
codex | Stable | Launch the terminal UI. Accepts the global flags above plus an optional prompt or image attachments. |
codex app | Stable | Launch the ChatGPT desktop app on macOS or Windows. On macOS, Codex can open a workspace path; on Windows, Codex prints the path to open. |
codex app-server | Experimental | Launch the Codex app server for local development or debugging over stdio, WebSocket, or a Unix socket. |
codex apply | Stable | Apply the latest diff generated by a Codex cloud chat to your local working tree. Alias: codex a. |
codex archive | Stable | Archive a saved interactive session by session ID or session name. |
codex cloud | Experimental | Browse or execute Codex cloud chats from the terminal without opening the TUI. Alias: codex cloud-tasks. |
codex completion | Stable | Generate shell completion scripts for Bash, Zsh, Fish, or PowerShell. |
codex debug app-server send-message-v2 | Experimental | Debug app-server by sending a single V2 message through the built-in test client. |
codex debug models | Experimental | Print the raw model catalog Codex sees, including an option to inspect only the bundled catalog. |
codex debug prompt-input | Experimental | Render the model-visible prompt input list as JSON, optionally with a prompt and images. |
codex delete | Stable | Permanently delete a saved interactive session by session ID or session name. |
codex doctor | Stable | Generate a diagnostic report for local installation, config, auth, runtime, Git, terminal, app-server, and thread inventory issues. |
codex exec | Stable | Run Codex non-interactively. Alias: codex e. Stream results to stdout or JSONL and optionally resume previous sessions. |
codex execpolicy | Experimental | Evaluate execpolicy rule files and see whether a command would be allowed, prompted, or blocked. |
codex features | Stable | List feature flags and persistently enable or disable them in config.toml. |
codex fork | Stable | Fork a previous interactive session into a new chat, preserving the original transcript. |
codex login | Stable | Authenticate Codex using ChatGPT OAuth, device auth, an API key, or an access token piped over stdin. |
codex logout | Stable | Remove stored authentication credentials. |
codex mcp | Stable | Manage Model Context Protocol servers (list, add, remove, authenticate). |
codex plugin | Stable | Install, list, and remove plugins from configured marketplace sources. |
codex plugin marketplace | Stable | Add, list, upgrade, or remove plugin marketplaces from Git or local sources. |
codex remote-control | Experimental | Run or manage remote control for the local app-server, or create a short-lived pairing code. |
codex resume | Stable | Continue a previous interactive session by ID or resume the most recent chat. |
codex review | Stable | Run a non-interactive review of uncommitted changes, a base branch diff, a commit, or custom review instructions. |
codex sandbox | Stable | Run arbitrary commands inside Codex-provided macOS, Linux, or Windows sandboxes. |
codex unarchive | Stable | Restore an archived interactive session by session ID or session name. |
codex update | Stable | Check for and apply a Codex CLI update when the installed release supports self-update. |
codexcodex appcodex applycodex a.codex cloudcodex cloud-tasks.codex deletecodex doctorcodex execcodex e. Stream results to stdout or JSONL and optionally resume previous sessions.config.toml.codex forkcodex logincodex mcpcodex plugincodex resumecodex reviewcodex updateCommand details
codex (interactive)
Running codex with no subcommand launches the interactive terminal UI (TUI). The agent accepts the global flags above plus image attachments. Web search defaults to cached mode; use --search to switch to live browsing. For low-friction local work, use --sandbox workspace-write --ask-for-approval on-request.
Use --remote ws://host:port or --remote wss://host:port to connect the TUI to an app server started with codex app-server --listen ws://IP:PORT. For a local Unix socket, use --remote unix:// for the default socket or --remote unix://PATH for an explicit path. Add --remote-auth-token-env <ENV_VAR> when the server requires a bearer token for WebSocket authentication.
codex app-server
Launch the Codex app server locally. This is primarily for development and debugging and may change without notice.
| Key | Type / Values | Details |
|---|---|---|
--analytics-default-enabled | boolean | Defaults analytics to enabled for first-party app-server clients unless the user opts out in config. |
--code-mode-host | ws://HOST/PATH | wss://HOST/PATH | Connect to a remote Code Mode host instead of starting a local host. This outbound connection is shared across threads and is separate from --listen; use wss:// for remote hosts. |
--listen | stdio:// | ws://IP:PORT | unix:// | unix://PATH | off | Transport listener URL. Use stdio:// for JSONL, ws://IP:PORT for a TCP WebSocket endpoint, unix:// for the default Unix socket, unix://PATH for a custom Unix socket, or off to disable the local transport. |
--stdio | boolean | Use stdio transport. Equivalent to --listen stdio:// and mutually exclusive with --listen. |
--ws-audience | string | Expected aud claim for signed bearer tokens. Requires --ws-auth signed-bearer-token. |
--ws-auth | capability-token | signed-bearer-token | Authentication mode for app-server WebSocket clients. If omitted, WebSocket auth is disabled; non-local listeners warn during startup. |
--ws-issuer | string | Expected iss claim for signed bearer tokens. Requires --ws-auth signed-bearer-token. |
--ws-max-clock-skew-seconds | number | Clock skew allowance when validating signed bearer token exp and nbf claims. Requires --ws-auth signed-bearer-token. |
--ws-shared-secret-file | absolute path | File containing the HMAC shared secret used to validate signed JWT bearer tokens. Required with --ws-auth signed-bearer-token. |
--ws-token-file | absolute path | File containing the shared capability token. Use with --ws-auth capability-token unless you provide --ws-token-sha256 instead. |
--ws-token-sha256 | hexadecimal SHA-256 digest | Expected SHA-256 digest for capability-token authentication. Use instead of --ws-token-file when the client token comes from another source. |
--analytics-default-enabledboolean--code-mode-hostws://HOST/PATH | wss://HOST/PATH--listen; use wss:// for remote hosts.--listenstdio:// | ws://IP:PORT | unix:// | unix://PATH | offstdio:// for JSONL, ws://IP:PORT for a TCP WebSocket endpoint, unix:// for the default Unix socket, unix://PATH for a custom Unix socket, or off to disable the local transport.--stdioboolean--listen stdio:// and mutually exclusive with --listen.--ws-audiencestringaud claim for signed bearer tokens. Requires --ws-auth signed-bearer-token.--ws-authcapability-token | signed-bearer-token--ws-issuerstringiss claim for signed bearer tokens. Requires --ws-auth signed-bearer-token.--ws-max-clock-skew-secondsnumberexp and nbf claims. Requires --ws-auth signed-bearer-token.--ws-shared-secret-fileabsolute path--ws-auth signed-bearer-token.--ws-token-fileabsolute path--ws-auth capability-token unless you provide --ws-token-sha256 instead.--ws-token-sha256hexadecimal SHA-256 digest--ws-token-file when the client token comes from another source.codex app-server --listen stdio:// keeps the default JSONL-over-stdio behavior, and codex app-server --stdio is an alias for that transport. --listen ws://IP:PORT enables WebSocket transport for app-server clients. The server accepts ws:// listen URLs; use TLS termination or a secure proxy when clients connect with wss://. Use --listen unix:// to accept WebSocket handshakes on Codex’s default Unix socket, or --listen unix:///absolute/path.sock to choose a socket path. If you generate schemas for client bindings, add --experimental to include gated fields and methods.
Add --code-mode-host wss://code-mode.example.com/host to connect app-server to
a remote Code Mode host instead of starting a local host. This outbound
connection is separate from --listen and shared by every thread in the
app-server process. Use ws:// only for a localhost or SSH-forwarded host.
codex remote-control
Run codex remote-control to start remote control in the foreground. Use
codex remote-control start to start the local app-server daemon with remote
control enabled, and codex remote-control stop to stop it. Managed
remote-control clients and SSH remote workflows use these commands; they aren’t
a replacement for codex app-server --listen when you’re building a local
protocol client.
After the daemon is running, use codex remote-control pair to create and
print a short-lived manual pairing code. Add --json to any remote-control
command for machine-readable output. For pair, the JSON response includes
pairingCode, manualPairingCode, environmentId, and expiresAt.
codex app
Launch the ChatGPT desktop app from the terminal on macOS or Windows. On macOS, Codex can open a specific workspace path; on Windows, Codex prints the path to open.