1# Codex CLI1# CLI – Codex
2 2
3Codex CLI is OpenAI's coding agent that you can run locally from your terminal. It can read, change, and run code on your machine in the selected directory.3Codex CLI is OpenAI’s coding agent that you can run locally from your terminal. It can read, change, and run code on your machine in the selected directory.
4It's [open source](https://github.com/openai/codex) and built in Rust for speed and efficiency.4It’s [open source](https://github.com/openai/codex) and built in Rust for speed and efficiency.
5 5
6ChatGPT Plus, Pro, Business, Edu, and Enterprise plans include Codex. Learn more about [what's included](https://developers.openai.com/codex/pricing).6ChatGPT Plus, Pro, Business, Edu, and Enterprise plans include Codex. Learn more about [what’s included](https://developers.openai.com/codex/pricing).
7
8<YouTubeEmbed
9 title="Codex CLI overview"
10 videoId="iqNzfK4_meQ"
11 class="max-w-md"
12/>
13<br />
14 7
15## CLI setup8## CLI setup
16 9
17<CliSetupSteps client:load />10Choose your package manager
18
19The Codex CLI is available on macOS, Windows, and Linux. On Windows, run Codex
20 natively in PowerShell with the Windows sandbox, or use WSL2 when you need a
21 Linux-native environment. For setup details, see the{" "}
22 <a href="/codex/windows">Windows setup guide</a>.
23
24If you're new to Codex, read the [best practices guide](https://developers.openai.com/codex/learn/best-practices).
25
26
27## Work with the Codex CLI
28
29<BentoContainer>
30 <BentoContent href="/codex/cli/features#running-in-interactive-mode">
31 11
32### Run Codex interactively12npmHomebrew
33 13
34Run `codex` to start an interactive terminal UI (TUI) session.141. 1
35 15
36 </BentoContent>16 ### Install
37 <BentoContent href="/codex/cli/features#models-reasoning">
38 17
39### Control model and reasoning18 Install the Codex CLI with npm.
40 19
41Use `/model` to switch between GPT-5.4, GPT-5.3-Codex, and other available models, or adjust reasoning levels.20 npm install command
42 21
43 </BentoContent>22 npm i -g @openai/codexCopy
44 <BentoContent href="/codex/cli/features#image-inputs">232. 2
45 24
46### Image inputs25 ### Run
47 26
48Attach screenshots or design specs so Codex reads them alongside your prompt.27 Run Codex in a terminal. It can inspect your repository, edit files, and run commands.
49 28
50 </BentoContent>29 Run Codex command
51 <BentoContent href="/codex/cli/features#image-generation">
52 30
53### Image generation31 codexCopy
54 32
55Generate or edit images directly in the CLI, and attach references when you want Codex to iterate on an existing asset.33 The first time you run Codex, you'll be prompted to sign in. Authenticate with your ChatGPT account or an API key.
56 34
57 </BentoContent>35 See the [pricing page](https://developers.openai.com/codex/pricing) if you're not sure which plans include Codex access.
363. 3
58 37
59 <BentoContent href="/codex/cli/features#running-local-code-review">38 ### Upgrade
60 39
61### Run local code review40 New versions of the Codex CLI are released regularly. See the [changelog](https://developers.openai.com/codex/changelog) for release notes. To upgrade with npm, run:
62 41
63Get your code reviewed by a separate Codex agent before you commit or push your changes.42 npm upgrade command
64 43
65 </BentoContent>44 npm i -g @openai/codex@latestCopy
66 45
67 <BentoContent href="/codex/subagents">46The Codex CLI is available on macOS, Windows, and Linux. On Windows, run Codex
68 47natively in PowerShell with the Windows sandbox, or use WSL2 when you need a
69### Use subagents48Linux-native environment. For setup details, see the
70 49[Windows setup guide](https://developers.openai.com/codex/windows).
71Use subagents to parallelize complex tasks.
72
73 </BentoContent>
74
75 <BentoContent href="/codex/cli/features#web-search">
76
77### Web search
78
79Use Codex to search the web and get up-to-date information for your task.
80 50
81 </BentoContent>51If you’re new to Codex, read the [best practices guide](https://developers.openai.com/codex/learn/best-practices).
82 52
83 <BentoContent href="/codex/cli/features#working-with-codex-cloud">53---
84 54
85### Codex Cloud tasks55## Work with the Codex CLI
86 56
87Launch a Codex Cloud task, choose environments, and apply the resulting diffs without leaving your terminal.57[### Run Codex interactively
88 58
89 </BentoContent>59Run `codex` to start an interactive terminal UI (TUI) session.](https://developers.openai.com/codex/cli/features#running-in-interactive-mode)[### Control model and reasoning
90 60
91 <BentoContent href="/codex/noninteractive">61Use `/model` to switch between GPT-5.4, GPT-5.3-Codex, and other available models, or adjust reasoning levels.](https://developers.openai.com/codex/cli/features#models-reasoning)[### Image inputs
92 62
93### Scripting Codex63Attach screenshots or design specs so Codex reads them alongside your prompt.](https://developers.openai.com/codex/cli/features#image-inputs)[### Image generation
94 64
95Automate repeatable workflows by scripting Codex with the `exec` command.65Generate or edit images directly in the CLI, and attach references when you want Codex to iterate on an existing asset.](https://developers.openai.com/codex/cli/features#image-generation)[### Run local code review
96 66
97 </BentoContent>67Get your code reviewed by a separate Codex agent before you commit or push your changes.](https://developers.openai.com/codex/cli/features#running-local-code-review)[### Use subagents
98 <BentoContent href="/codex/mcp">
99 68
100### Model Context Protocol69Use subagents to parallelize complex tasks.](https://developers.openai.com/codex/subagents)[### Web search
101 70
102Give Codex access to additional third-party tools and context with Model Context Protocol (MCP).71Use Codex to search the web and get up-to-date information for your task.](https://developers.openai.com/codex/cli/features#web-search)[### Codex Cloud tasks
103 72
104 </BentoContent>73Launch a Codex Cloud task, choose environments, and apply the resulting diffs without leaving your terminal.](https://developers.openai.com/codex/cli/features#working-with-codex-cloud)[### Scripting Codex
105 74
106 <BentoContent href="/codex/cli/features#approval-modes">75Automate repeatable workflows by scripting Codex with the `exec` command.](https://developers.openai.com/codex/noninteractive)[### Model Context Protocol
107 76
108### Approval modes77Give Codex access to additional third-party tools and context with Model Context Protocol (MCP).](https://developers.openai.com/codex/mcp)[### Approval modes
109 78
110Choose the approval mode that matches your comfort level before Codex edits or runs commands.79Choose the approval mode that matches your comfort level before Codex edits or runs commands.](https://developers.openai.com/codex/cli/features#approval-modes)
111 80
112 </BentoContent>
113</BentoContainer>