What is Codex? OpenAI's coding agent, explained

What OpenAI Codex is, where it runs, what it costs, how to install the CLI and how it compares to Claude Code.

Last updated

Abstract illustration of a glowing glass window with a small bright cursor

Codex is OpenAI's coding agent. You give it a task in plain words ("fix the failing test", "add a settings page"), and it reads your code, edits files, runs commands, and shows you the changes for review. It runs in your terminal (the Codex CLI), inside your editor, in the ChatGPT desktop app, and in the cloud, and it is included in ChatGPT plans, starting with a limited version on the Free plan.

If you have used ChatGPT to write code, the difference is that ChatGPT gives you a snippet to copy, and Codex does the work inside your project. It can open ten files, run your test suite, see what broke, fix it and run the tests again, without you pasting anything back and forth.

Everything below was checked against OpenAI's own documentation on November 29, 2026. Codex changes fast, so the version numbers, model names and prices here will age.

What Codex actually does

A coding agent is a language model in a loop with tools. The model reads your request, decides it needs to look at a file, reads it, decides to run a command, reads the output, and keeps going until the task is done or it needs you. Codex is OpenAI's version of that loop, running OpenAI's GPT models.

In practice you use it for things like:

  • Explaining a codebase you just inherited ("Tell me about this project" is literally the first prompt OpenAI's CLI docs suggest).
  • Fixing bugs from an error message or a failing test.
  • Building features across several files, then running the tests.
  • Reviewing changes before you merge them.
  • Running longer tasks in the cloud against a GitHub repository and getting a pull request back.

Two things keep it from running wild on your machine. A sandbox limits which files and network access the commands it runs can touch, and an approval policy decides when it has to stop and ask you. You can loosen both (more on that in the FAQ), but the defaults are cautious for good reason.

Codex also reads instruction files. Before doing any work it reads AGENTS.md files: a global one in ~/.codex, then any it finds walking from your project root down to the folder you are in. This is where you tell it your conventions, how to run the tests, and what not to touch. Agents do much better work in a codebase that has clear conventions, real tests and an AGENTS.md; that is the idea behind RailsFast, a Rails template that ships all three.

The forms Codex comes in

OpenAI's docs list Codex as available in the ChatGPT desktop app, the ChatGPT mobile app, ChatGPT on the web, the Codex CLI, the Codex IDE extension and Codex Cloud. Here is what each one is, as of November 2026.

Surface What it is Where it works
Codex CLI A terminal agent you run inside a project folder with codex macOS, Linux, Windows
IDE extension Codex in a sidebar of your editor, with your open file or selection as context VS Code, Cursor, Windsurf, VS Code Insiders; Xcode and JetBrains have their own integrations
Desktop app Codex inside the ChatGPT desktop app, with parallel chats, files and scheduled tasks macOS, Windows, Linux (per OpenAI's app docs)
Cloud Tasks that run on OpenAI's machines against a connected GitHub or GitLab repository Started from the web, desktop app or mobile app
Integrations Slack, Linear, GitHub code review, a GitHub Action and the Codex SDK Depends on plan

The Codex CLI

The CLI is the original "agent in your terminal" form and the one most developers mean by "Codex". Its source code is public on GitHub at openai/codex under the Apache 2.0 license, and the GitHub page describes it as a "lightweight coding agent that runs in your terminal". Installation is covered further down this page.

The IDE extension

In VS Code, Cursor or Windsurf you install the Codex extension and open it from the sidebar, or with "Codex: Open Codex Sidebar" from the command palette. In Xcode you pick Codex as the agent in the coding assistant; in JetBrains IDEs you select it in AI Chat. The extension can work locally on your files, or hand a longer task off to the cloud and bring the result back into the editor.

The desktop app (now part of ChatGPT)

This one confuses people, because it moved. Codex used to have its own desktop app. On July 9, 2026, OpenAI announced that "the Codex app is merging with the new ChatGPT desktop app", and said the existing ChatGPT desktop app would be renamed ChatGPT Classic. So today the "Codex app" is the ChatGPT desktop app: you choose ChatGPT or Codex when you start, and Codex runs projects in parallel, works with your files and can schedule recurring tasks. If you have the Codex CLI installed, codex app opens it (or its installer) for the current folder.

Codex Cloud

Cloud tasks run on OpenAI's machines, not yours. You connect a GitHub or GitLab account, pick repositories, and Codex prepares an environment (it inspects the repo to work out what to install). Each task gets its own workspace and keeps working while your computer is asleep; when you are happy with the result you commit it or open a pull request. You start cloud tasks from ChatGPT on the web or desktop ("Work in > Cloud") or from the mobile app, and the CLI has an experimental codex cloud command to list tasks and apply their diffs locally.

What about ChatGPT Work?

ChatGPT Work, also announced on July 9, 2026, is a general agent for non-coding work, built on Codex technology. OpenAI says Codex stays the coding agent for developers and technical professionals. The two share pricing, credits and usage limits.

Is Codex free, and what does it cost?

Yes, there is a free version, but it is small. OpenAI's pricing page, checked November 29, 2026, says Codex is included in the Free, Go, Plus, Pro, Business, Edu and Enterprise plans:

Plan Price (USD, as of November 2026) Codex included
Free $0 GPT-6 Luna in the desktop app, "subject to rollout"
Go $8 per month GPT-6 Luna in the desktop app, "subject to rollout"
Plus $20 per month Codex on the web, CLI, IDE extension and iOS, plus cloud code review and Slack
Pro $100, $200 or $500 per month Everything in Plus with more usage; no five-hour limit currently
Business $20 per user per month billed annually ($25 monthly) Admin controls, SSO, larger cloud machines
Enterprise and Edu Contact sales Security, compliance and data residency controls
API key Pay per use at API prices CLI, SDK and IDE extension; no cloud features

The detail that matters: on the pricing page, the CLI and the IDE extension are listed from Plus upward (or with an API key). Free and Go only list the desktop app. So "is Codex free?" has an honest answer of "you can try it in the ChatGPT desktop app for free; for the CLI, plan on $20 a month or an API key".

How much you can actually do per plan is a separate question. OpenAI does not publish fixed message counts; usage depends on the model and the size of the task, there is a five-hour window and weekly limits may also apply, and local and cloud work share the same allowance. That has its own page: Codex limits.

How to install and run the Codex CLI

These are the install commands from the openai/codex README and OpenAI's CLI docs, checked November 29, 2026. Pick one.

macOS or Linux, with the standalone installer:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

Windows, in PowerShell:

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

With npm (any OS with Node.js):

npm install -g @openai/codex

With Homebrew:

brew install --cask codex

Then check it worked:

codex --version

The latest version on npm on November 29, 2026 was 0.172.0 (published November 24, 2026).

Run it for the first time

Open a project folder and start it:

cd your-project
codex

On first run it asks you to sign in. Choose Sign in with ChatGPT to use your plan's Codex allowance, or use an API key instead (pay per use). For an API key, the CLI reads it from stdin:

printenv OPENAI_API_KEY | codex login --with-api-key

codex login status tells you which account you are signed in with.

Then just describe what you want. A good first prompt is "Tell me about this project", which costs little and shows you how well it understands the code. OpenAI's own docs recommend making a Git commit before and after each task, so you can always roll back what the agent did. That is good advice for any coding agent.

Useful ways to run it

Start with a prompt already typed:

codex "explain how authentication works in this app"

Pick a model (inside a session, /model does the same and lets you change reasoning effort):

codex --model <model-name>

Run it without the interactive interface, for scripts and CI:

codex exec "run the tests and fix any failures"

Have it review your current changes:

codex review

Pick up where you left off:

codex resume --last

Update to the latest version:

codex update

If Codex is failing or not responding for everyone, not just you, check whether Codex is down.

Every command above appears in codex --help on Codex CLI 0.167.1 (the version installed when this page was checked) or in OpenAI's docs. If a command does not exist in your version, run codex --help to see what yours supports.

Which model does Codex use?

If you do not pick one, Codex uses "a recommended model". OpenAI's models page recommends six as of November 2026: GPT-6.2 Astra for demanding projects, GPT-6.2 Sol for everyday tasks like editing code, GPT-6 Astra, GPT-6.1 Sol (performance close to GPT-6 Astra at a lower cost), GPT-6.1 Terra as a fast, efficient option, and GPT-6 Luna as the most efficient for focused, high-volume tasks. Bigger models use up your allowance faster, which is the main reason to switch down for simple jobs.

Codex vs Claude Code

Codex and Anthropic's Claude Code are the two big coding agents, and in late 2026 they look more alike than different. Both have a terminal CLI, editor extensions, a desktop app, cloud tasks that end in a pull request, and a mobile way to check on work. Both read a project instruction file, and Claude Code can read an AGENTS.md if your repo already has one, so one file can serve both.

The real differences, as of November 2026:

Codex Claude Code
Models OpenAI GPT models (GPT-6.x family) Anthropic Claude models
Cheapest plan with the CLI ChatGPT Plus, $20 per month Claude Pro, $20 per month ($17 billed annually)
Free plan Limited Codex in the ChatGPT desktop app Claude Code not included
Higher tiers Pro at $100, $200 or $500 per month Max at $100, Ultra at $200 per month
Instruction file AGENTS.md CLAUDE.md (or AGENTS.md)
CLI source Open source, Apache 2.0 Not open source

Which is better depends on the model you prefer for your code and on which subscription you already pay for. The honest way to choose is to give both the same real task in the same repo and compare the diffs. The full comparison, row by row, is on Codex vs Claude Code, and the pricing side of Claude Code is on Claude Code pricing.

Frequently asked questions

Is Codex free?

Partly. As of November 2026, OpenAI's pricing page includes Codex in the ChatGPT Free plan, but only with the GPT-6 Luna model in the desktop app and "subject to rollout". The CLI, the IDE extension and cloud code review are listed from the $20 per month Plus plan upward, or with an API key at pay-per-use prices.

Is ChatGPT Codex free?

ChatGPT Codex and Codex are the same product: Codex is included in your ChatGPT plan rather than sold separately. Free and Go users get limited Codex in the ChatGPT desktop app as of November 2026. Plus ($20 per month) and above add the web, CLI, IDE extension and iOS.

What is Codex in ChatGPT?

Codex is the coding agent built into ChatGPT. In the ChatGPT desktop app you choose Codex instead of the normal chat, and on the web or mobile you can send coding tasks to Codex Cloud, which works on your connected GitHub or GitLab repository. It shares your ChatGPT plan's usage allowance.

Is Codex usage separate from ChatGPT?

Partly. Codex shares one allowance and credit pool with ChatGPT Work, and local messages and cloud chats draw from that same allowance. Regular ChatGPT chat has its own limits, so chatting doesn't use up your Codex allowance. The details of the five-hour and weekly limits are on the Codex limits page.

Does Codex have a Windows version?

Yes. As of November 2026 Codex works on Windows in the desktop app, the CLI and the IDE extension. OpenAI's Windows docs say it runs natively in PowerShell with a Windows sandbox, without WSL or a virtual machine, and suggest WSL only when you need Linux-native tooling. The CLI installs with the PowerShell command on this page or with npm.

Does Codex run on Linux?

Yes. The CLI's standalone installer is for macOS and Linux, and the GitHub README lists prebuilt Linux binaries for x86_64 and arm64. OpenAI's app docs also list a Linux version of the ChatGPT desktop app.

Is Codex open source?

The Codex CLI is. Its code is on GitHub at openai/codex under the Apache 2.0 license. The models it runs, the desktop app and Codex Cloud are OpenAI services, not open source.

What model is Codex local using?

By default, even the local CLI uses OpenAI's hosted models; only the commands and file edits happen on your machine. If you want a model that runs entirely on your computer, the CLI has an --oss flag that uses a local provider, with LM Studio or Ollama as the options listed in codex --help.

How do I run Codex with full permissions?

The CLI has a --sandbox danger-full-access option and a --dangerously-bypass-approvals-and-sandbox flag that skips every confirmation and the sandbox. Codex's own help text calls the second one "EXTREMELY DANGEROUS" and meant for environments that are already sandboxed, like a throwaway container. On a normal machine, the workspace-write sandbox mode is the safer middle ground.

What is a worktree in Codex?

A Git worktree is a second working copy of the same repository on a different branch, so an agent can make changes without touching the files you are working in. Codex can run a session in a new managed worktree (the CLI has a --worktree flag for this), which is how you run several tasks in parallel without them stepping on each other.

Can you connect Codex to GitHub?

Yes. Codex Cloud works on repositories from a connected GitHub or GitLab account and can open pull requests. On paid plans there is also automatic code review on GitHub, and OpenAI offers a GitHub Action for running Codex in your workflows.

Is Codex better than Claude Code?

Neither wins everywhere. Both are full coding agents with a CLI, IDE extensions, a desktop app and cloud tasks, and both start at $20 per month for CLI access as of November 2026; the main difference is the model behind them (OpenAI's GPT models versus Anthropic's Claude). Try both on the same real task in your own repo before deciding.

How do I update Codex?

Run codex update. If you installed with the standalone script, running the install script again also updates it, and npm or Homebrew installs update through those tools.

Sources

Checklist

Grab your free launch checklist 🚀

The definitive checklist to launch any project. It includes pre-launch steps & a detailed launch checklist you can go through to get your new project off the ground.

Secure connection. No spam.