# OpenAI Codex

Web page: https://academy.memberpress.ai/courses/ai-tool-guides/l2/

Lesson 2 of 4 in [AI Tool Guides: ChatGPT, Codex, Cursor and Grok](https://academy.memberpress.ai/courses/ai-tool-guides/), 11 min.

**What it is**

Codex is OpenAI's coding agent. It runs in the ChatGPT apps, in the Codex CLI in your terminal, in an IDE extension (VS Code, Cursor, Windsurf), and as Codex Cloud. It's included in ChatGPT's plans from Free up, or you can pay per use with an API key, without the cloud features.

**When to pick it**

When you want an agent to work in a real codebase and you already pay for ChatGPT. Claude Code and Cursor cover the same ground; the habits in Same Skills, Any Assistant carry across all three.

**Setup**

1. Install the CLI on macOS or Linux: `curl -fsSL https://chatgpt.com/codex/install.sh | sh`. The same command updates it.
2. In your project folder, run `codex` and choose "Sign in with ChatGPT".
3. Run `/init` to write a first `AGENTS.md`. Codex reads `~/.codex/AGENTS.md`, then the one at your repository's root, then one in each folder down to where you are, so the nearest one wins.
4. Choose how much it may do. The sandbox can be `read-only`, `workspace-write` (the default for local work) or `danger-full-access`, and the approval policy can be `on-request` or `never`. Type `/permissions` to change them.

**A first real task**

Start read-only and ask: "Explain how this project is laid out and how I run its tests." Then switch to `workspace-write` with approvals `on-request`, and ask for one small fix. Read the change before you approve it.

**Connect it to your site or data**

Codex keeps MCP servers in `~/.codex/config.toml` (or `.codex/config.toml` in a trusted project), shared by the app, the CLI and the IDE extension. Add one from the terminal with `codex mcp add`, or in the file:

```toml
[mcp_servers.memberpress-ai-academy]
url = "https://academy.memberpress.ai/mcp"
```

`codex mcp list` shows what's connected, and `/mcp` shows it inside a session.

Checked against OpenAI's docs on 2026-10-14: [Codex overview](https://learn.chatgpt.com/docs), [pricing](https://learn.chatgpt.com/docs/pricing), [CLI](https://learn.chatgpt.com/docs/codex/cli), [IDE extension](https://learn.chatgpt.com/docs/codex/ide), [AGENTS.md](https://learn.chatgpt.com/docs/agent-configuration/agents-md), [MCP](https://learn.chatgpt.com/docs/extend/mcp?surface=cli), [sandboxing](https://learn.chatgpt.com/docs/sandboxing).

## Try these prompts

- Write an AGENTS.md for this repository: how to install, how to run the tests, and the three rules you most need to follow here.
- Read this repository and tell me, before changing anything, how you'd add a contact form. Wait for me to say go.

Next: [Cursor](https://academy.memberpress.ai/courses/ai-tool-guides/l3/)
