Skip to content
Day 69: new resources are added every day. See what's new

Free guide

How to Set Up OpenAI Codex

Turn Codex into a safe, well-configured coding agent in under an hour

  • 22 bite-sized sections
  • 8 min read
  • Free, no signup

Short answer

A free, up-to-date guide to setting up OpenAI Codex: plans, the ChatGPT desktop app, CLI install, sign-in, IDE extension, models, permissions, AGENTS.md, config.toml, skills, MCP, code review, Codex Cloud and safe first tasks.

Updated

Built with love by Shushant Lakhyani. Building bestproductivityresources.com

Inside this guide

Short cards you can read in order or jump straight to. Tap the link icon on any card to share just that part.

01

Learn what OpenAI Codex is

Codex is OpenAI’s coding agent. It can read a codebase, edit files, run commands, review changes, and handle longer tasks in the cloud.

Unlike an ordinary chat, Codex can:

  • Work straight inside your project folder
  • Run your test suite and tools
  • Show diffs before you accept changes
  • Follow project rules set in AGENTS.md
  • Use skills, plugins, and MCP servers
  • Review GitHub pull requests
  • Run work in cloud environments
  • Run tasks on a schedule
02

Pick where Codex runs

ChatGPT desktop app
Codex ships inside the ChatGPT desktop app for macOS, Windows, and Linux.
Codex CLI
A terminal client for local work, scripts, and CI pipelines.
IDE extension
Works in VS Code, Cursor, and Windsurf. Xcode and JetBrains IDEs get their own integrations.
Codex Cloud
Runs tasks remotely so you can pick them up on the web, mobile, or desktop.
GitHub and Slack
Ask for reviews and tasks from the tools your team already uses.
03

Choose a plan

Free and Go
GPT-6 Luna at Standard speed in the desktop app, depending on rollout.
Plus ($20/month)
Codex on the web, CLI, IDE extension, and iOS, plus cloud features such as automatic code review and Slack.
Pro (from $100/month)
Tiers at $100, $200, or $500 per month for heavier workloads.
Business
$20 per user per month billed annually for 2+ users, or $25 billed monthly, with admin controls included.
Enterprise & Edu
Advanced security, compliance, and admin features. Talk to sales.
API key
Runs Codex in the CLI, SDK, or IDE extension at API pricing. Cloud features are not included.

ChatGPT Work and Codex draw from the same usage limits on your plan.

Pick the smallest plan that covers the surfaces you actually use.

04

Set up the ChatGPT desktop app

Download the ChatGPT desktop app for your operating system and sign in with your ChatGPT account.

To begin coding:

  • Open your project folder
  • Pick Codex from the ChatGPT dropdown
  • Describe the task

Start here if the terminal is not your daily home.

05

Install the Codex CLI

On macOS or Linux, run this:

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

On Windows, open a fresh PowerShell window and run:

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

Or install through a package manager:

npm
npm install -g @openai/codex
Homebrew
brew install --cask codex
06

Sign in

In your terminal, open a project folder and run:

codex

On first launch, pick Sign in with ChatGPT to draw on your plan’s included usage.

You can sign in with an OpenAI API key instead, billed at API rates. Some features, such as cloud-based integrations, do not work with an API key.

Never paste an API key into a prompt, a committed file, or a shared document.

07

Add the IDE extension

Install the Codex extension in VS Code, Cursor, or Windsurf, then open the Codex sidebar to:

  • Reference open files and selected code
  • Review edits beside your code
  • Send longer tasks to the cloud
  • Keep follow-ups in one chat

No icon? Open the Command Palette and run Codex: Open Codex Sidebar.

08

Pick the right model

GPT-6.1 Sol
The recommended pick for complex coding and agentic work. Close to Astra performance at a lower cost.
GPT-6 Luna
Best for focused, repeatable tasks.
GPT-6 Astra
OpenAI’s most capable model, built for the hardest problems.

Switch models with /model in the CLI, or launch with:

codex --model gpt-6.1-sol

GPT-5.5 left Codex for ChatGPT sign-ins on October 14, 2026. Swap out gpt-5.5 wherever it appears in your settings, scripts, or scheduled tasks.

09

Set reasoning effort

Higher reasoning effort can lift results on complex tasks, but it runs slower and burns more of your limits.

  • Begin at the default effort
  • Raise it for planning, debugging, and architecture work
  • Lower it for quick edits and repetitive chores

In the CLI, /model also adjusts reasoning effort. Ultra mode goes further and splits large tasks across subagents.

10

Understand permissions

Two layers keep Codex safe:

Sandbox mode
What Codex can technically do, such as where it may write and whether it can reach the network.
Approval policy
When Codex has to stop and check with you before acting.

On your machine, Codex runs in an OS-enforced sandbox, and network access is off by default.

The Auto preset lets Codex read, edit, and run commands inside your working folder, and it asks first before stepping outside it or touching the network:

codex --sandbox workspace-write --ask-for-approval on-request

Run /permissions to drop to read-only when you just want to plan or ask questions.

11

Write an AGENTS.md file

Codex reads AGENTS.md files before it starts any work. Run /init to generate a starter file for your project.

Cover:

  • What the project does
  • How to install dependencies
  • How to run tests and linting
  • Code style rules
  • Folders to leave alone
  • Commands that need approval
  • What counts as done

Keep personal defaults in ~/.codex/AGENTS.md. Project files add to and override them, and the combined size caps at 32 KiB by default.

Short, specific rules beat long explanations.

12

Configure config.toml

