Lesson 31 of 36 · Track 4: Automate and code with AI

OpenAI Codex for beginners: what it is and how to start

Beginner12 min6 steps1 videoFree · no login
The short answer

Codex is OpenAI’s coding agent. You give it a task in plain English, and it reads your code, makes changes, runs commands and shows you the result to review. It runs inside ChatGPT, as a desktop app, in code editors like VS Code and in the terminal, all signed in with your ChatGPT account.

  1. 1

    Which "Codex" is this?

    The name Codex was first used in 2021 for an older OpenAI code model. Today, Codex means OpenAI’s coding agent: "the same powerful coding agent, now in ChatGPT", as OpenAI’s Codex page puts it. If a tutorial talks about the 2021 model, it is about something else.

    Like Claude Code and Cursor’s Agent, Codex is an agent. It doesn’t just suggest code. It works through a task step by step: read the project, plan, edit files, run the tests, and hand you the changes to review.

    • Codex in ChatGPT: start tasks from the ChatGPT app or chatgpt.com/codex, including in the cloud.
    • Codex app: a desktop "command center" for running several agents at once.
    • IDE extension: inside VS Code, Cursor or Windsurf.
    • Codex CLI: in your terminal. It is open source (Apache-2.0) on GitHub.
    Key idea

    One agent, many doors. All of them use the same ChatGPT login.

  2. 2

    How does it work on a task?

    You describe a task. Codex reads the relevant files, makes a plan, edits code and runs commands such as tests. On your own computer it works in your project folder. In the cloud it works in its own copy of your code, so you can close your laptop while it runs.

    Codex can run several agents in parallel, each in its own git worktree (a separate working copy of the same project), so their changes don’t clash. You can also teach it your team’s way of working with Skills, schedule background jobs, and ask it to review pull requests.

    1. You describe the task
    2. Codex reads and plans
    3. Edits and runs tests
    4. You review the changes
    5. You merge or ask for fixes
  3. 3

    Get started: app, ChatGPT or CLI

    The easiest start is the Codex app or Codex inside ChatGPT. Log in with your ChatGPT account, connect a project (a folder on your computer, or a GitHub repository for cloud tasks) and type a task.

    If you like the terminal (a text window where you type commands), install the Codex CLI. Then go into your project folder, run codex, and choose "Sign in with ChatGPT". You can use an OpenAI API key instead, but that needs extra setup.

    Codex CLI install commands (from the official GitHub README)
    # macOS or Linux
    curl -fsSL https://chatgpt.com/codex/install.sh | sh
    
    # Windows PowerShell
    powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
    
    # Or with npm or Homebrew
    npm install -g @openai/codex
    brew install --cask codex
    
    # Then, inside your project folder
    codex
  4. 4

    Your first task, and a file of instructions

    Start with questions so you learn the project, then give one small, clear task. Say what "done" means, and ask Codex to run the tests or check its work. Small tasks with a clear finish line are where coding agents do best.

    Codex reads instructions from an AGENTS.md file in your project, the same idea as CLAUDE.md for Claude Code and rules in Cursor. Put how to run and test the project, and any rules, in a few short lines.

    Three good first prompts
    Explain what this project does and how its folders fit together. Don’t change anything yet.
    
    Add a "clear all" button to the to-do list in index.html. Keep the current style. Tell me how you tested it.
    
    Write an AGENTS.md with how to run this project and our rule: no new libraries without asking.
  5. 5

    What is Codex good at, and where should you be careful?

    OpenAI pitches Codex for real engineering work: building features, large refactors and migrations, code review, and background jobs like watching CI (the automatic tests that run when code changes). In practice, agents shine on tasks that are well defined and can be checked by tests.

    Be careful with vague asks ("make it better"), code you cannot test, and anything touching passwords, payments or live data. Read every change before you merge it. Codex makes mistakes like every AI tool, and you own the code it writes.

    Key idea

    Small, clear, testable tasks in. Reviewed changes out.

  6. 6

    Which plans include Codex?

    Codex runs on your ChatGPT account. As of Nov 2026, ChatGPT’s pricing page lists "Limited Codex access" on the Free plan, limited use on Go, "Expanded Codex usage" on Plus, and more on Pro. The official Codex README lists Plus, Pro, Business, Edu and Enterprise as plans you can sign in with. OpenAI’s help centre lists ChatGPT Plus at $20 a month.

    The official pages we checked did not show the other prices, so look at chatgpt.com/pricing for Pro, Business and the pay-as-you-go Codex option for teams before you buy. Limits change often, so check them on the day you sign up.

From the people who built it

Straight from the source

The original idea, then the same idea taken apart, then how you use it today.

