Skip to main content
← Coding

Codex CLI

OpenAI
Coding Terminal Local 8 axes checked Active Checked 2026-10-23

Read the two badges separately: the first is whether this page is backed by evidence, the second is whether the product is still maintained. An archived product can have complete evidence; complete evidence does not mean the product is active.

30-second check: should it make your shortlist?

In one line

OpenAI's official terminal coding agent, written in Rust, architecturally centred on…

How you use it

Local / self-hosted · CLI

Licence / commercial use

Not checked

Read the original licence before commercial use
Mainland China

Direct in mainland · Not in filing list

These four cards help you rule things out, not decide for you. The real differences are in the eight questions and sources below.

Information not confirmed

  • Per-platform implementation details of the three sandbox tiers on macOS / Linux / Windows (the official only says OS-level enforcement + Windows elevated / unelevated, not expanded per platform)
  • Tool-calling quality alignment after switching to third-party providers
  • Concrete concurrency count and duration numbers for cloud tasks (the official only says "follows the plan") > The original six items — "default model / sandbox tiers / tool list / context strategy / approval modes / cloud-task entry points" — > have since been verified against the official developers.openai.com/codex (config-basic, config-advanced, > agent-approvals-security, noninteractive, mcp, cli/reference, cloud); see the axes above.
English summaries and interface labels are available. Detailed source notes below are currently in Chinese.

OpenAI's official terminal coding agent, written in Rust, architecturally centred on the app server and thread resumption.

When to use it, when not to

Engineering work in the terminal, including CI integration or building your own client. Its architecture emphasises resumption and recovery of existing repositories.

China availability domestic / direct access / CAC filing · snapshot 2026-10-23

