An agentic CLI provided by OpenAI. They have an open source GitHub repo. Zero setup - bring your OpenAI API key and it just works!

Providers you can use:

  • openai (default)
  • openrouter
  • azure
  • gemini
  • ollama
  • mistral
  • deepseek
  • xai
  • groq
  • arceeai
  • any other provider that is compatible with the OpenAI API

Installation

Upgrade Codex

You can upgrade Codex with your preferred package manager:

Upgrade with npm

npm install -g @openai/codex@latest

Upgrade with Homebrew

brew upgrade codex

Commands


Configuration


Additional Tips and Tricks

Memory & Project Docs

You can give Codex extra instructions and guidance using AGENTS.md files. Codex looks for AGENTS.md files in the following places, and merges them top-down:

  1. ~/.codex/AGENTS.md - personal global guidance
  2. AGENTS.md at repo root - shared project notes
  3. AGENTS.md in the current working directory - sub-folder/feature specifics

Disable loading of these files with --no-project-doc or the environment variable CODEX_DISABLE_PROJECT_DOC=1.

Tracing / verbose logging

Setting the environment variable DEBUG=true prints full API request and response details:

DEBUG=true codex

Use Cases

Below are a few bite-size examples you can copy-paste. Replace the text in quotes with your own task. See the prompting guide for more tips and usage patterns.

✨What you typeWhat happens
1codex "Refactor the Dashboard component to React Hooks"Codex rewrites the class component, runs npm test, and shows the diff.
2codex "Generate SQL migrations for adding a users table"Infers your ORM, creates migration files, and runs them in a sandboxed DB.
3codex "Write unit tests for utils/date.ts"Generates tests, executes them, and iterates until they pass.
4codex "Bulk-rename *.jpeg -> *.jpg with git mv"Safely renames files and updates imports/usages.
5codex "Explain what this regex does: ^(?=.*[A-Z]).{8,}$"Outputs a step-by-step human explanation.
6codex "Carefully review this repo, and propose 3 high impact well-scoped PRs"Suggests impactful PRs in the current codebase.
7codex "Look for vulnerabilities and create a security review report"Finds and explains security bugs.