Codex CLI
Maintained by OpenAI
OpenAI's open source coding agent that runs locally in the terminal to inspect, edit and run code.
Note
Practise with Codex CLI in a hosted lab
Overview
Codex CLI is an open source, Apache 2.0 licensed coding agent from OpenAI that runs locally on your computer. From the terminal it inspects code, makes changes across files, runs commands and automates repeatable work. Permission settings decide when Codex may edit files or run commands without asking, and it runs commands inside a sandbox whose writable locations you can inspect. It can run a dedicated review of uncommitted changes, a commit or a base branch, connect to local or remote MCP servers, switch a run to live web search, and accept images such as error screenshots or diagrams with a prompt. The codex exec command runs it non-interactively in scripts and pipelines. Codex CLI is one part of OpenAI's Codex product family, which also includes IDE extensions, a desktop app and the cloud-based Codex agent; this entry covers the command-line tool.
What it does
- Inspects code, makes changes across files and runs commands from natural-language requests.
- Controls when it may edit files or run commands without asking, with commands run in a sandbox.
- Runs a dedicated code review against uncommitted changes, a commit or a base branch.
- Connects to local or remote MCP servers and can use live web search for a run.
- Accepts images such as error screenshots, diagrams or design references with a prompt.
- Runs non-interactively with codex exec in scripts and CI pipelines.
Suitable use cases
- Implementing and testing small changes in a local repository from the terminal
- Reviewing uncommitted work or a branch before opening a pull request
- Scripting repeatable code tasks in CI with non-interactive runs
- Debugging from an error screenshot or log output
Prerequisites
- A ChatGPT Plus, Pro, Business, Edu or Enterprise plan, or an OpenAI API key
- macOS, Linux or Windows, installed with the install script, npm or Homebrew, or from a release binary
- Working knowledge of a terminal and of git
Limitations
- Some ChatGPT workspace and cloud features are limited or unavailable when signed in with an API key.
- Code, prompts and command output are sent to OpenAI, or to a custom model provider if you configure one.
- It edits files and runs commands on your behalf, so its changes need human review.
- Broadening its permissions reduces the confirmations that would otherwise catch unwanted commands.
- In a Code Crushers lab its command sandbox is switched off, because it cannot start there; commands it runs are confined only by the lab.
Authentication
You sign in inside the tool. Code Crushers never sees these credentials.
- Sign in with an account or plan at a model provider
- Use a model-provider API key
- Works with a local or self-hosted model
On first run, choose Sign in with ChatGPT to use Codex as part of a ChatGPT Plus, Pro, Business, Edu or Enterprise plan, or sign in with an OpenAI API key for usage-based access. Codex can also be configured with a custom model provider, including a local model that needs no credentials. Code Crushers never collects or stores these credentials.
Model usage
Charged separately from Code Crushers credits
Model usage is billed by OpenAI: with ChatGPT sign-in it counts against your ChatGPT plan, and with an API key it is billed to your OpenAI Platform account at standard API rates. A custom provider bills under its own terms, and a local model has no provider charge. Code Crushers credits pay only for lab infrastructure and never pay for model usage.