Origin
foreign-made foreign entity (no matching filing entity in the CAC registry).
Direct access
direct OK Hosted on GitHub — direct reachability from mainland fluctuates (200/000 mixed on the same day); npm / PyPI install routes measured stable.
CAC filing
not in filing list:not in the CAC public registry (13 batch attachments searched 2026-10-20, https://www.cac.gov.cn/2024-04/02/c_1713729983803145.htm); the product does not serve the mainland public, so filing does not apply.

Filing status is quoted from the CAC public registry (updated batch by batch; this site copies the number and does not interpret it). "Direct access" is this site's own reachability measurement from a mainland network, not a vendor promise. GitHub-hosted sites fluctuated on the measurement day — the note says so.

8 questions, one table

8 questions, each comparable item by item with its peers.

Model & openness

Runs OpenAI's own models by default; architecturally it also allows swapping to other providers.

The official config-basic "Default model" example is model = "gpt-5.5". The CLI also has --model / -m to override (the example given is gpt-5.4).

Three companion model switches:

  • model_context_window
  • model_reasoning_effort
  • model_catalog_json (or view the model catalog with codex debug models)

Custom providers are explicitly supported by the official side (config-advanced "Custom model providers").

Configuration: write model + model_provider at the top level, then configure [model_providers.<id>].

Five available fields: base_url / env_key / wire_api / http_headers / auth.command.

Three reserved built-in provider IDs: openai, ollama, lmstudio.

There is also a built-in amazon-bedrock. The official example gives directly:

Official example: [model_providers.mistral] base_url="https://api.mistral.ai/v1"

Local models go through OSS mode: --oss + oss_provider = "ollama" | "lmstudio". To change the built-in OpenAI provider's address, use openai_base_url.

After switching to third-party models, the official gives no quantified conclusion on tool-calling quality.

Where it runs

It is a terminal process running locally.

The code is written in Rust. Release version tags are rust-v*.

Its lifetime is bound to the terminal session: quit and it ends.

Local files

It works inside your working directory, writes only to the workspace by default, and requires that directory to be a Git repository.

The official agent-approvals-security wording is this sentence:

Official wording: "no network access and write permissions limited to the active workspace"

That means: no network access, write permissions limited to the active workspace.

The "workspace" here includes the current directory and /tmp; /status shows the workspace directories.

Sandbox default tiers come in two flavors:

  • version-controlled directories default to workspace-write
  • non-version-controlled directories default to read-only

Under workspace-write, .git / .agents / .codex are recursively read-only.

Tunable items: --add-dir appends writable directories, -C/--cd sets the working directory, project_root_markers customizes project-root detection (.git included by default).

One hard constraint: non-interactive codex exec requires the working directory to be a Git repository. Official wording:

Official wording: "Codex requires commands to run inside a Git repository"

To skip this check, use --skip-git-repo-check.

Tasks after shutdown

The local terminal process ends with the session, but the official additionally has a cloud task form, now verified.

The official Codex cloud page says Codex cloud lets Codex work in its own cloud environment:

Official wording: "work on tasks in the background (including in parallel) using its own cloud environment"

These tasks run in isolated OpenAI-managed containers:

Official wording: "isolated OpenAI-managed containers"

It does not access your host machine and does not touch unrelated data.

The CLI side has two entry points:

  • the codex cloud subcommand (experimental, alias codex cloud-tasks)
  • codex apply — applies a cloud task's diff to the local working tree

Cloud access follows ChatGPT plans (Plus / Pro / Business / Edu / Enterprise).

Cloud-task concurrency and duration quotas: the official gives no concrete numbers, only "follows the plan".

Tools & extensions

Both the built-in tool surface and MCP have been verified.

Built-in capabilities are spread across config feature toggles, six classes in total:

  • shell — executes commands, toggled by features.shell_tool
  • unified_exec — PTY execution
  • web search — web_search = cached | live | disabled
  • undo, git commit
  • multi-agent collaboration — toggled by features.multi_agent, the tool is spawn_agent
  • companion tools also include send_input / resume_agent / wait_agent / close_agent
  • memories

The non-interactive event stream also surfaces these actions: codex exec --json event types include command executions, file changes, MCP tool calls, web searches, plan updates.

Three extension mechanisms: Hooks (PreToolUse / PostToolUse / PreCompact etc.), Skills (SKILL.md, packageable as plugins) and a plugin marketplace.

MCP support is complete officially. The official MCP page says:

"Codex supports MCP servers in both the CLI and the IDE extension"

Transports support STDIO and Streamable HTTP (Bearer / OAuth; log in with codex mcp login).

Configuration works in two places: the codex mcp CLI, or [mcp_servers.<name>].

Tool-level switches include enabled_tools / disabled_tools and per-tool approval_mode.

The reverse also works: codex mcp-server exposes Codex itself as an MCP server to other agents.

Context & memory

Session resumption + automatic compaction + optional memories — all three mechanisms verified.

Resumption: interactively via codex resume, non-interactively via codex exec resume (--last or <SESSION_ID>). codex fork forks a session into a new thread.

The app-server architecture lets threads be started, resumed and recovered.

Compaction: the official config keys are compact_prompt (inline override of the compaction prompt) and experimental_compact_prompt_file; there are also PreCompact / PostCompact hook events.

The context window can be set explicitly via model_context_window (example: 128000).

Memories must be explicitly enabled: after turning on [features] memories = true, Codex distills past sessions into local memory files (default location ~/.codex/memories/).

In the TUI, /memories controls per thread; parameters go through memories.*. The official says memories "redacts secrets".

Note memories are off by default.

Permissions & limits

Sandbox and approval boundaries follow the runtime environment.

API-key billing and subscription are not the same quota (confirmed in the official usage notes).

Approval and sandbox modes are fully verified: the official stance (agent-approvals-security / config-advanced / config-reference) matches the SDK source.

The approval policy is the top-level approval_policy:

  • untrusted / on-request / never / granular
  • on-failure (deprecated)

The reviewer is approvals_reviewer, taking user or auto_review.

The sandbox mode is sandbox_mode, taking read-only / workspace-write / danger-full-access; there are also named profiles :read-only / :workspace / :danger-full-access.

The local default is workspace-write, with networking off.

Non-version-controlled directories default to read-only.

Under workspace-write, .git / .agents / .codex are recursively read-only. Networking additionally has features.network_proxy domain allowlist + DNS-rebinding protection.

The TUI has three more toggles:

  • /permissions — switch to read-only
  • --ask-for-approval never — turn approvals off
  • --dangerously-bypass-approvals-and-sandbox (alias --yolo) — open everything

Windows has its own dedicated tier: [windows] sandbox = "elevated" | "unelevated". The codex sandbox subcommand can provide sandboxing on macOS / Linux / Windows.

But the official does not expand per-platform implementation details by platform (checked config-basic and agent-approvals-security; not listed per platform).

See the Codex SDK dossier.

Best for

Fits engineering tasks in the terminal, scenarios hooking into CI or building custom clients.

It has a piece of evidence few others have: non-interactive mode has official documentation support. docs/exec.md is titled Non-interactive mode (body is an external link).

That makes it, besides Gemini CLI, the only subject in this site's CLI category with non-interactive evidence.

Resumption and recovery on existing repositories are its architectural focus.

Top misconception

  • Treating API credits as part of the subscription — they are billed separately
  • Assuming the CLI is the whole thing — there is also an app server for custom clients
  • Assuming the docs site can be curled directly — a CDN may block it

Evidence sources

Checked 2026-10-23,Content updated 2026-10-08。This is the date of the entry, not a claim that every field was rechecked that day.

TypeNameLink
repoOpenAI · Codex CLI repositoryhttps://github.com/openai/codex
changelogOpenAI · Codex CLI Releases (rust-v0.158.0 @ 2026-09-28)https://github.com/openai/codex/releases
changelogOpenAI · Codex CLI Commitshttps://github.com/openai/codex/commits/main
docsOpenAI · Codex docshttps://developers.openai.com/codex/cli
docsOpenAI · Config basics (default model gpt-5.5, sandbox_mode, Windows sandbox)https://developers.openai.com/codex/config-basic
docsOpenAI · Advanced Configuration (custom providers / OSS / hooks)https://developers.openai.com/codex/config-advanced
docsOpenAI · Configuration Reference (approval_policy and other config keys)https://developers.openai.com/codex/config-reference
docsOpenAI · Agent approvals & security (sandbox / approval defaults / networking)https://developers.openai.com/codex/agent-approvals-security
docsOpenAI · Non-interactive mode (codex exec / Git repository requirement)https://developers.openai.com/codex/noninteractive
docsOpenAI · MCP (STDIO / Streamable HTTP, per-tool approval_mode)https://developers.openai.com/codex/mcp
docsOpenAI · CLI reference (--model / --sandbox / codex cloud / exec)https://developers.openai.com/codex/cli/reference
docsOpenAI · Codex cloud / web (cloud tasks run in OpenAI-managed containers)https://developers.openai.com/codex/cloud
docsOpenAI · Memories (cross-session memory, off by default)https://developers.openai.com/codex/memories
docsOpenAI · Customization (AGENTS.md / Skills / MCP / Subagents)https://developers.openai.com/codex/concepts/customization

Test notes

This site has not completed measured runs. The test protocol is at protocols/coding/_protocol.md.

Change-log note

This subject has standalone releases:

VersionDate
rust-v0.158.02026-09-28

Note the version prefix is rust-v, indicating the repository also contains implementations in other languages; when citing version numbers, write the prefix in full.

Installation methods

The README offers two:

  • npm install
  • Homebrew install (--cask)

Authorization is explicit: the README has its own section "Using Codex with your ChatGPT plan", i.e. authorization rides on the ChatGPT subscription.

Architecture key: the app server

The design focus of Codex is not the CLI itself but the app server behind it.

  • custom clients connect through the app server
  • threads can be started, resumed and recovered
  • the Python SDK is built on app-server JSON-RPC

That means it can be used independently of the terminal — if you are building your own integration, the CLI is just one of its clients.

Verification limits (lifted in 2026-10-08)

At first collection several dimensions of this entry were marked unknown, because the official docs site developers.openai.com then returned 403 to curl (CDN interception), and the repository README is minimal — no "sandbox tiers, tool list, model mapping, approval modes" could be obtained.

2026-10-08 (2026-10-08) filled everything in by fetching the official docs directly through a browser.

Official pages fetched in full the 2026-10-08 check:

  • config-basic / config-advanced / config-reference
  • agent-approvals-security / noninteractive / mcp / cli/reference
  • cloud / memories

Item-by-item conclusions from these pages are in the axes above.

Permission-grading note

Why confidence: partial:

  • ✅ Verified (each item traceable to an official page): repository exists, license (Apache-2.0), latest version, release date, stars (130,498 · rolling re-check 2026-10-23), installation methods, ChatGPT-subscription authorization
  • ✅ Verified (default model and provider configuration surface, sandbox tiers and defaults, approval-policy enumeration, tool list and MCP, context compaction and memories, the cloud-task form)
  • ❌ Not verified (per-platform implementation details of the three sandbox tiers): the official only says OS-level enforcement + the Windows elevated/unelevated tiers, not broken out by platform
  • ❌ Not verified (tool-calling quality after switching providers; concrete concurrency/duration numbers for cloud tasks)

When citing this entry, use only the verified parts.

第一次怎么用

  1. 安装与登录以仓库 README 为准;先跑 codex --help。
  2. 在仓库根目录启动,让它先读项目结构与测试命令。
  3. 需要长任务时用线程续接;中断后从同一线程继续,不要新开会话丢上下文。
  4. 让它把改动拆成小步,每步给 diff 与测试结果。
  5. 推远端与装依赖必须人工确认。
在【仓库】里修【bug】。流程:
1) 先复现并贴失败日志;
2) 给计划(改哪些文件、不改哪些);
3) 每改一个文件就跑相关测试;
4) 最后给风险点与回滚方式。

Related entries

Same-category peers

Look at these three before reading further

Selected by overlap in jobs, not ranked. Compare where it runs, licence and status first; if one of the three fails, skip it.

ObjectWhereLicenceEvidence / statusWhat it is for
AmpCloud / APINot checked8 questions checked
Active
Sourcegraph's Amp: a frontier coding agent spanning CLI + cloud orbs + r
Claude Code CLILocal / self-hostedNot checked8 questions checked
Active
A terminal coding and tool-execution product, with a CHANGELOG and Atom
GitHub Copilot CLILocal / self-hostedNot checked8 questions checked
Active
The Copilot agent in your terminal, carried by your GitHub subscription:

Same vendor

More from OpenAI

One vendor’s products are often split across categories. This list puts them together so you do not have to assemble them across five sites.

This page is generated from the ai-handbook data layer (CC BY 4.0). For the judging criteria and method notes, see METHODOLOGY.md.