🦾

OpenAI Codex: The AI Coding Agent, Explained + How to Use It

What is OpenAI Codex?

Codex is OpenAI's AI coding agent: instead of handing you code to copy and paste, you describe a task and Codex plans it, reads your project files, edits multiple files, runs tests and keeps iterating until the job is done. It is made by OpenAI, the company behind ChatGPT, and started life in 2025 as a terminal tool before growing into a full product family.

You can use Codex three ways: the Codex CLI in your terminal, the IDE extension for editors like VS Code, and the Codex interface inside ChatGPT at chatgpt.com/codex, plus an iOS app. They all share the same engine, so a task you start in the terminal can continue in the IDE.

How Codex differs from ChatGPT and other coding agents

ChatGPT in a chat window is great for explaining code or generating snippets, but you still do the plumbing: create the file, paste, fix errors, run tests. Codex closes that loop. It is an agent, so it takes the action itself, and it shows you a plan first that you approve before it touches your files.

Compared with Cursor or Claude Code, Codex is the OpenAI-native option: it shares usage and credits with your ChatGPT plan, so if you already pay for ChatGPT, Codex costs nothing extra. It also has a genuinely usable free tier, which most coding agents do not. The trade-off is that you are committing to OpenAI's models, while Cursor and Claude Code let you switch providers more freely.

Install Codex CLI and log in

Codex CLI runs on macOS, Linux and Windows (via WSL2). The quickest install uses npm:

npm install -g @openai/codex

Then check it worked:

codex --version

On macOS you can also use brew install --cask codex. Next, log in. The simplest path uses your ChatGPT account:

codex login

That opens a browser to approve the connection. If you prefer API billing, run codex login --with-api-key and paste a key from platform.openai.com. For a first try, the ChatGPT login is easier and uses the credits included in your plan.

First task: watch it plan, then execute

Open a terminal inside one of your own projects (or a fresh test folder) and run codex. Start in read-only and approval mode so Codex explains what it wants to do before changing anything. Then give it a real task:

Add a /health endpoint to this Express app that returns JSON with status ok and the current server time. Update the tests too, then run the test suite and show me the result.

Codex lists the files it wants to read, writes a short plan, makes the edits, runs the tests and reports back. You approve each batch of changes, which is the habit to keep: always read the plan before approving, especially in a shared repository.

Real workflows: features, refactors, tests and bug fixes

Three prompts cover most everyday work. First, implement a feature:

Implement pagination for the product list in this repo. Follow the existing code style, keep the API backwards compatible, and add tests for the edge cases: empty page, and a page number beyond the last one.

Second, clean up code without changing behaviour:

Refactor the checkout function in src/orders.js: split it into smaller functions, remove duplicated validation logic, and keep the public API identical. Do not change behaviour, then run the full test suite to prove it.

Third, fix a failing build:

The CI build is failing on the integration tests. Read the latest logs, find the root cause, fix the code rather than the test, and explain in two sentences what went wrong.

Pricing and tips for Singapore developers and students

Codex is included in every ChatGPT plan, and pricing moved to token-based credits in April 2026. The free tier gives a limited trial, enough for small tasks and learning. ChatGPT Go is US$8 a month for light use, Plus is US$20 a month for a few focused coding sessions a week, and Pro is US$100 or US$200 a month for 5x to 20x more usage.

For students in Singapore, the free tier, plus a Plus plan during internship or project season, is usually plenty. If you are an NTUC member, the AI-Ready SG initiative subsidises 50% of ChatGPT subscriptions after a short UTAP-approved AI course, which effectively halves the Plus price. Check whether your polytechnic, university or company already provides ChatGPT access before paying anything. When Codex asks for permissions, grant the minimum: read-only for exploration, approval mode for edits.

For another take on agent setups, see our OpenClaw deploy guide, browse alternatives in the tools directory, and if prompts feel hit or miss, start with our guide to writing AI prompts.

❓ Frequently Asked Questions

Is Codex free?

Yes, there is a free tier with a limited trial of Codex tasks, enough for small jobs and learning. Paid access starts with ChatGPT Go at US$8 a month, with Plus at US$20 a month and Pro at US$100 or US$200 a month for heavier use.

What is the difference between Codex CLI and ChatGPT?

ChatGPT answers questions and generates code in a chat window, and you copy and paste the result yourself. Codex is an agent that plans, edits files and runs tests autonomously, with your approval at each step. Codex is included in ChatGPT plans.

Can Codex work on my existing project?

Yes. The CLI runs in any local folder and works best in a git repository, where it can read the codebase, make changes and show you a diff before you approve.

Is Codex worth paying for in Singapore?

Start with the free tier. If you code more than a few hours a week, Plus at US$20 a month is the common step up. NTUC members can claim a 50% subsidy on ChatGPT subscriptions through AI-Ready SG, and students should check free university access first.

How is Codex different from Cursor or Claude Code?

Codex is OpenAI's own agent, sharing credits and login with ChatGPT, and it has a free tier. Cursor is an AI-first editor with its own models, and Claude Code is Anthropic's terminal agent. All three are strong; pick by which model ecosystem you already use.

← Back to Blog

πŸ“– Related Articles

🦞
How to Deploy OpenClaw β€” Step by Step Guide
2026-05-01
🧩
Top 10 Must-Install OpenClaw Skills in 2026
2026-05-01
πŸ”§
Photoshop AI vs Canva AI: Which Should SG Businesses Use?
2026-04-15
🎬
How Singapore Creators Use ChatGPT to Write 30 TikTok Scripts in 1 Hour
2026-04-28
πŸ‡ΈπŸ‡¬

Still have a question?

Ask the SG AI Assistant β€” it answers Singapore-specific AI questions, grounded in our guides. Free, no sign-up, 30 questions a day.

πŸ’¬ Ask SG AI Assistant