# OpenAI Codex CLI — Terminal Coding Agent by OpenAI > Official OpenAI terminal coding agent. Reads your codebase, writes code, runs commands, and manages files from the command line. Multi-model support with sandbox execution. 20,000+ stars. ## Install Save as a script file and run: ## Quick Use ```bash npm install -g @openai/codex ``` ```bash # Start interactive session codex # Run with a task codex "Add input validation to the signup endpoint" # Full auto mode (no confirmations) codex --auto "Write tests for the auth module" ``` --- ## Intro OpenAI Codex CLI is the official terminal-based coding agent from OpenAI with 20,000+ GitHub stars. It reads your codebase, writes code, executes commands, and manages files directly from the command line — similar to Claude Code but powered by OpenAI models. Features include sandbox execution, multi-model support (o4-mini, o3, GPT-4o), and configurable approval modes from fully manual to fully autonomous. Best for developers who want an OpenAI-powered alternative to Claude Code. Works with: OpenAI models (o4-mini, o3, GPT-4o). Setup time: under 2 minutes. --- ## Core Features ### Three Approval Modes | Mode | Behavior | |------|----------| | `suggest` | Shows suggestions, you approve each one | | `auto-edit` | Auto-applies file edits, asks for commands | | `auto` | Full autonomy — edits and runs commands | ```bash codex --mode auto "Refactor the database layer to use connection pooling" ``` ### Sandbox Execution Commands run in a sandboxed environment by default: - Network access disabled - File system restricted to project directory - Configurable permissions ### Multi-Model Support ```bash # Use different models codex --model o4-mini "Quick fix for the typo in README" codex --model o3 "Design and implement a caching layer" codex --model gpt-4o "Explain the authentication flow" ``` ### Context-Aware Codex reads your project structure, git history, and relevant files to understand context before making changes. ### Typical Workflow ```bash # Navigate to your project cd my-app # Ask Codex to help codex "The login endpoint returns 500 when the email has uppercase letters" # Codex: # 1. Reads relevant files (auth/login.ts, models/user.ts) # 2. Identifies the case-sensitivity bug # 3. Proposes a fix # 4. Shows diff for approval # 5. Applies the change # 6. Runs tests to verify ``` ### Configuration ```yaml # ~/.codex/config.yaml model: o4-mini mode: auto-edit approval: file_edits: auto commands: manual context: max_files: 50 include_git_diff: true ``` ### Key Stats - 20,000+ GitHub stars - Official OpenAI product - 3 approval modes - Sandboxed execution - Multi-model support (o4-mini, o3, GPT-4o) ### FAQ **Q: What is OpenAI Codex CLI?** A: The official OpenAI terminal coding agent that reads your codebase, writes code, runs commands, and manages files from the command line. **Q: Is Codex CLI free?** A: The CLI is open-source. You need an OpenAI API key with usage-based billing. **Q: How does Codex CLI compare to Claude Code?** A: Both are terminal coding agents. Codex uses OpenAI models (o4-mini, o3), Claude Code uses Claude models. Core functionality is similar — code editing, command execution, and project context awareness. --- ## Source & Thanks > Created by [OpenAI](https://github.com/openai). Licensed under Apache 2.0. > > [codex](https://github.com/openai/codex) — ⭐ 20,000+ Thanks to OpenAI for making terminal-based AI coding mainstream. --- ## 快速使用 ```bash npm install -g @openai/codex codex "给注册端点添加输入验证" ``` --- ## 简介 OpenAI Codex CLI 是 OpenAI 官方终端编码 Agent,GitHub 20,000+ stars。读取代码库、编写代码、执行命令、管理文件。支持沙盒执行和多模型(o4-mini、o3、GPT-4o)。适合需要 OpenAI 驱动的终端编码 Agent 的开发者。 --- ## 来源与感谢 > Created by [OpenAI](https://github.com/openai). Licensed under Apache 2.0. > > [codex](https://github.com/openai/codex) — ⭐ 20,000+ --- Source: https://tokrepo.com/en/workflows/11647c80-61e5-40ba-951e-69f433cabc1c Author: Script Depot