Introduction to Codex
What is Codex?
Codex is OpenAI's AI coding agent—not just a code-completion model. In your local workspace it can:
- Read codebases and documentation
- Edit files and run commands
- Verify results (tests, lint, builds)
- Iterate until the task is done or needs your approval
Codex has evolved through two major shifts:
This tutorial centers on Codex CLI (comparable to Claude Code) and covers how App, IDE extensions, and Cloud fit together.
Product matrix: four surfaces, one agent stack
1. Codex CLI (tutorial focus)
- Open source: github.com/openai/codex
- Rust implementation: fast startup, low overhead
- Interactive TUI,
codex execfor non-interactive runs, sandbox and approval policies - Best for: daily development, script automation, CI assistance
2. Codex App
- macOS / Windows desktop app
- Pick a project folder; runs locally in Local mode
- Best for: developers who prefer a GUI and visual diffs
3. IDE extensions
- VS Code, Cursor, Windsurf, and others
- Sidebar agent mode with read/write and run permissions by default (configurable)
- Best for: inline edits while coding
4. Codex Cloud
- Visit chatgpt.com/codex
- Connect GitHub repos; tasks run in cloud environments and produce PRs
@codexin GitHub PR comments delegates work- Best for: async long tasks and cross-timezone collaboration
Core capabilities
Code understanding and generation
- Generate or modify code from natural language
- Cross-file refactors, tests, and documentation
- Image input (screenshots, designs) and image generation/editing (CLI capabilities)
Agent toolchain
Codex works through built-in tools and extension protocols:
- File read/write and patch application
- Shell commands (within sandbox policy)
- Code search (glob, grep, etc.)
- Web search (cached / live modes)
- MCP: connect Linear, GitHub, docs services, and other external systems
Customization stack
OpenAI splits “make the agent work like our team” into five layers that complement each other:
Understanding these five layers is the step from “using Codex” to “using it well.” Later chapters cover each layer.
Good fit vs. caution
Good fit:
- Feature work, bug fixes, and tests in familiar repos
- Bulk refactors, migrations, and doc sync
- Local code review (dedicated review agent)
- Turning repeat flows into Skills or
codex execscripts
Use caution:
- Production secrets or unisolated sensitive environments (always use sandbox + approvals)
- Repos with no tests or lint (“bare” repos where the agent may loop on mistakes)
- Fully unattended auto-merge (prefer PR + human review)
Comparison with other tools (brief)
Choosing: If you already have ChatGPT Plus/Pro and want local agent + Cloud PRs + open AGENTS.md, Codex is a full stack. Deep Anthropic usage favors Claude Code; IDE-only completion favors Copilot.
Billing and accounts
- ChatGPT Plus / Pro / Business / Edu / Enterprise plans typically include Codex usage
- OpenAI API key login is also supported (some features may be limited)
- CLI ChatGPT login can configure the API key automatically
See OpenAI Codex docs for current quotas.
Next steps
- Installation: install the CLI and authenticate
- Quick Start: complete a small verifiable task
- Architecture & Runtime: how the agent plans, executes, and respects the sandbox