匠人学院 JR Academy
Skip to article
Learning guide
OpenAI Codex Guide

OpenAI Codex coding agent: install the CLI, IDE extension and Codex Cloud, plan limits, AGENTS.md, and how it compares with Claude Code and Cursor (checked 2026-11-09).

1 chapters·1 guides·Access varies by chapter
Getting Started and Comparison
On this page

OpenAI Codex Guide: CLI, IDE Extension and Codex Cloud

Last checked: 2026-11-09 · Sources: Codex CLI docs↗, Codex pricing and limits↗, IDE extension↗, Codex Cloud↗, GitHub openai/codex↗

#Quick answer: what is Codex, how do I install it and what does it cost?

Codex is OpenAI's coding agent. It reads your repository, edits files, runs commands and hands you a diff to review. One account works in four places: the Codex CLI in your terminal, the IDE extension in VS Code-based editors, Codex Cloud inside ChatGPT, and the ChatGPT desktop app. The CLI is written in Rust and open source under Apache-2.0.

As of 2026-11-09:

  • Install: npm install -g @openai/codex or brew install --cask codex; the current version is 0.167.0. There is also an official install script.
  • Full CLI, IDE and cloud use starts with ChatGPT Plus: $20/month, with GPT-6.1 Sol and GPT-6 Luna.
  • Free ($0) and Go ($8/month): GPT-6 Luna at standard speed in the desktop app only, subject to rollout.
  • Pro: $100, $200 or $500 per month; OpenAI says Pro currently has no five-hour limit.
  • Business: $20 per user per month billed annually (2+ users), $25 billed monthly; Enterprise and Edu by quote.
  • API key: billed at API prices, for example gpt-6.1-sol at $2 input / $10 output per million tokens.

#Which ways can I use Codex?

SurfaceWhere it runsBest for
Codex CLIYour machine, on the local repoDaily edits and debugging; codex exec in scripts and CI
IDE extensionVS Code, Cursor, Windsurf, VS Code Insiders; Xcode and JetBrains use their own integrationsDelegating tasks without leaving the editor
Codex CloudOpenAI cloud environments connected to your GitHub reposTasks that keep running while your computer sleeps; commit or open a PR after review
ChatGPT desktop appYour machine, with a native sandboxPeople who prefer not to use a terminal; PowerShell support on Windows

codex cloud in the terminal lists cloud tasks, submits new ones and applies results to your local repo.

#How do I install the Codex CLI?

bash
# macOS / Linux install script (run it again to update) curl -fsSL https://chatgpt.com/codex/install.sh | sh # npm npm install -g @openai/codex # Homebrew brew install --cask codex

Windows PowerShell:

powershell
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

Run codex in a project folder. On first run choose Sign in with ChatGPT or another sign-in method such as an API key. Commit before and after each task so you can revert.

#How much can I use on Plus?

OpenAI gives these ranges of local messages per five hours for Plus and standard Business seats:

ModelLocal messages per 5 hours
GPT-6 Astra5–45
GPT-6.1 Sol15–160
GPT-6.1 Terra35–285
GPT-6 Sol15–150
GPT-6 Luna350–3,000

The ranges are wide because one message can read a few files or hundreds. Cloud tasks use more of the allowance than local messages, and weekly limits may also apply; OpenAI publishes no numbers for those. GPT-5.5 was retired from Codex with ChatGPT sign-in on 2026-10-14 (API-key sessions are not affected).

#How does AGENTS.md work?

AGENTS.md holds the project instructions Codex reads at the start of every run: build and test commands, conventions and no-go areas.

Lookup order from the official docs:

  1. Global: ~/.codex/AGENTS.override.md, else ~/.codex/AGENTS.md (or the CODEX_HOME directory)
  2. Project: from the project root (usually the Git root) down to your current directory; in each directory Codex checks AGENTS.override.md, then AGENTS.md, then names in project_doc_fallback_filenames, taking at most one file per directory
  3. Files are joined root first, so files closer to your current directory win
  4. The combined size stops at project_doc_max_bytes, 32 KiB by default
toml
# ~/.codex/config.toml project_doc_fallback_filenames = ["TEAM_GUIDE.md", ".agents.md"] project_doc_max_bytes = 65536

Check what loaded:

bash
codex --ask-for-approval never "Summarize the current instructions."

#How do sandbox and approvals work?

