How to Use OpenAI Codex: A Step-by-Step Beginner's Guide

How to use OpenAI Codex: install the CLI, sign in with ChatGPT and run your first task. Plus costs $20/month (as of 15 October 2026).

By Archit Tamrakar · LinkedIn · · 9 min read

Quick answer: Install the Codex CLI with the one-line installer, open a project folder, run codex and choose Sign in with ChatGPT. Free? Partly: Codex is included in ChatGPT Free and Go with limits, and Plus costs $20 per month as of 15 October 2026.

OpenAI Codex is a coding agent that reads your project, edits files and runs commands. OpenAI describes the CLI as a coding agent that runs locally on your computer, and the same account also works in an IDE extension, the ChatGPT desktop app and a cloud version. This guide summarises OpenAI's own documentation as of 15 October 2026. It is not based on our own runs of the tool.

What do you need before you start?

You need a ChatGPT account, a project folder, and a terminal or code editor. OpenAI's help article says Codex is included across ChatGPT plans, including Free and Go, and that usage limits vary by plan.

Before you begin, check these three things:

If you want a comparable tool from another vendor, see How to Install Claude Code on Mac and Windows.

How do you install and run the Codex CLI? (Method 1: terminal)

Run the installer for your system, then type codex inside a project folder. The standalone installer is the first option in OpenAI's CLI quickstart.

  1. Open Terminal (Mac or Linux) or PowerShell (Windows).

  2. On Mac or Linux, run this command:

    curl -fsSL https://chatgpt.com/codex/install.sh | sh
    
  3. On Windows, run this command:

    powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
    
  4. Move into your project folder, for example with cd path/to/your-project.

  5. Type codex and press Enter. On first run, choose Sign in with ChatGPT or another available sign-in method.

  6. Type a first task. OpenAI's example is "Tell me about this project".

Prefer a package manager? The README also lists npm install -g @openai/codex and brew install --cask codex. Both end the same way: run codex.

The CLI repository is licensed under Apache-2.0, so the code is open source.

How do you use Codex inside VS Code or another editor? (Method 2: IDE extension)

Install the Codex extension, open the Codex panel and start a chat with your project open. VS Code, Cursor and Windsurf use the Codex extension; Xcode and JetBrains IDEs have their own integrations.

  1. Install the extension for your editor from the IDE page. In VS Code, Cursor or Windsurf, the extension is called Codex.
  2. Choose the Codex icon. If you do not see it, open the Command Palette and run Codex: Open Codex Sidebar.
  3. Sign in with your ChatGPT account when asked.
  4. Open a project and ask Codex to explain the codebase, make a focused change or help debug.
  5. In Xcode, open the coding assistant, start a new chat and choose Codex. In JetBrains IDEs, open AI Chat and select Codex.

On Windows, OpenAI documents a VS Code setting that keeps the agent inside WSL2:

{
  "chatgpt.runCodexInWindowsSubsystemForLinux": true
}

OpenAI's help article adds that the VS Code extension works with most VS Code forks, and that other IDEs can run the CLI in the built-in terminal.

How do you run Codex tasks in the cloud? (Method 3: Codex Cloud)

Open ChatGPT, choose Work in > Cloud, create an environment from your GitHub repositories and start a task. This is OpenAI's documented flow. Verify this step: the menu labels may differ slightly between web, desktop and mobile.

  1. Open ChatGPT on the web or in the desktop app and sign in.
  2. Choose Work in > Cloud and open Select environment.
  3. To make a new one, select Create environment, choose your GitHub repositories and select Get started. Connect GitHub if asked.
  4. Review the setup and test results, then select Publish and wait for "Environment published".
  5. Select Start a new task, describe the job and send it.
  6. Review the changed files and test results, ask for follow-ups, then commit or open a pull request.

OpenAI says each cloud task has its own workspace and can keep working while your computer is asleep. The API-key option does not include cloud features, according to the pricing page.

How do you write prompts and rules that work?

Give Codex a goal, context, constraints and a finish line, and store lasting rules in an AGENTS.md file. OpenAI's best-practices guide recommends four prompt parts: Goal, Context, Constraints and Done when.

An example in that format (our own wording, not an OpenAI sample):

Goal: Add input validation to the signup form.
Context: See @src/signup.js and the error in the console.
Constraints: Do not add new dependencies.
Done when: the existing tests pass and an empty email shows an error.

For hard or vague tasks, OpenAI suggests Plan mode, toggled with /plan or Shift+Tab.

Useful commands from the CLI start screen, as listed by OpenAI:

CommandWhat it does
/initCreates an AGENTS.md file with instructions for Codex
/statusShows current session configuration
/permissionsChooses what Codex is allowed to do
/modelChooses the model and reasoning effort
/reviewReviews changes and finds issues

About AGENTS.md: Codex reads these files before doing any work, starting with a global file in ~/.codex, then project files from the repository root down to your current folder. Files closer to your current directory override earlier guidance, and the combined size limit is 32 KiB by default. OpenAI advises editing the starter file from /init to match how your team builds and tests.

Which method should you choose?

Start with the editor extension if you already live in VS Code, and the CLI if you are comfortable in a terminal. Use Cloud for longer jobs you want to review later.

MethodCostDifficultyLimitsBest for
CLIIncluded with a ChatGPT plan; open-source codeMedium (terminal)Plan usage limits; local files onlyDevelopers who like the terminal, scripts via codex exec
IDE extensionIncluded with a ChatGPT planEasyPlan usage limits; works with most VS Code forksFocused edits with open files as context
Codex CloudPlan usage; needs GitHub repositoriesMedium (environment setup)Cloud tasks may use more allowance than local messagesLonger tasks you review later