Your local settings live in ~/.codex/config.toml. Use it to store:

  • Your default model
  • Sandbox and approval defaults
  • Network access settings
  • MCP servers
  • Trust levels per project

To allow network access in the default sandbox, turn it on explicitly:

[sandbox_workspace_write] network_access = true

The old untrusted approval policy is retired. Delete it from older configs, or Codex may fail to start.

13

Add skills

A skill is a folder holding a SKILL.md file, plus optional scripts and references. SKILL.md must include a name and a description.

Project skills
.agents/skills inside your repository
Personal skills
~/.agents/skills inside your home folder

Type $ or run /skills to mention a skill. To build one with guidance, invoke $skill-creator.

14

Connect tools with MCP

MCP servers let Codex reach external tools and data, such as documentation, tickets, or databases.

codex mcp add

Run /mcp inside a session to see which servers are connected.

Connect only the servers a task requires, and check what each one can do.

15

Set up code review

Let Codex review your work before it ships:

  • Run /review on uncommitted changes or against a base branch
  • Mention @codex review on a GitHub pull request
  • Enable automatic reviews for connected repositories

Codex returns prioritized findings and leaves your working tree untouched, so you choose what to fix.

16

Set up Codex Cloud

Cloud tasks run remotely, so they keep working while you focus elsewhere.

In a new task, pick Work in, then Cloud, open Select environment, and choose Create environment. Codex inspects your repository and helps you prepare and test the setup.

In the terminal, codex cloud lets you browse chats, submit work, and apply results locally.

17

Learn the essential commands

codex
Open an interactive session
codex exec
Run a task without prompts in scripts or CI
codex resume
Pick up a recent chat
codex --search
Turn on live web search for current information
codex --image
Attach a screenshot or diagram
/init
Scaffold an AGENTS.md file
/review
Review changes
/status
Check context usage and rate limits
18

Start with a safe first task

Begin with something low-risk:

Walk me through this project. Explain its structure, how to run it, and how the tests work. Do not change any files.

Next, try a small change you can review:

Write tests for [one function]. Run the test suite and show me the diff before you finish.

Commit to Git before and after every task so you can always roll back.

19

Build good habits

  • Commit before each task
  • Set one clear goal per task
  • Request a plan for large changes
  • Review every diff
  • Run tests yourself before you merge
  • Keep AGENTS.md current
  • Open a new chat for each new topic
20

Keep it secure

  • Leave the sandbox on for everyday work
  • Enable network access only when a task needs it
  • Keep secrets out of AGENTS.md and prompts
  • Vet MCP servers and plugins before installing them
  • Check your plan’s data settings before touching client code
  • Treat website and file content as data, never as instructions

GPT-6 Astra also includes safety monitoring that can pause a task when it detects potentially unsafe behavior. Read the findings before you resume.

The sandbox and approvals protect you. Careful review protects your users.

21

Work through the setup checklist

Plan
Pick a plan that covers your surfaces.
Install
Desktop app, CLI, or IDE extension.
Sign in
ChatGPT account or API key.
Model
GPT-6.1 Sol for complex work, Luna for focused tasks.
Permissions
Workspace-write with approvals on request.
Instructions
An AGENTS.md file with project rules.
Extend
Skills and MCP only where they help.
Review
Review code before anything ships.
22

Use the master setup prompt

Paste this into a new repository once Codex is installed:

Act as my Codex setup assistant for this repository. Inspect the project without changing anything. Then propose an AGENTS.md that covers what the project does, how to install dependencies, how to run tests and linting, code style rules, folders to avoid, and which actions must ask for approval. Recommend sandbox and approval settings for daily work, list any MCP servers or skills that would truly help, and explain why. Wait for my approval before you create or change any files.

The best principle

Do not ask: “How do I make Codex do everything?” Ask: “What may Codex do on its own, and what must it check with me first?”

  • Plan
  • Install
  • Sign in
  • Model
  • Permissions
  • AGENTS.md
  • Extend
  • Review

Set it up once with clear rules, then hand it small, reviewable tasks and widen its scope from there.

Share this guide

The whole guide on one page

The same guide as one infographic. Save it, pin it or share it.

Frequently asked questions

The quick answers, if you just need the gist.

What does “How to Set Up OpenAI Codex” cover?
It has 22 sections, starting with “Learn what OpenAI Codex is”, “Pick where Codex runs”, “Choose a plan” and “Set up the ChatGPT desktop app”, plus 18 more sections.
How long does it take to read?
About 8 minutes. Every section is a short, self-contained card, so you can jump straight to the part you need.
Is this guide free?
Yes. The full guide is free to read on this page, with no sign-up.
When was this guide last updated?
It was last updated in October 2026.

Keep reading

More free guides you might like. Still no signup.

Free Notion database

1,100+ ways people are making money online

Real online businesses, creators and projects, broken down by how they make money: apps, online stores, AI tools and more. Free on Gumroad.

Get the free database

Free Notion database

399+ ways to make money online

Hundreds of online income methods in one place, so you can compare options and pick one to try. Free on Gumroad.

Get the free list

For research and ideas only. Results vary and nothing here is a promise of income. See our Disclaimer.

Weekly newsletter

Everything new, every Monday.

One short email every Monday with everything shipped that week: new free tools and websites, new guides, new free browser tools and what's new in my free Gumroad libraries, plus how the site is growing. Free, and you can unsubscribe anytime.

Join the newsletter

You sign up on Gumroad, which stores your email to send the newsletter. See our Privacy Policy.