PresetCommandEffect
Auto (default in Git repos)codex --sandbox workspace-write --ask-for-approval on-requestReads, edits and runs commands in the workspace; asks before touching files outside it or using the network
Read-onlycodex --sandbox read-only --ask-for-approval on-requestDiscussion and planning without edits; the default outside version control
Full access--yoloNo sandbox; avoid on your main machine
  • workspace-write has no network by default, so npm install fails until you enable network access in config.
  • .git, .codex and .agents inside the workspace stay read-only.
  • approval_policy = "untrusted" is no longer supported.
  • Use /permissions to switch during a session and /model to change model and reasoning effort.

#Useful commands

CommandWhat it does
codexInteractive session in the current folder
codex exec "..."Non-interactive run for scripts and CI
codex resumeReopen an earlier session
codex --searchAllow live web search for this run
codex cloudList or submit cloud tasks and apply results locally
codex mcpAdd and inspect MCP servers
/reviewReview current changes without editing files

Comment @codex review on a GitHub pull request to have Codex review it in the cloud.

#Codex vs Claude Code vs Cursor

OpenAI CodexClaude CodeCursor
SurfacesCLI, IDE extension, Codex Cloud, ChatGPT desktop appCLI, VS Code and JetBrains extensions, desktop app, webVS Code-based editor, CLI (agent), Cloud Agents
Project instructionsAGENTS.md (32 KiB default cap)CLAUDE.md; also reads a repo's AGENTS.md.cursor/rules/*.mdc or AGENTS.md
ModelsOpenAI GPT-6 / 6.1 modelsAnthropic Claude modelsComposer 2.5, Claude, GPT, Gemini, Grok
Lowest full individual priceChatGPT Plus $20/monthClaude Pro $20/month ($17 billed annually)Free $0; Plus $8 (Grok only); Premium $30 for third-party models
Pay as you goOpenAI API keyConsole API keyUsage beyond the plan billed per token

Prices as of 2026-11-09; see Claude pricing↗ and Cursor pricing↗.

  • You already pay for ChatGPT Plus: start with Codex. Cloud tasks and GitHub PR reviews are where it saves the most effort.
  • Your team lives in the terminal: run the same real task in Codex and Claude Code before you decide.
  • You prefer editing in an editor: Cursor feels smoother, and the Codex extension also installs in Cursor.

All three read AGENTS.md, so one file of team rules works everywhere.

#FAQ

Is this the 2021 Codex model? No. The 2021 Codex was a code-completion model and was retired long ago. Today's Codex is OpenAI's coding agent product running current GPT models.

Can company code go into Codex Cloud? Cloud tasks connect to GitHub and install dependencies in a cloud environment. For sensitive code, have an admin confirm the ChatGPT workspace data and network policies first, or stay with the local CLI and IDE extension.

Can a Free account use the Codex CLI? As of 2026-11-09 the pricing page lists GPT-6 Luna in the desktop app for Free and Go, subject to rollout. Full CLI, IDE and web use starts with Plus, or pay per token with an API key.

Author
Lightman Wang
Lightman Wang
Founder of JR Academy

Individual authors and reviewers are credited where recorded.

FAQ

Is Codex free, and which ChatGPT plan do I need?
As of 2026-11-09 full Codex CLI, IDE and cloud use starts with ChatGPT Plus ($20/month). Free and Go ($8/month) get GPT-6 Luna in the desktop app only, subject to rollout. Pro is $100, $200 or $500 per month; Business is $20 per user per month billed annually. API keys are billed per token.
How do I install the Codex CLI?
Run npm install -g @openai/codex or brew install --cask codex; on macOS or Linux you can also run curl -fsSL https://chatgpt.com/codex/install.sh | sh. As of 2026-11-09 the current version is 0.167.0. Then run codex in a project folder and choose Sign in with ChatGPT.
Where does Codex read AGENTS.md from?
Globally from ~/.codex/AGENTS.md. In a project, from each directory between the Git root and your current directory; files closer to your current directory win, and AGENTS.override.md replaces AGENTS.md at the same level. The combined default cap is 32 KiB (project_doc_max_bytes).
Is Codex better than Claude Code?
There is no general answer. Both are terminal coding agents and both start at $20/month for full individual use (ChatGPT Plus or Claude Pro, as of 2026-11-09). If you already pay for ChatGPT, start with Codex; otherwise run the same real task in both and compare the diffs and rework.

Done reading? Next steps