Skip to content

Overview

OpenAI Codex (slug codex) is OpenAI’s coding agent CLI, driven non-interactively through its codex exec subcommand. It authenticates against OpenAI directly and runs the model OpenAI serves natively, so a Codex run reports the vendor’s own model IDs and usage figures. See the OpenAI Codex site.

Codex takes OpenAI’s vendor-native model names unchanged, with no provider prefix or routing slug. The following are illustrative:

  • gpt-5.5
  • gpt-5.4-mini
  • gpt-5.3-codex-spark

The harness probes and invokes the codex binary. The CLI is installed into the run container immediately before the session, so each run picks up the most recently published version:

Terminal window
npm install -g @openai/codex && npm cache clean --force

A session runs codex exec with these flags:

FlagPurpose
--jsonEmit the line-delimited JSON event stream consumed for events and usage.
--skip-git-repo-checkRun outside a git repository without prompting.
--dangerously-bypass-approvals-and-sandboxRun unattended, without per-action approval prompts.
--model <id>The model to run.

The prompt is the final positional argument.

Codex authenticates with an OpenAI API key or a ChatGPT account subscription, preferring the subscription when its credentials are present. In the API-key mode the key is read from OPENAI_API_KEY on the host and injected into the run container as CODEX_API_KEY, which is the variable codex exec reads. See Authentication.

Codex reports no cost figure of its own, so the comparable cost is computed from the model’s curated list price. Codex’s bare OpenAI model IDs resolve to the catalog entry that lists them as a Codex alias. See Metrics.