Skip to main content
OpenAI Codex is OpenAI’s AI coding agent: you describe what you want in plain English, and it reads your project, edits the files, and runs commands until the job is done. To use it in your terminal, install the Codex CLI with one command, run codex in your project folder, and sign in with ChatGPT. The CLI and the code editor extension come with ChatGPT Plus ($20/month) and higher plans, and the Free and Go plans include Codex in the ChatGPT desktop app. To build a native iPhone app without a Mac, connect Vibecode to Codex: Codex directs Vibecode’s agent, which builds and tests the app on cloud Macs.

Codex at a Glance

Where Codex Runs

Codex is one agent with several front ends. On your computer, the CLI, the IDE extension, and the ChatGPT desktop app share one configuration file, ~/.codex/config.toml, so your settings and MCP servers follow you between them.

Is Codex Free?

Partly. OpenAI lists Codex on the Free and Go plans only in the ChatGPT desktop app, with the GPT-6 Luna model, and is still rolling it out. For the CLI, the IDE extension, Codex Cloud, and the iPhone app, you need ChatGPT Plus or higher. An OpenAI API key also works for local use. Enterprise and Edu pricing comes from OpenAI’s sales team. On Plus, OpenAI estimates 15 to 160 local messages every five hours with GPT-6.1 Sol, depending on the task, and weekly limits may also apply. In the CLI, /status shows what you have left. Prices and limits are from OpenAI’s Codex pricing page as of October 2026. OpenAI changes plans and models often, so check there before you buy.

How to Install Codex CLI

Open a terminal and run the command for your system:
Check it worked with codex --version. To update later, run the same install command again (with Homebrew, brew upgrade --cask codex). On Windows, run the PowerShell command in a new PowerShell window. Codex runs natively there with its own Windows sandbox. Prefer Linux tools? Run wsl --install in PowerShell as an administrator, open your WSL shell, and use the macOS/Linux command. WSL1 isn’t supported, and projects in your Linux home folder run faster than ones under /mnt/c/. On Linux and WSL2, Codex’s sandbox needs bubblewrap. Install it first with sudo apt install bubblewrap (Ubuntu, Debian) or sudo dnf install bubblewrap (Fedora).

How to Use Codex

  1. Open a terminal in your project folder: cd path/to/your-project
  2. Start it: type codex and press Enter
  3. Sign in: the first time, choose Sign in with ChatGPT and finish in your browser. To use an API key instead, run printenv OPENAI_API_KEY | codex login --with-api-key on macOS, Linux, or WSL, or $env:OPENAI_API_KEY | codex login --with-api-key in Windows PowerShell.
  4. Ask in plain English: for example, Tell me about this project or add a dark mode toggle to the settings screen
  5. Watch and approve: Codex shows its commands and edits as it works, and asks before it steps outside its sandbox
  6. Keep going: describe the next change, or type /review to have Codex check what changed
OpenAI recommends a Git commit before and after each task, so you can undo anything Codex did.

Approval and Sandbox Modes

The sandbox limits which files and network access Codex’s commands get. The approval policy decides when it stops to ask you. Type /permissions to switch during a session. The desktop app and IDE extension offer Ask for approval, Approve for me, and Full access in the permissions control below the message box.

Commands You’ll Use Most

Give Codex Project Notes with AGENTS.md

Codex reads AGENTS.md files before it starts any work. Run /init to create one, then edit it to say how to run the app, which build and test commands to use, and what “done” means. A personal ~/.codex/AGENTS.md applies to every project. Keep it short: Codex stops reading these files at 32 KiB by default.

How to Use Codex in VS Code or Cursor

  1. In VS Code (1.96.2 or later), open the Extensions view, search for Codex, and install the extension published by OpenAI. Cursor and Windsurf use the same extension (openai.chatgpt).
  2. Click the Codex icon. If you don’t see it, open the Command Palette and run Codex: Open Codex Sidebar.
  3. Select Sign in with ChatGPT, or Use API Key.
  4. Type your request. Add an open file or a selection as context, and review each change as a diff beside your code.
The extension shares its configuration with the CLI, MCP servers included. In Xcode, choose Codex as the agent in the coding assistant. In JetBrains IDEs, open AI Chat and select Codex.

How to Vibe Code an App with Codex

“Vibe coding” means building by describing what you want and judging the result, instead of writing the code yourself (more in What is vibe coding? and Can I vibe code?). With Codex, this loop works:
  1. Start clean. Make a new folder, run git init, then run codex.
  2. Plan first. Turn on /plan and describe the app: what it does, who it’s for, and what “done” looks like. Review the plan, then let it build.
  3. Run it. Ask Codex to start the app and tell you how to open it.
  4. Change one thing at a time. Say what’s wrong in plain English, and paste a screenshot into the message box when it helps.
  5. Commit each working step so you can go back when a change goes wrong.
For a simple website, OpenAI’s Sites (in public beta, depending on plan and region) can build and host it from ChatGPT or Codex. For a mobile app, Codex on your own computer gives you the code, but not the Mac, the phone preview, or the App Store setup.

