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.
Model IDs
Section titled “Model IDs”Codex takes OpenAI’s vendor-native model names unchanged, with no provider prefix or routing slug. The following are illustrative:
gpt-5.5gpt-5.4-minigpt-5.3-codex-spark
Invocation
Section titled “Invocation”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:
npm install -g @openai/codex && npm cache clean --forceA session runs codex exec with these flags:
| Flag | Purpose |
|---|---|
--json | Emit the line-delimited JSON event stream consumed for events and usage. |
--skip-git-repo-check | Run outside a git repository without prompting. |
--dangerously-bypass-approvals-and-sandbox | Run unattended, without per-action approval prompts. |
--model <id> | The model to run. |
The prompt is the final positional argument.
Authentication
Section titled “Authentication”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.
Pricing
Section titled “Pricing”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.