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).
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:
- An account: a ChatGPT login. An API key also works but needs additional setup.
- A project folder: ideally one that uses Git, so you can undo changes. OpenAI recommends creating Git checkpoints before and after a task.
- A terminal: Terminal on Mac or Linux, PowerShell on Windows. Prefer an editor? Skip to the IDE method below.
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.
Open Terminal (Mac or Linux) or PowerShell (Windows).
On Mac or Linux, run this command:
curl -fsSL https://chatgpt.com/codex/install.sh | shOn Windows, run this command:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"Move into your project folder, for example with
cd path/to/your-project.Type
codexand press Enter. On first run, choose Sign in with ChatGPT or another available sign-in method.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.
- Install the extension for your editor from the IDE page. In VS Code, Cursor or Windsurf, the extension is called Codex.
- Choose the Codex icon. If you do not see it, open the Command Palette and run Codex: Open Codex Sidebar.
- Sign in with your ChatGPT account when asked.
- Open a project and ask Codex to explain the codebase, make a focused change or help debug.
- 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
}
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.
- Open ChatGPT on the web or in the desktop app and sign in.
- Choose Work in > Cloud and open Select environment.
- To make a new one, select Create environment, choose your GitHub repositories and select Get started. Connect GitHub if asked.
- Review the setup and test results, then select Publish and wait for "Environment published".
- Select Start a new task, describe the job and send it.
- 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:
| Command | What it does |
|---|---|
/init | Creates an AGENTS.md file with instructions for Codex |
/status | Shows current session configuration |
/permissions | Chooses what Codex is allowed to do |
/model | Chooses the model and reasoning effort |
/review | Reviews 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.
| Method | Cost | Difficulty | Limits | Best for |
|---|---|---|---|---|
| CLI | Included with a ChatGPT plan; open-source code | Medium (terminal) | Plan usage limits; local files only | Developers who like the terminal, scripts via codex exec |
| IDE extension | Included with a ChatGPT plan | Easy | Plan usage limits; works with most VS Code forks | Focused edits with open files as context |
| Codex Cloud | Plan usage; needs GitHub repositories | Medium (environment setup) | Cloud tasks may use more allowance than local messages | Longer 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.
| Plan | Price (as of 15 Oct 2026) | What the pricing page lists for Codex |
|---|---|---|
| Free | $0/month | GPT-6 Luna at Standard speed in the desktop app, subject to rollout |
| Go | $8/month | GPT-6 Luna at Standard speed in the desktop app, subject to rollout |
| Plus | $20/month | Web, CLI, IDE extension and iOS; GPT-6.1 Sol and GPT-6 Luna; credits available |
| Pro | $100, $200 or $500/month | Everything in Plus; Ultrafast mode on the $500 plan |
| Business | $20/user/month annual, $25 monthly | Larger cloud virtual machines, admin controls, credits |
| API key | Pay at API rates | CLI, 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.
- Codex will not start after a config change. The
approval_policy = "untrusted"setting is retired and can stop Codex from starting. Remove it from your config files. For a read-only session, runcodex --sandbox read-only --ask-for-approval on-request. - A command needing the internet fails. The default sandbox keeps network access off. To allow it, add
network_access = trueunder[sandbox_workspace_write]in your config. - Edits you did not want. In the Auto preset, Codex can edit files and run commands in the working directory without asking. Commit first, review the diff and revert if needed. Use
/permissionsto switch to read-only. - Your instructions seem ignored. Codex skips empty files, and stops adding AGENTS.md files at the size limit. Check that the file has content, or look for an
AGENTS.override.mdhigher up. - Startup or connection trouble.
codex doctorruns diagnostics for startup, connectivity and performance. - You hit a usage limit. See the pricing section above. Credits or an API key are the documented ways to continue.
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:
- Bypass flags remove protection. In a container,
--sandbox danger-full-accessor--dangerously-bypass-approvals-and-sandboxcan let a malicious project exfiltrate anything inside it, including Codex credentials. OpenAI says to use them only with trusted repositories. - Training settings differ by plan. For Plus and Pro, conversations may be used to improve models unless you turn off training in ChatGPT data controls. Check this before pasting private code. Business, Enterprise and Edu inputs are not used by default, according to the same article.
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
- openai/codex (README), GitHub (OpenAI) (2026-10-15)
- Codex CLI, OpenAI Developers (2026-10-15)
- Codex IDE extension, OpenAI Developers (2026-10-15)
- Codex Cloud, OpenAI Developers (2026-10-15)
- Pricing, OpenAI (ChatGPT Learn) (2026-10-15)
- Using Codex with your ChatGPT plan, OpenAI Help Center (2026-10-15)
- Agent approvals & security, OpenAI Developers (2026-10-15)
- Custom instructions with AGENTS.md, OpenAI Developers (2026-10-15)
- Best practices, OpenAI Developers (2026-10-15)