What does Codex cost, and what are the usage limits?

As of 15 October 2026, OpenAI's pricing page lists Free at $0 per month, Go at $8, Plus at $20, and Pro plans at $100, $200 or $500. Business is $20 per user per month on annual billing for 2+ users, or $25 billed monthly. Enterprise and Edu are contact-sales.

PlanPrice (as of 15 Oct 2026)What the pricing page lists for Codex
Free$0/monthGPT-6 Luna at Standard speed in the desktop app, subject to rollout
Go$8/monthGPT-6 Luna at Standard speed in the desktop app, subject to rollout
Plus$20/monthWeb, CLI, IDE extension and iOS; GPT-6.1 Sol and GPT-6 Luna; credits available
Pro$100, $200 or $500/monthEverything in Plus; Ultrafast mode on the $500 plan
Business$20/user/month annual, $25 monthlyLarger cloud virtual machines, admin controls, credits
API keyPay at API ratesCLI, SDK, IDE extension; no cloud features

Limits are shown as ranges. For Plus, OpenAI estimates local messages per five-hour period at 15 to 160 for GPT-6.1 Sol and 350 to 3,000 for GPT-6 Luna. Pro plans currently have no five-hour limit, and weekly limits may also apply. OpenAI says these are estimates, not fixed message limits, and that cloud tasks may use more of your allowance.

Fast mode uses 2.5 times the included subscription usage of Standard mode, and Ultrafast uses 8 times (OpenAI's figures). Plus and Pro users who hit a limit can buy extra credits.

What can go wrong, and how do you fix it?

Most early problems come from permissions, old settings or surprise edits. These are the common ones that OpenAI's docs cover.

Is it safe and allowed to use Codex on your code?

It is built to be sandboxed, but you stay responsible for what it changes and what data you send. In the CLI and IDE extension, defaults block network access and limit writes to the active workspace.

Two cautions from OpenAI's docs:

For work projects, check your employer's rules on AI tools first. If you also want AI help in spreadsheets, see How to Use ChatGPT Inside Google Sheets and How to Write Google Sheets Formulas With ChatGPT or Claude.

What's still unclear?

A few points are not settled by the sources, and the product changes fast.

  • Free and Go access to the CLI. The help article says Codex is included in Free and Go. The pricing page lists a desktop-app model for those plans and lists the CLI and IDE extension under Plus. The pages do not spell out whether the CLI works on Free or Go, so check your own account.
  • Real usage per task. OpenAI says similar-looking tasks can use different amounts of allowance. The message ranges are wide (15 to 160 for GPT-6.1 Sol on Plus), so planning around them is hard.
  • Model names move. OpenAI says GPT-5.5 retired from Codex with ChatGPT sign-in on 14 October 2026. Model lists and defaults may differ when you read this.
  • Docs are moving. OpenAI's documentation is served from both developers.openai.com and learn.chatgpt.com. Menu names can change between app versions.
  • Vendor documentation only. This guide summarises OpenAI's documentation. Plan features, limits and prices are OpenAI's own claims.

Last checked: 15 October 2026.

Frequently asked questions

Is OpenAI Codex free to use?

Partly. OpenAI's help article says Codex is included across ChatGPT plans, including Free and Go, with usage limits that vary by plan. The CLI itself is open source under the Apache-2.0 licence. The pricing page lists the CLI and IDE extension under Plus at $20 per month (as of 15 October 2026), so check what your plan shows when you sign in.

What is the difference between the Codex CLI and Codex Cloud?

The CLI runs on your computer, in a project folder you choose, and edits local files. Codex Cloud runs tasks in cloud environments built from your GitHub repositories, so work can continue while your computer sleeps. You review the changes and then commit or open a pull request. Both sign in with a ChatGPT account.

Can Codex change my files without asking?

In the default Auto preset it can read files, edit them and run commands inside your working directory without asking. It asks before editing outside that workspace or using the network. You can switch to read-only mode with the /permissions command if you only want to chat or plan.

Do I need to know how to code to use Codex?

Not to start. A good first prompt is a plain question such as 'Tell me about this project'. But Codex edits real files and runs commands, so you should be able to read a diff, or ask a developer to. OpenAI advises creating Git checkpoints before and after a task so changes can be reverted.

Does Codex work on Windows?

Yes. OpenAI publishes a PowerShell installer for the CLI, and the IDE extension can run inside WSL2 with a VS Code setting. OpenAI's docs say WSL1 stopped being supported from Codex 0.115. If you hit startup problems, the CLI includes a codex doctor command for diagnostics.

Can I use Codex with an API key instead of a ChatGPT plan?

Yes, with extra setup. The CLI, SDK and IDE extension accept an API key, and usage is billed at API rates. OpenAI's pricing page says API key sessions do not get cloud features such as GitHub code review and Slack.

Sources

  1. openai/codex (README), GitHub (OpenAI) (2026-10-15)
  2. Codex CLI, OpenAI Developers (2026-10-15)
  3. Codex IDE extension, OpenAI Developers (2026-10-15)
  4. Codex Cloud, OpenAI Developers (2026-10-15)
  5. Pricing, OpenAI (ChatGPT Learn) (2026-10-15)
  6. Using Codex with your ChatGPT plan, OpenAI Help Center (2026-10-15)
  7. Agent approvals & security, OpenAI Developers (2026-10-15)
  8. Custom instructions with AGENTS.md, OpenAI Developers (2026-10-15)
  9. Best practices, OpenAI Developers (2026-10-15)