OpenAI Codex CLI is a lightweight coding agent that runs locally, providing multimodal inputs, rich approvals workflow, and terminal-based AI-assisted development
npx @tessl/cli install tessl/npm-openai--codex@0.39.0OpenAI Codex CLI is a lightweight coding agent from OpenAI that runs locally on your computer. It provides multimodal inputs (text, screenshots, diagrams), a rich approvals workflow with three distinct modes, and runs entirely in your terminal for quick iteration without switching contexts.
npm install -g @openai/codex or brew install codexcodex# Interactive mode (default)
codex
# Non-interactive execution
codex exec "implement a new feature"
codex e "fix this bug"
# With configuration
codex -m gpt-4
codex -c key=valueThe Codex CLI supports both interactive and non-interactive modes:
# Start interactive session
codex
# Execute a prompt non-interactively
codex exec "Create a Python script that sorts a list of numbers"
# Run with specific model
codex -m gpt-4 exec "Refactor this code for better performance"
# Full automation mode with sandbox
codex exec --full-auto "Fix all linting errors in the project"The Codex CLI is built as a multi-tool with distinct operational modes:
The default interactive mode provides a rich terminal experience with conversation management and real-time AI assistance.
codex [OPTIONS]Execute AI prompts directly from the command line without entering interactive mode.
codex exec [OPTIONS] <PROMPT>
codex e [OPTIONS] <PROMPT>Handle login and logout operations with support for ChatGPT accounts and API keys.
codex login [OPTIONS] [SUBCOMMAND]
codex logout [OPTIONS]Add, remove, and manage MCP servers for extended functionality.
codex mcp [OPTIONS] [SUBCOMMAND]Run Codex as a protocol server for programmatic integration via stdin/stdout JSON-line communication.
codex proto [OPTIONS]
codex p [OPTIONS]Resume previous interactive sessions by ID or continue the most recent session.
codex resume [OPTIONS] [SESSION_ID]Additional tools for shell completion, debugging, and patch application.
codex completion <SHELL>
codex debug <SUBCOMMAND>
codex apply [OPTIONS]All commands support the following global configuration options:
-p, --profile <PROFILE> # Use specific config profile
-c, --config <KEY=VALUE> # Runtime configuration overrides (repeatable)Configuration is stored in ~/.codex/config.toml and can be overridden via command-line flags or environment variables.
0: Success1: General error128 + signal: Process terminated by signal (Unix only)CODEX_HOME: Override default configuration directory (~/.codex)PROJECT_NAME: Specify project contextPROJECT_VERSION: Specify project version