API Dashboard ↗

Codex

One agent for everywhere you code

Codex is OpenAI's coding agent for software development. ChatGPT Plus, Pro, Business, Edu, and Enterprise plans include Codex. It can help you:

  • Write code: Describe what you want to build, and Codex generates code that matches your intent, adapting to your existing project structure and conventions.

  • Understand unfamiliar codebases: Codex can read and explain complex or legacy code, helping you grasp how teams organize systems.

  • Review code: Codex analyzes code to identify potential bugs, logic errors, and unhandled edge cases.

  • Debug and fix problems: When something breaks, Codex helps trace failures, diagnose root causes, and suggest targeted fixes.

  • Automate development tasks: Codex can run repetitive workflows such as refactoring, testing, migrations, and setup tasks so you can focus on higher-level engineering work.

Get started with Codex →
Codex CLI showing a project sidebar, thread list, and review pane Codex CLI showing a project sidebar, thread list, and review pane

Quickstart

Every ChatGPT plan includes Codex. You can also use OpenAI API credits with an API key.

CLI (Recommended)

Install with PowerShell:

npm i -g @openai/codex

Or via Homebrew:

brew install codex

Run codex to authenticate and start working.

Cloud

Available at chatgpt.com/codex. Connect a GitHub repository, monitor tasks with logs, review diffs, and create pull requests directly.

Use Cases

Explore practical workflows. Key categories:

Featured examples: Review pull requests, build responsive designs, refactor codebases, create CLI tools, automate bug triage.

Prompting

Communicate with Codex by submitting prompts describing desired tasks.

Writing effective prompts

Codex produces higher-quality outputs when it can verify its work. Include reproduction steps and validation procedures. Break complex tasks into smaller, focused steps — they're easier to test and review.

Threads

A thread represents a single work session. Threads can run locally or in cloud environments. Local threads operate within sandboxes. Codex supports standalone chats using a managed threads directory (default: ~/.codex/threads).

Context

Context includes relevant files, images, and information Codex gathers during work. The system monitors context window limitations and can automatically compact context through summarization.

Models

Configure default models via config.toml or select temporarily using CLI commands.