Overview
Codex CLI is an open-source terminal AI coding agent launched by OpenAI, autonomously executing programming tasks in the command line—reading code, writing and modifying, running tests, and automatically fixing bugs. It is based on OpenAI's GPT/o series models but also supports switching to third-party models such as DeepSeek, Gemini, and Ollama.
Codex CLI adopts a sandboxed execution environment where code modifications run in a secure, isolated environment. It supports multiple security modes (suggest/auto-edit/full-auto), allowing users to finely control the level of AI autonomy.
Key Features
- Autonomous Coding Agent: Given a task description, it autonomously plans steps, reads and writes code, runs tests, and completes the task
- Sandbox Secure Execution: Code runs in a sandbox environment, preventing AI operations from accidentally affecting the local environment
- Multi-Model Support: Default uses OpenAI models, supports switching to third-party models such as DeepSeek, Gemini, and Ollama
- Session Resumption: Supports checkpoint resume, allowing restoration of previous task context after interruption
- Multiple Security Modes: Provides three permission levels: suggest (suggestions only), auto-edit (automatic editing), and full-auto (fully automatic)
- MCP Integration: Supports Model Context Protocol, enabling connection to external tools and data sources
Use Cases
- Advanced developers requiring fully automated programming
- Development scenarios needing AI to autonomously run tests and fix bugs
- DevOps and backend engineers who prefer terminal workflows
- Developers looking to reduce costs with third-party models (e.g., DeepSeek)
- Enterprise teams needing safe and controllable AI programming automation
Pros
- Fully open source: code auditable, active community
- Sandbox security: AI operations in an isolated environment, safe and controllable
- Multi-model flexibility: not tied to OpenAI, can use cheaper models
- Strong autonomy: full-auto mode truly delivers 'give task, wait for results'
- Official OpenAI product: continuous iteration, good ecosystem support
Pricing
Codex CLI itself is open source and free, but you need to bring your own LLM API Key. Using OpenAI models is billed per API call (GPT-5 mini approx $0.15/M input, GPT-5.4 approx $2.5/M input, GPT-5.5 approx $5/M input). You can also switch to low-cost models like DeepSeek V4-Pro / Qwen3 to significantly reduce costs.
Summary
Codex CLI is a major open-source product from OpenAI in the terminal AI coding space, with sandbox security and multi-model support as its core advantages. It is suitable for advanced developers seeking automation and safety control. However, it requires a self-provided API Key and costs are borne by the user, making the entry barrier higher than Gemini CLI.
Version History
- Codex CLI + GPT-5.5 Sandbox (2026): OpenAI officially promotes GPT-5.5 series, sandbox execution (Linux seccomp / macOS sandbox-exec) mature, interoperable with ChatGPT Workspace Agents
- Codex CLI Early (2024-2025): OpenAI's open-source command-line AI coding tool, focusing on 'using Codex in the terminal'