How to Build an iPhone App with Codex

On your own computer, Codex can write a native Swift app, but you need a Mac with Xcode to build and run it, and an Apple Developer account ($99/year) to publish it. With Vibecode connected over MCP, Codex directs Vibecode’s agent, which builds the app on cloud Macs, tests it, and saves it to your Vibecode account. You don’t need a Mac.
1

Add Vibecode to Codex

2

Sign in

Codex opens the Vibecode sign-in page. Sign in (or create an account) and select Allow. To sign in again later, run codex mcp login vibecode.
3

Ask for an app

Start codex and ask in plain English. Type /mcp to check that Vibecode is connected.
Prompts that work:
  • “Using Vibecode, build me an iPhone app to track my workouts, with a weekly summary.”
  • “Show me my Vibecode apps.”
  • “Make the buttons in my workout app blue and add a rest timer.”
  • “Why did the last build of my habit tracker fail?”
What happens next. Vibecode’s agent writes the app (Swift and SwiftUI for a native iPhone app, or a web app), compiles iPhone apps on cloud Macs, tests the app, and saves it to your account. A build usually takes about 10 minutes. Codex can wait for it, then give you links to open the app in Vibecode, see it on your phone in the Vibecode iPhone app, or publish it to the App Store. Codex gets every Vibecode tool. It can read the app’s code and logs, restore an earlier version, and rename, copy, or delete apps. With run_command, it runs a shell command in the app’s cloud workspace, such as a test, and each command stops after 45 seconds. The CLI, the IDE extension, and the ChatGPT desktop app share ~/.codex/config.toml, so Vibecode appears in all three once you add it. If one asks you to sign in, select Authenticate next to Vibecode in its MCP servers list. Using only the desktop app? Open Settings, then MCP servers, select Add server, choose Streamable HTTP, and enter the server URL above. Connecting is free. Builds and changes use your Vibecode credits, and Codex’s own messages still count toward your ChatGPT plan. New accounts that sign up with Google or Apple get their first app build free. To disconnect, run codex mcp remove vibecode. Your apps stay in your account. Want Codex to write all the code itself? The Vibecode CLI works the other way: your agent writes the code and uses Vibecode’s sandboxes, databases, sign-in, and hosting to run and publish it.

Codex vs Claude Code

For vibe coding, both turn plain-English requests into working code and ask before risky steps. The bigger difference is which subscription you already pay for. With ChatGPT, start with Codex. With Claude, start with Claude Code. Codex has a free way in and an open-source CLI. Claude Code is the agent inside every Vibecode build. Switching later is cheap: Codex’s /import command brings over supported Claude Code setup and chats.

Frequently Asked Questions

Partly. On the ChatGPT Free and Go plans, Codex is in the ChatGPT desktop app with GPT-6 Luna, as OpenAI rolls it out. The CLI, the IDE extension, and Codex Cloud need ChatGPT Plus ($20/month) or higher, or you can pay per token with an OpenAI API key for local use.
As of October 2026, ChatGPT Plus is $20/month, Pro is $100, $200, or $500/month, and Business is $20 per user per month billed yearly. An API key is billed at OpenAI’s API rates. See OpenAI’s Codex pricing.
On macOS, Linux, or WSL run curl -fsSL https://chatgpt.com/codex/install.sh | sh. On Windows, use the PowerShell command in How to Install Codex CLI, or install with npm or Homebrew. Then run codex in your project folder and sign in.
Yes. Codex is part of the ChatGPT desktop app for macOS, Windows, and Linux (in preview). Select Codex from the ChatGPT dropdown. On macOS or Windows, codex app in the CLI opens the app, or starts its installer.
Yes. Install the Codex extension published by OpenAI (VS Code 1.96.2 or later). The same extension works in Cursor and Windsurf. Sign in with ChatGPT or an API key.
Codex can write the Swift code, but on your own you need a Mac with Xcode to build it and an Apple Developer account to publish it. With Vibecode connected, Codex has Vibecode’s agent build the app on cloud Macs, so you don’t need a Mac.
Run codex mcp add <name> --url <server-url>, for example codex mcp add vibecode --url https://api.vibecodeapp.com/mcp. Codex may open the server’s sign-in page right away (it does for Vibecode). If it doesn’t, run codex mcp login <name>. Servers live in ~/.codex/config.toml, shared by the CLI, IDE extension, and desktop app.
Both work. Pick the one that comes with the subscription you already have: Codex with ChatGPT, Claude Code with Claude. Codex has a free way in, and Claude Code needs a paid Claude plan. Either one can build a native iPhone app through Vibecode without a Mac.

Next Steps

Connect Vibecode to Your AI Tool

Steps for Codex, Claude Code, Cursor, and more

How to Use Claude Code

Install, cost, and building apps with Claude Code

How to Use Cursor

Vibe code in Cursor and build apps with Vibecode

How to Use Gemini CLI

Google’s coding agent, and how it builds apps

Build an App with ChatGPT

Build an iPhone app in a ChatGPT chat

Native iOS Apps

Swift apps for iPhone, no Mac needed
Last modified on October 27, 2026