Open Source · MIT License

Codex CLI
Pair with AI in your terminal

Codex 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. Built in Rust for speed and efficiency.

$ npm i -g @openai/codex
+ @openai/codex@latest
$ codex

Work with Codex CLI

Run Interactively

Run codex to start an interactive terminal UI (TUI) session. Edit, run, and iterate on your code in real time with natural language instructions.

Model & Reasoning Control

Use /model to switch between GPT-5.4, GPT-5.3-Codex, and other models. Adjust reasoning levels to match task complexity.

Image Inputs

Attach screenshots or design specs so Codex reads them alongside your prompt. Perfect for translating mockups into working code.

Local Code Review

Get your code reviewed by a separate Codex agent before you commit or push changes. Catch issues early with automated review.

Subagents

Use subagents to parallelize complex tasks. Offload subtasks to specialized agents and collect results asynchronously.

Web Search

Use Codex to search the web and get up-to-date information for your task. Codex retrieves live results and integrates them into your workflow.

Codex Cloud Tasks

Launch a Codex Cloud task, choose environments, and apply the resulting diffs without leaving your terminal.

Scripting & Automation

Automate repeatable workflows by scripting Codex with the exec command. Integrate Codex into your CI/CD pipelines.

Model Context Protocol

Give Codex access to third-party tools and context with Model Context Protocol (MCP). Extend Codex with custom integrations.

Approval Modes

Choose the approval mode that matches your comfort level before Codex edits or runs commands. Full control over every action.

Get started in seconds

Available on macOS, Windows, and Linux. Choose your package manager below.

1

Install

Install the Codex CLI with npm.

npm i -g @openai/codex
2

Run

Run codex in your terminal. It can inspect your repository, edit files, and run commands.

codex

The first time you run Codex, you'll be prompted to sign in. Authenticate with your ChatGPT account or an API key.

3

Upgrade

New versions of the Codex CLI are released regularly. To upgrade:

npm i -g @openai/codex@latest

Ready to ship faster?

Codex CLI is available for ChatGPT Plus, Pro, Business, Edu, and Enterprise plans.

Get Started