Skip to main content

Syntax

Description

The codex command launches the interactive Codex TUI (Terminal User Interface). If you provide a prompt as an argument, Codex starts with that prompt pre-filled. Without arguments, you’ll see an empty prompt where you can type your request.

Usage

Interactive Mode

Start Codex with an empty prompt:

With Initial Prompt

Start Codex with a specific task:

With Images

Attach images to your prompt:

Options

string
Initial prompt to send to Codex. If not provided, starts with empty prompt.

Model & Provider

string
AI model to use (e.g., gpt-4.1, o4-mini). Defaults to configured model.
boolean
Use open-source/local model provider instead of OpenAI.
string
Specify OSS provider: ollama, lmstudio. Only valid with --oss.

Approval & Sandbox

boolean
Run in full-auto mode with workspace-write sandbox. No approvals required for file writes or shell commands.
string
Sandbox mode: workspace-write, workspace-read-network-write, read-only, danger-full-access.
string
Approval policy: never, on-request, for-risky-ops.
boolean
Skip all approval checks and sandbox restrictions. Use with extreme caution.

Input

string
Comma-separated list of image paths to attach. Supports PNG, JPEG, GIF, WebP.
path
Additional directories to make writable in sandbox (repeatable).
Enable web search for this session.

Session Management

path
Working directory for this session.
boolean
Don’t save this session to history.
boolean
Skip the check for being inside a Git repository.

Configuration

string
Use a specific config profile.
string
Override config.toml setting (repeatable). Format: key=value or section.key=value.Examples:
  • -c model=gpt-4.1
  • -c permissions.approval_policy=never
string
Enable a feature flag (repeatable). Equivalent to -c features.<name>=true.
string
Disable a feature flag (repeatable). Equivalent to -c features.<name>=false.

Examples

Basic Usage

Full Auto Mode

With Images

Local/OSS Models

Configuration Overrides

Special Directories

Terminal Requirements

Codex’s interactive TUI requires a terminal that supports:
  • ANSI escape codes
  • UTF-8 encoding
  • Terminal dimensions (rows/columns)
If TERM=dumb, Codex will warn you and ask for confirmation before starting.