Skip to content

OpenAI Codex โ€” AI Coding Agent

OpenAI Codex (the 2025 agent, distinct from the original Codex model that powered GitHub Copilot) is OpenAIโ€™s cloud-native agentic coding tool. It runs in a secure, sandboxed cloud environment, pulls your code from GitHub, and autonomously completes coding tasks โ€” writing code, running tests, and opening pull requests.

Note: The original โ€œCodexโ€ model (2021) was the AI underlying GitHub Copilot. The modern Codex is a full coding agent โ€” a much more capable, autonomous system.

Unlike terminal-based agents (Claude Code) or IDE agents (Cursor), Codex runs entirely in the cloud:

You describe a task in natural language (chat.openai.com or API)
โ†“
Codex clones your GitHub repo in a secure sandbox
โ†“
Codex reads code, runs commands, edits files, runs tests
โ†“
You get back a result: fixed code, a PR, or a status report
โ†“
You review and merge the PR

Your local machine is never involved โ€” Codex operates in isolated cloud containers.

FeatureDescription
Sandboxed executionRuns in isolated containers โ€” safe even for untrusted code
GitHub integrationPull from any GitHub repo you give access to
PR generationOpens GitHub pull requests with descriptions
Parallel tasksRun multiple coding tasks simultaneously
Test verificationRuns your test suite and retries if tests fail
Long-running tasksCan work for minutes to hours on complex features
Audit logFull record of every command and file change

OpenAI also offers a Codex CLI โ€” a terminal agent similar to Claude Code:

Terminal window
# Install
npm install -g @openai/codex
# Run in your project
codex
# Ask it to do something
codex "Add unit tests for the payment module"

The Codex CLI uses GPT-4o and runs locally, reading files and making changes in your working directory.

FeatureOpenAI Codex (cloud)Claude CodeCursor
RunsCloud sandboxYour local terminalYour local IDE
GitHub integrationNative (cloud PR)Via git CLIVia git CLI
Parallel tasksYesNo (sequential)No
Local file accessNo (cloud only)YesYes
IDE requiredNoNoYes
Audit logFull cloud logTerminal historySession history
ModelGPT-4o / o3Claude 3.7+Claude / GPT-4o
Long tasksYes (cloud persistent)Session-limitedSession-limited
  • Bug fixes โ€” โ€œFix the null pointer exception in /api/users routeโ€
  • Feature development โ€” โ€œAdd pagination to the product listing pageโ€
  • Test generation โ€” โ€œWrite comprehensive unit tests for the auth moduleโ€
  • Refactoring โ€” โ€œRefactor the database service to use the repository patternโ€
  • Documentation โ€” โ€œDocument all public methods in the UserService classโ€
  • Code review implementation โ€” โ€œApply all the suggestions from PR #42โ€

Because Codex runs in sandboxed containers:

  • It cannot access your local machine
  • Each task gets a fresh, isolated environment
  • Your secrets/credentials can be injected via encrypted environment variables
  • The container is destroyed after each task

Codex is available through:

  • ChatGPT Pro ($200/month) โ€” direct access in the ChatGPT interface
  • OpenAI API โ€” pay per token (model-dependent pricing)