OpenAI Codex
Codex CLI is OpenAI's terminal-based AI coding agent. Like Claude Code, it runs in your shell, reads your project files, makes edits, and works through tasks autonomously. No IDE required.
It's a good fit if you're already in a ChatGPT-heavy workflow, or if you want to run multiple agents in parallel across different parts of a project (Codex supports subagents for this).
npm install -g @openai/codexYou'll need a ChatGPT Plus, Pro, Business, Edu, or Enterprise account. Codex is included in these plans.
npm install -g @openai/codex in your terminalOnce installation is complete, you can verify it worked by running codex --version in your terminal. You should see the installed version number printed to the screen.
Unlike Cursor, which embeds a terminal pane inside a graphical IDE, Codex CLI runs entirely in the terminal. There is no graphical user interface. The terminal is the interface.
codex to start a sessionOn first run, Codex prompts you to authenticate with your ChatGPT account. Once in, you'll see the interactive TUI: a prompt where you describe what you want done, and Codex works through it.
A concrete example. From a Sanity Studio project, a prompt like "Add a category field to my post schema, with references to a new category document type, and regenerate the TypeGen types" triggers a predictable pattern:
- Codex reads
schemas/post.tsand nearby schema files. - It drafts
schemas/category.ts, adds areferencefield topost, and shows you both diffs. - After you approve, it runs
npx sanity schema typegenand shows the updatedsanity.types.ts. - If the TypeGen run fails, it reads the error, proposes a fix, and asks again.
The pattern holds for most tasks: read → propose → confirm → apply → verify.
Type / in a session to see available commands. /mcp shows your connected MCP servers once you've set those up in the next lessons.
Both are terminal-based agents that operate on your local files. The main differences are the underlying model (GPT vs. Claude) and some workflow tooling. Codex has built-in subagents for parallelising tasks, while Claude Code has tighter integration with the Sanity Agent Toolkit via its plugin system. Either works well for this course.
In the following lessons you'll prepare your environment for the best possible Sanity implementation. You could skip these steps, but your results wouldn't be nearly as good.
Let's set things up properly from the start.