Codex CLI is OpenAI's command-line coding agent that brings GPT-powered code generation directly to your terminal. It can read, modify, and run code within your project directory, with support for multimodal input including screenshots and design specifications.
Quick Reference
codex: Start interactive TUI session
codex 'prompt': Single-shot command
--attach: Include screenshots/designs
--web: Enable web search for docs
/model: Switch GPT models
/approvals: Change auth level
/new: Start fresh session
/diff: View Git changes
Included with ChatGPT Plus/Pro/Business
Runs in Docker sandbox for security
Setup Guide
# Getting Started with Codex CLI
## Installation
### Via npm (Recommended)
```bash
npm i -g @openai/codex
```
### Via Homebrew
```bash
brew install codex
```
## Authentication
On first run, you'll be prompted to authenticate:
- ChatGPT account (Plus, Pro, Business, Enterprise)
- Or OpenAI API key
## Quick Start
```bash
codex
```
This launches the interactive TUI session.
## Key Features
### Interactive Mode
Full terminal UI for coding assistance:
- Multi-file operations
- Code review integration
- Test execution
### Single Commands
```bash
codex "Add error handling to all API routes"
```
### Multimodal Input
Attach screenshots or design specs:
```bash
codex --attach design.png "Implement this UI"
```
### Web Search
Enable real-time documentation lookup:
```bash
codex --web "How to use the new React 19 API"
```
## Slash Commands
- `/model`: Switch between GPT models
- `/approvals`: Change authorization level
- `/new`: Fresh session
- `/diff`: View Git differences