Codex CLI
Codex CLI is OpenAI's open-source command-line coding agent that runs GPT models against your local repo with tool use, sandboxing, and approvals.
Codex CLI is OpenAI's open-source terminal agent for software development. It runs locally, reads your files, proposes and applies edits, executes shell commands, and iterates toward a goal using GPT models. The project lives at github.com/openai/codex and is written in Rust.
Why it matters
Codex CLI is OpenAI's answer to the agentic coding category pioneered by tools like Claude Code and Aider. Because the source is open, you can audit how it prompts models, how it applies diffs, and how it sandboxes commands — which matters for teams with strict code-execution policies.
It's one of the CLIs SpaceSpider ships first-class support for. You can pick codex when creating a space and it gets a full pane in your grid layout. See cli-codex.
How it works
Codex CLI loads your project, builds a system prompt describing its available tools, and starts an interactive session. Each turn it may call tools to read files, run shell commands, apply patches, or search the codebase. Output is streamed back into the context window and the model continues reasoning.
Key features:
- Approval modes (
suggest,auto-edit,full-auto) that gate how autonomously it can act - Sandbox execution — on macOS via Seatbelt, on Linux via Landlock/seccomp
- Model selection across OpenAI's chat and reasoning models
- Config via
~/.codex/config.tomland project-level overrides - MCP server support for plugging in external tools
How it's used
Typical invocations:
codex— interactive agent in the current directorycodex -q "write a failing test for the login regression"— non-interactive- Pair with git worktrees to run multiple agents on different branches
Developers often compare it head-to-head with Claude Code; see /compare/claude-code-vs-codex and /alternatives/codex-cli.
Related terms
- Claude Code — Anthropic's equivalent
- Qwen Code — the open-source Qwen-powered option
- Kimi CLI — Moonshot's agentic CLI
- Sandbox — Codex CLI's execution isolation
- Agentic coding — the broader category
FAQ
Is Codex CLI the same as the old GitHub Copilot Codex model?
No. The 2021 "Codex" was an OpenAI model behind the original Copilot. This Codex CLI (launched 2025) is an open-source agent that uses current GPT models — the name was reused.
Can I use Codex CLI with non-OpenAI models?
It's designed against OpenAI's API, but the open-source codebase makes it possible to point at API-compatible endpoints. See the project README for the current state of provider support.
Related terms
- Agentic codingAgentic coding is software development where an LLM-powered agent plans, edits, runs, and verifies code on its own using tools, not just autocomplete.
- AI pair programmingAI pair programming is a collaboration style where an LLM assistant sits alongside you, suggesting code and reviewing changes in real time as you work.
- ANSI escape codesANSI escape codes are control sequences that terminals interpret for colors, cursor movement, and screen clearing — the language of every modern CLI UI.
- Autonomous agentAn autonomous agent is an AI program that perceives, decides, and acts on its own toward a goal — the architecture behind modern coding CLIs.
- CheckpointA checkpoint is a saved snapshot of file state that lets you roll back an AI coding agent's changes to a known-good point.
- Claude CodeClaude Code is Anthropic's official command-line agent that plans, edits, runs, and verifies code across your repo using Claude models and tool use.