Mark Chen, Jerry Tworek, Heewoo Jun and 55 co-authors (OpenAI)
The OpenAI team behind the original 2021 Codex model, which powered the first GitHub Copilot.
Evaluating Large Language Models Trained on Code (paper, 2021)
1 · Understand
They trained a GPT model on public code and tested it with HumanEval, a new set of programming problems checked by running tests. Codex solved 28.8% of the problems, where GPT-3 solved none, and 70.2% when it could try 100 times per problem.
2 · Break it down
  • HumanEval judges code by running it against tests, not by how it looks. That idea, "does it pass?", is still how coding models are measured.
  • Trying many times helped a lot. Generating several answers and keeping one that passes the tests beat a single attempt.
  • The paper noted weak spots: long chains of steps in one instruction, and keeping track of which variable is which.
  • A separate production version of this model powered GitHub Copilot.
3 · Use it
This is why you should give today’s Codex tests to run. An agent that can run tests can try, check and try again, the same idea that made the 2021 model so much stronger when it had more attempts.
OpenAI
The company that makes ChatGPT and the Codex coding agent.
Introducing Codex (OpenAI announcement, May 2025)
1 · Understand
The 2025 Codex is a cloud software engineering agent that can work on many tasks at once. OpenAI says "each task is processed independently in a separate, isolated environment preloaded with your codebase," and Codex shows terminal logs and test results as evidence of what it did.
2 · Break it down
  • At launch it ran on codex-1, a version of OpenAI o3 tuned for software engineering.
  • Isolated environment means a separate copy of your project in the cloud, so one task cannot break another or your own computer.
  • Citations of logs and test outputs let you check its work instead of taking its word for it.
  • AGENTS.md files, like a README for the agent, tell it how to find its way around, which tests to run and which conventions to follow.
3 · Use it
When Codex finishes a task, open the logs and test results before you read its summary. If there are no tests, ask it to write and run some first.
5 terms

Words to know

Codex
OpenAI’s coding agent, available in ChatGPT, as a desktop app, as an IDE extension and as a CLI.
Codex CLI
The open-source terminal version of Codex. You start it by typing codex in a project folder.
Cloud task
A task Codex runs on OpenAI’s computers using a copy of your repository, so it keeps going while you do other things.
Worktree
A separate working copy of the same git project, so parallel agents don’t overwrite each other’s changes.
AGENTS.md
A Markdown file of project instructions that Codex (and several other coding tools) read before working.
1 video · plays here

Watch

Hand-picked from the people who explain this best. The video loads only when you press play.

Introducing the Codex app
OpenAI · 4 min

OpenAI’s own short tour of the desktop app: parallel agents in worktrees, skills and automations. Watch it to see what the app looks like before you install it.

Hands-on · 10 minutes or less

Try it

Build a tip calculator with Codex

  1. 1Open Codex in ChatGPT or the Codex app, or install the CLI and run codex in a new empty folder called tip-calc.
  2. 2Ask: "Create a tip calculator web page in one index.html file. Inputs: bill amount, tip percent, number of people. Show the amount each person pays. Indian rupees by default."
  3. 3Read the changes it proposes, accept them, and open index.html in your browser to test it with a bill of 1,250 rupees, 10 percent tip and 4 people (it should show 343.75 each).
  4. 4Ask: "Add a simple test for the calculation and run it. Tell me what you ran."
  5. 5Ask: "Explain the code to a beginner in five short points."
Open Codex
3 questions · instant feedback

Check yourself

Pick an answer to see if you are right, and why.

Question 1

Question 1 of 3

What does "Codex" mean in 2026?

Question 2

Question 2 of 3

Why does Codex use separate worktrees when it runs agents in parallel?

Question 3

Question 3 of 3

Which task is Codex most likely to do well?

Lesson 31 of 36

Done? Keep going

Mark this lesson complete to keep your place. Progress is saved on this device, no login.

Up next · Lesson 32 · 12 minClaude Code vs Cursor vs CodexAll three are coding agents that can read your project, edit files and run commands. The real differences are where you work (terminal, editor or app), which models you get, and which subscription you already have. Claude Code suits Claude subscribers, Cursor suits people who want an AI editor, and Codex suits ChatGPT subscribers. Non-coders who just want an app can start with a browser app builder.← Previous: Cursor for beginners
People also ask

Questions people ask

Is OpenAI Codex free?

Partly. As of Nov 2026, ChatGPT’s pricing page lists "Limited Codex access" on the Free plan, and more usage on paid plans such as Plus ($20 a month) and Pro. The Codex CLI itself is free, open-source software, but it needs a ChatGPT plan or an API key to do any work.

Is Codex the same as ChatGPT?

No, but they are connected. ChatGPT is the general assistant. Codex is the coding agent that lives inside ChatGPT and also comes as a desktop app, an editor extension and a CLI. One ChatGPT login works for all of them.

Codex vs Claude Code: what is the difference?

Both are coding agents that read your project, edit files and run commands, and both work in the terminal, editors, desktop apps and the cloud. Codex uses OpenAI models and your ChatGPT plan. Claude Code uses Anthropic’s Claude models and a Claude plan. The comparison lesson in this path covers how to choose.

10 sources · checked Nov 2026

Sources and further reading

Free · No signup to start

Going for an AI role? Practise the interview.

Talk to an AI interviewer about what you just learned and get feedback on every answer.

Start a free mock interview